recipe and pattern validation on Biorad imports

This commit is contained in:
Chase Tucker
2024-12-09 13:52:37 -07:00
parent 95763eb69b
commit 0c2a5770a9
4 changed files with 396 additions and 40 deletions

View File

@ -96,6 +96,7 @@ Declare function SRP_Sort_Array, Metrology_Services, obj_RDS_Test, obj_Test_P
Declare function Work_Order_Services, SRP_JSON, Logging_Services, Environment_Services, SRP_Trim, Min, Max
Declare function QA_Services, SRP_Join_Arrays, Get_Status, Obj_Clean_Insp, Datetime, SRP_Datetime
Declare function Httpclient_Services, PM_Services, Signature_Services, SRP_Array, Math_Services
Declare function Tool_Class_Services
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\Metrology'
LogDate = Oconv(Date(), 'D4/')
@ -608,7 +609,6 @@ end service
Service ImportBioRadData(RunData, FileName)
Machine = 'BioRad'
IsProdTest = False$
ParseArray = ''
@ -685,14 +685,19 @@ Service ImportBioRadData(RunData, FileName)
If IsProdTest EQ True$ then Metrology_Services('LogResults',RDSKeyID,Machine,'HgCV','Product test recognized. Recipe name: ':ScanRecipe)
end
// -------------------------------------------------------------------------------------------------------------
CassNo = RDSRec<RDS_CASS_NO$>
WorkOrder = Work_Order_Services('GetWorkOrder', WorkOrderNo, False$)
GoSub ParseWorkOrder
IsEpiPro = (WOReactorType _EQC 'EpiPro') OR (WOReactorType _EQC 'EPP')
RunDataZone = Metrology_Services('FormatZoneKeyID', RunDataZone) ; // 1, 2
RunDataLayer = Metrology_Services('FormatLayerKeyID', RunDataLayer) ; // L1, L2, 2
RunDataLayer = Metrology_Services('FormatLayerKeyID', RunDataLayer) ; // L1, L2, 2
ZoneForValidation = RunDataZone
LayerForValidation = RunDataLayer
If LayerForValidation EQ '' then
LayerForValidation = 'L1'
end
CalculatedZone = Metrology_Services('GetCalculatedZone', RDSKeyID, IsEpiPro, RunDataZone)
If RunDataZone NE CalculatedZone then
@ -851,28 +856,51 @@ Service ImportBioRadData(RunData, FileName)
SigProfFound = True$
UnloadSigned = Signature_Services('GetStageSummary', WoMatKey, 'UNLOAD')<2>
IF (Stage EQ 'UNLOAD' AND UnloadSigned EQ True$) OR Stage NE 'UNLOAD' then
If WOMatQARec<WO_MAT_QA_RESULT$, Pos> EQ '' OR IsViewerFile then
WOMatQARec<WO_MAT_QA_RESULT$, Pos> = Average
WOMatQARec<WO_MAT_QA_MIN_RESULT$, Pos> = Oconv(Iconv(Min, 'MD3'), 'MD3')
WOMatQARec<WO_MAT_QA_MAX_RESULT$, Pos> = Oconv(Iconv(Max, 'MD3'), 'MD3')
SpecMin = WOMatQARec<WO_MAT_QA_MIN$, Pos>
SpecMax = WOMatQARec<WO_MAT_QA_MAX$, Pos>
For each DataPoint in RawDataPoints using @FM setting SubValuePos
FormatedData = Oconv(Iconv(DataPoint, 'MD3'), 'MD3')
If NumDataPoints LT 14 then
If ( ( FormatedData LT SpecMin ) OR ( FormatedData GT SpecMax ) and (SubValuePos LT 10) ) then
WOMatQARec<WO_MAT_QA_OUT_OF_SPEC$, Pos> = True$
end
end else
If ( FormatedData LT SpecMin ) OR ( FormatedData GT SpecMax ) then
WOMatQARec<WO_MAT_QA_OUT_OF_SPEC$, Pos> = True$
end
end
WOMatQARec<WO_MAT_QA_DATA_POINTS$, Pos, SubValuePos> = FormatedData
Next DataPoint
WOMatQARec<WO_MAT_QA_SIG$, Pos> = ''
WOMatQARec<WO_MAT_QA_SIG_DTM$, Pos> = ''
Database_Services('WriteDataRow', 'WO_MAT_QA', WOMatQAID, WOMatQARec, True$, False$, True$)
// verify recipe is correct
WoMatQaRecipe = WOMatQARec<WO_MAT_QA_RECIPE$, Pos>
WoMatQaRecipeMatchesScanRecipe = ScanRecipe _EQC WoMatQaRecipe
If WoMatQaRecipeMatchesScanRecipe EQ False$ then
ErrMsg = 'Scan recipe [ ' : ScanRecipe : ' ] does not match WoMatQa recipe [ ' : WoMatQaRecipe : ' ] for RDS [ ' : RDSKeyID : ' ] layer [ ' : CalculatedLayer : ' ].'
Error_Services('Add', ErrMsg)
Metrology_Services('LogResults', RDSKeyID, Machine, 'UID001', Service : ' : ' : Error_Services('GetMessage'))
end
// verify number of points is correct
WoMatQaToolClass = WOMatQARec<WO_MAT_QA_TOOL_CLASS$, Pos>
WoMatQaRecipePattern = WOMatQARec<WO_MAT_QA_RECIPE_PATTERN$, Pos>
NumDataPointsInSpec = Tool_Class_Services('GetNumberOfPointsForPattern', WoMatQaToolClass, WoMatQaRecipePattern)
WoMatQaRecipePatternNumPointsMatchesScanNumDataPoints = NumDataPointsInSpec EQ NumDataPoints
If WoMatQaRecipePatternNumPointsMatchesScanNumDataPoints EQ False$ then
ErrMsg = 'Scan data point count [ ' : NumDataPoints : ' ] does not match WoMatQa recipe pattern data point count [ ' : NumDataPointsInSpec : ' ] for RDS [ ' : RDSKeyID : ' ] layer [ ' : CalculatedLayer : ' ].'
Error_Services('Add', ErrMsg)
Metrology_Services('LogResults', RDSKeyID, Machine, 'UID001', Service : ' : ' : Error_Services('GetMessage'))
end
If (WOMatQARec<WO_MAT_QA_RESULT$, Pos> EQ '' OR IsViewerFile) then
If WoMatQaRecipeMatchesScanRecipe and WoMatQaRecipePatternNumPointsMatchesScanNumDataPoints then
WOMatQARec<WO_MAT_QA_RESULT$, Pos> = Average
WOMatQARec<WO_MAT_QA_MIN_RESULT$, Pos> = Oconv(Iconv(Min, 'MD3'), 'MD3')
WOMatQARec<WO_MAT_QA_MAX_RESULT$, Pos> = Oconv(Iconv(Max, 'MD3'), 'MD3')
SpecMin = WOMatQARec<WO_MAT_QA_MIN$, Pos>
SpecMax = WOMatQARec<WO_MAT_QA_MAX$, Pos>
For each DataPoint in RawDataPoints using @FM setting SubValuePos
FormatedData = Oconv(Iconv(DataPoint, 'MD3'), 'MD3')
If NumDataPoints LT 14 then
If ( ( FormatedData LT SpecMin ) OR ( FormatedData GT SpecMax ) and (SubValuePos LT 10) ) then
WOMatQARec<WO_MAT_QA_OUT_OF_SPEC$, Pos> = True$
end
end else
If ( FormatedData LT SpecMin ) OR ( FormatedData GT SpecMax ) then
WOMatQARec<WO_MAT_QA_OUT_OF_SPEC$, Pos> = True$
end
end
WOMatQARec<WO_MAT_QA_DATA_POINTS$, Pos, SubValuePos> = FormatedData
Next DataPoint
WOMatQARec<WO_MAT_QA_SIG$, Pos> = ''
WOMatQARec<WO_MAT_QA_SIG_DTM$, Pos> = ''
Database_Services('WriteDataRow', 'WO_MAT_QA', WOMatQAID, WOMatQARec, True$, False$, True$)
end
end else
Metrology_Services('LogResults', RDSKeyID, Machine, 'UID001', Service : ' : UID001 - Data for this metrology test already exists and is not from the metrology viewer.')
end
@ -890,7 +918,36 @@ Service ImportBioRadData(RunData, FileName)
end
Case Otherwise$
// If not an above case, then the run is a conventional THICK_ONLY RDS metrology test.
GoSub LoadRunDataToDatabase
RDSLayerKeyID = RDSKeyID : '*' : LayerForValidation
RDSLayerRec = Database_Services('ReadDataRow', 'RDS_LAYER', RDSLayerKeyID)
If Error_Services('NoError') then
RDSTestKeyIDs = RDSLayerRec<RDS_LAYER_RDS_TEST_KEYS$>
// Verify the scan recipe matches the spec recipe
RecipeMatches = Metrology_Services('ScanRecipeMatchesRdsTestSpecThickMrecipe', RDSKeyID, LayerForValidation, ScanRecipe, RDSTestKeyIDs, ZoneForValidation)
If RecipeMatches EQ False$ then
ErrMsg = 'Scan recipe [ ' : ScanRecipe : ' ] does not match RDS Test recipe for RDS [ ' : RDSKeyID : ' ] layer [ ' : CalculatedLayer : ' ] zone [ ' : CalculatedZone : ' ].'
Error_Services('Add', ErrMsg)
Metrology_Services('LogResults', RDSKeyID, Machine, 'UID001', Service : ' : ' : Error_Services('GetMessage'))
end
// Verfiy the scan number of points matches the spec number of points
NumPointsMatches = Metrology_Services('ScanNumDataPointsMatchesRdsTestSpecThickMPattern', RDSKeyID, LayerForValidation, NumDataPoints, RDSTestKeyIDs, 'FTIR', ZoneForValidation)
If NumPointsMatches EQ False$ then
ErrMsg = 'Scan data point count [ ' : NumDataPoints : ' ] does not match RDS Test recipe pattern data point count for RDS [ ' : RDSKeyID : ' ] layer [ ' : CalculatedLayer : ' ] zone [ ' : CalculatedZone : ' ].'
Error_Services('Add', ErrMsg)
Metrology_Services('LogResults', RDSKeyID, Machine, 'UID001', Service : ' : ' : Error_Services('GetMessage'))
end
If RecipeMatches and NumPointsMatches then
GoSub LoadRunDataToDatabase
end
end else
ErrMsg = 'RDS Test scan failed for RDS [' : RDSKeyID : '] layer [' : LayerForValidation : '], because unable to get RDS_LAYER record [' : RDSLayerKeyID : ']'
Error_Services('Add', ErrMsg)
Metrology_Services('LogResults', RDSKeyID, Machine, 'UID001', Service : ' : ' : Error_Services('GetMessage'))
end
End Case
end else
Error_Services('Add', 'Data type / Spec not found for Layer [' : RunDataLayer : '].')
@ -2416,6 +2473,88 @@ Service GetIQSViolations()
end
end service
Service ScanRecipeMatchesRdsTestSpecThickMrecipe(RdsNo, RecipeLayer, RecipeInScan, RdsTestKeysFromRdsLayer, Zone='')
If Unassigned(RecipeLayer) or RecipeLayer EQ '' then
RecipeLayer = 'L1'
end
MatchFound = False$
ValidArgs = Assigned(RdsNo) and RdsNo NE '' and Assigned(RecipeInScan) and RecipeInScan NE ''
ValidArgs = ValidArgs and Assigned(RdsTestKeysFromRdsLayer) and Dcount(RdsTestKeysFromRdsLayer, @VM) GT 0
If ValidArgs then
For Each RDSTestKeyID in RdsTestKeysFromRdsLayer using @VM setting mkPos
RdsTestRec = Database_Services('ReadDataRow', 'RDS_TEST', RDSTestKeyID)
If Error_Services('NoError') then
RdsTestRdsNo = RdsTestRec<RDS_TEST_RDS_NO$>
If RdsNo EQ RdsTestRdsNo then
RdsTestRecLayer = RdsTestRec<RDS_TEST_LS_ID$>
If RecipeLayer EQ RdsTestRecLayer then
Continue = True$
If Zone NE '' then
RdsTestRecZone = RdsTestRec<RDS_TEST_ZONE$>
If RdsTestRecZone NE Zone then
Continue = False$
end
end
If Continue then
SpecThickMrecipe = RdsTestRec<RDS_TEST_SPEC_THICK_MRECIPE$>
If RecipeInScan _EQC SpecThickMrecipe then
MatchFound = True$
end
end
end
end
end
Until MatchFound
Next RDSTestKeyID
end
Response = MatchFound
end service
Service ScanNumDataPointsMatchesRdsTestSpecThickMPattern(RdsNo, RecipeLayer, ScanNumDataPoints, RdsTestKeysFromRdsLayer, ToolClass, Zone='')
If Unassigned(RecipeLayer) or RecipeLayer EQ '' then
RecipeLayer = 'L1'
end
MatchFound = False$
ValidArgs = Assigned(RdsNo) and RdsNo NE '' and Assigned(ScanNumDataPoints) and Num(ScanNumDataPoints)
ValidArgs = ValidArgs and Assigned(RdsTestKeysFromRdsLayer) and Dcount(RdsTestKeysFromRdsLayer, @VM) GT 0
ValidArgs = ValidArgs and Assigned(ToolClass) and ToolClass NE ''
If ValidArgs then
For Each RDSTestKeyID in RdsTestKeysFromRdsLayer using @VM setting mkPos
RdsTestRec = Database_Services('ReadDataRow', 'RDS_TEST', RDSTestKeyID)
If Error_Services('NoError') then
RdsTestRdsNo = RdsTestRec<RDS_TEST_RDS_NO$>
If RdsNo EQ RdsTestRdsNo then
RdsTestRecLayer = RdsTestRec<RDS_TEST_LS_ID$>
If RecipeLayer EQ RdsTestRecLayer then
Continue = True$
If Zone NE '' then
RdsTestRecZone = RdsTestRec<RDS_TEST_ZONE$>
If RdsTestRecZone NE Zone then
Continue = False$
end
end
If Continue then
SpecPatternName = RdsTestRec<RDS_TEST_SPEC_THICK_MPATTERN$>
SpecNumDataPoints = Tool_Class_Services('GetNumberOfPointsForPattern', ToolClass, SpecPatternName)
If ScanNumDataPoints EQ SpecNumDataPoints then
MatchFound = True$
end
end
end
end
end
Until MatchFound
Next RDSTestKeyID
end
Response = MatchFound
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -2877,3 +3016,4 @@ return