BookmarkSubscribe
Choose Language Hide Translation Bar
jan_solo
Community Trekker

Levey Jennings tests on individual points to datatable

Hi Everyone,

 

I have yet another interesting question.

 

I have a datatable from which I generate a Levey Jennings chart, marking tests 1, 3 and 5.  If the last point in the chart is marked by one of these tests, I need to dhow the chart in a different window.  Is this possible in jsl?

 

It doesn't matter if I can get this from the chart or from the datatable.  If necessary, I add an extra column with the tests the points have been marked with.

 

Thanks!!!,

 

Jan

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User

Re: Levey Jennings tests on individual points to datatable

JMP Control Charts have a feature called an Alarm Script.  You can specify it in the call statement, however, it is easier to retrieve information if you use the technique shown in the script.  The example specifies one Chart Col, however, if you have multiple chart columns make sure the alarm writes out qc_col.  See the notes below the script.

Names Default To Here( 1 );
dt = New Table ("Data", New Column("Day", numeric, continuous), New Column("Measurement", numeric, continuous),
    add rows(100));
    
 dt:Day << set each value(Today() - (101-row())*24*60*60);
 dt:Measurement << set each value( if( row() <= 90, floor(Random Normal()*20 + 200),
 	floor(Random Normal()*20 + 200 + (row() -90)*10) )    
 );
 
 dt:Day << Format( "m/d/y", 10);

nmx = nrow(dt) + 6;
lj_chart = Control Chart(
	Sample Label( :Day ),
	KSigma( 3 ),
	Chart Col(
		:Measurement,
		Levey Jennings
		
	),
	Alarm Script(Write( qc_col, ": ", qc_sample, ", ")),
	SendToReport(
		Dispatch(
			{"Levey Jennings of Measurement"},
			"1",
			ScaleBox,
			{Min( 0 ), Max( nmx ), Inc( 7 ),
			Minor Ticks( 0 )}
		)
	)
);
flag1 = Log Capture( lj_chart << Test 1(1) );
flag3 = Log Capture( lj_chart << Test 3(1) );
flag5 = Log Capture( lj_chart << Test 5(1) );
show(flag1, flag3, flag5);

Now you can parse the "flags" and look to determine if the last value is flagged, If it is then clone the graph and place it in a new window.  You did not state, if you wanted this to be a live "copy" or a cloned copy of the graph.

 

I do not know your JSL skills, nor task specifics, so I kept this example simple.

 

There is another method to get this information, but it requires parsing, and I would not recommend it. The method is For each chart  you get the journal _xx = lj_chart << Get Journal;  the points with flags will have additional markers with text, , that is Marker(Combine States(...)).  The insert below was copied from the the log.  

Marker({99, 283}), Pen Color(0), Marker Size(3), Marker({100, 311}), Pen Color(0), Pen Color(3), Marker(Combine States(Color State(3),Marker State(8)), {98, 275}), Text({98.2, 275}, \!"5\!"), Pen Color(3), Marker(Combine States(Color State(3),Marker State(8)), {99, 283}), Text({99.2, 283}, \!"5\!"), Pen Color(3), Marker(Combine States(Color State(3),Marker State(8)), {100, 311}), Text({100.2, 311}, \!"1\!"), Pen Color(0)})

You can see that sample 98 has a value of 275 and was flagged for rule 5, ditto for sample 99 value 283 and sample 100 with value 311 was flagged for rule 1.

 

Final note, since the measurements are randomly generated, you will likely not get the same results as these.

It is a long time Wish List item to save the flags to the data table, or even expand the Alarm Script to write to the data table.

 

I hope you find this useful.

Georgia 

 

3 REPLIES 3
gzmorgan0
Super User

Re: Levey Jennings tests on individual points to datatable

JMP Control Charts have a feature called an Alarm Script.  You can specify it in the call statement, however, it is easier to retrieve information if you use the technique shown in the script.  The example specifies one Chart Col, however, if you have multiple chart columns make sure the alarm writes out qc_col.  See the notes below the script.

Names Default To Here( 1 );
dt = New Table ("Data", New Column("Day", numeric, continuous), New Column("Measurement", numeric, continuous),
    add rows(100));
    
 dt:Day << set each value(Today() - (101-row())*24*60*60);
 dt:Measurement << set each value( if( row() <= 90, floor(Random Normal()*20 + 200),
 	floor(Random Normal()*20 + 200 + (row() -90)*10) )    
 );
 
 dt:Day << Format( "m/d/y", 10);

nmx = nrow(dt) + 6;
lj_chart = Control Chart(
	Sample Label( :Day ),
	KSigma( 3 ),
	Chart Col(
		:Measurement,
		Levey Jennings
		
	),
	Alarm Script(Write( qc_col, ": ", qc_sample, ", ")),
	SendToReport(
		Dispatch(
			{"Levey Jennings of Measurement"},
			"1",
			ScaleBox,
			{Min( 0 ), Max( nmx ), Inc( 7 ),
			Minor Ticks( 0 )}
		)
	)
);
flag1 = Log Capture( lj_chart << Test 1(1) );
flag3 = Log Capture( lj_chart << Test 3(1) );
flag5 = Log Capture( lj_chart << Test 5(1) );
show(flag1, flag3, flag5);

Now you can parse the "flags" and look to determine if the last value is flagged, If it is then clone the graph and place it in a new window.  You did not state, if you wanted this to be a live "copy" or a cloned copy of the graph.

 

I do not know your JSL skills, nor task specifics, so I kept this example simple.

 

There is another method to get this information, but it requires parsing, and I would not recommend it. The method is For each chart  you get the journal _xx = lj_chart << Get Journal;  the points with flags will have additional markers with text, , that is Marker(Combine States(...)).  The insert below was copied from the the log.  

Marker({99, 283}), Pen Color(0), Marker Size(3), Marker({100, 311}), Pen Color(0), Pen Color(3), Marker(Combine States(Color State(3),Marker State(8)), {98, 275}), Text({98.2, 275}, \!"5\!"), Pen Color(3), Marker(Combine States(Color State(3),Marker State(8)), {99, 283}), Text({99.2, 283}, \!"5\!"), Pen Color(3), Marker(Combine States(Color State(3),Marker State(8)), {100, 311}), Text({100.2, 311}, \!"1\!"), Pen Color(0)})

You can see that sample 98 has a value of 275 and was flagged for rule 5, ditto for sample 99 value 283 and sample 100 with value 311 was flagged for rule 1.

 

Final note, since the measurements are randomly generated, you will likely not get the same results as these.

It is a long time Wish List item to save the flags to the data table, or even expand the Alarm Script to write to the data table.

 

I hope you find this useful.

Georgia 

 

gzmorgan0
Super User

Re: Levey Jennings tests on individual points to datatable

oops!  The log out put wrapped. This should be easier to read.

Marker({99, 283}), Pen Color(0), Marker Size(3), 
Marker({100, 311}), Pen Color(0), Pen Color(3), 
Marker(Combine States(Color State(3),Marker State(8)), {98, 275}), Text({98.2, 275}, \!"5\!"), Pen Color(3), 
Marker(Combine States(Color State(3),Marker State(8)), {99, 283}), Text({99.2, 283}, \!"5\!"), Pen Color(3), 
Marker(Combine States(Color State(3),Marker State(8)), {100, 311}), Text({100.2, 311}, \!"1\!"), Pen Color(0)})
0 Kudos
jan_solo
Community Trekker

Re: Levey Jennings tests on individual points to datatable

Thanks for the reply, and the solution!  This is actually quite cool.

The rest of the script won't be a problem.

0 Kudos