{
"Comment": "Batch clinical trial sample processing: iterates over multiple samples concurrently (Map), and within each sample runs eligibility and biomarker analysis simultaneously (Parallel) before accepting or rejecting.",
"StartAt": "ProcessSampleBatch",
"States": {
"ProcessSampleBatch": {
"Type": "Map",
"Comment": "Process each sample in the batch concurrently, up to 3 at a time.",
"ItemsPath": "$.samples",
"MaxConcurrency": 3,
"ItemProcessor": {
"ProcessorConfig": {
"Mode": "INLINE"
},
"StartAt": "ValidateItem",
"States": {
"ValidateItem": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "${ValidateSampleFunctionArn}",
"Payload.$": "$"
},
"ResultPath": "$.validation",
"Retry": [
{
"ErrorEquals": [
"Lambda.ServiceException",
"Lambda.AWSLambdaException",
"Lambda.SdkClientException"
],
"IntervalSeconds": 2,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"ResultPath": "$.error",
"Next": "ItemValidationError"
}
],
"Next": "IsItemValid"
},
"IsItemValid": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.validation.Payload.isValid",
"BooleanEquals": true,
"Next": "EligibilityAndBiomarkerScreening"
}
],
"Default": "RejectInvalidItem"
},
"RejectInvalidItem": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "${RejectSampleFunctionArn}",
"Payload": {
"reason": "INVALID_SAMPLE",
"sample.$": "$"
}
},
"ResultPath": "$.rejection",
"End": true
},
"ItemValidationError": {
"Type": "Fail",
"Error": "ValidationError",
"Cause": "Sample validation lambda failed unexpectedly"
},
"EligibilityAndBiomarkerScreening": {
"Type": "Parallel",
"Comment": "Run eligibility check and biomarker analysis concurrently to minimise latency.",
"Branches": [
{
"StartAt": "EligibilityCheck",
"States": {
"EligibilityCheck": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "${CheckParticipantEligibilityFunctionArn}",
"Payload.$": "$"
},
"ResultPath": "$.eligibility",
"End": true
}
}
},
{
"StartAt": "BiomarkerAnalysis",
"States": {
"BiomarkerAnalysis": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "${AnalyzeBiomarkersFunctionArn}",
"Payload.$": "$"
},
"ResultPath": "$.biomarkers",
"End": true
}
}
}
],
"ResultPath": "$.screeningResults",
"Next": "ItemAccepted"
},
"ItemAccepted": {
"Type": "Succeed"
}
}
},
"ResultPath": "$.batchResults",
"Next": "BatchComplete"
},
"BatchComplete": {
"Type": "Succeed"
}
}
}JSONExpand
100%
Biotechnology teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.