Clinical Trial Pipeline

Models a complete end-to-end clinical trial data pipeline using AWS Step Functions. It validates incoming biological samples, confirms participant eligibility, runs biomarker analysis, screens for adverse events, generates a clinical report, and notifies the principal investigator.
{
  "Comment": "End-to-end clinical trial data pipeline — validates sample, checks eligibility, analyzes biomarkers, screens for adverse events, generates report, and notifies the investigator.",
  "StartAt": "ValidateSample",
  "States": {
    "ValidateSample": {
      "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": 3,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "ValidationError"
        }
      ],
      "Next": "IsSampleValid"
    },
    "IsSampleValid": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.validation.Payload.isValid",
          "BooleanEquals": true,
          "Next": "CheckEligibility"
        }
      ],
      "Default": "RejectInvalidSample"
    },
    "RejectInvalidSample": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${RejectSampleFunctionArn}",
        "Payload": {
          "reason": "INVALID_SAMPLE",
          "sample.$": "$"
        }
      },
      "ResultPath": "$.rejection",
      "End": true
    },
    "ValidationError": {
      "Type": "Fail",
      "Error": "ValidationError",
      "Cause": "Sample validation lambda failed unexpectedly"
    },
    "CheckEligibility": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${CheckParticipantEligibilityFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.eligibility",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "EligibilityError"
        }
      ],
      "Next": "IsParticipantEligible"
    },
    "IsParticipantEligible": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.eligibility.Payload.isEligible",
          "BooleanEquals": true,
          "Next": "AnalyzeBiomarkers"
        }
      ],
      "Default": "RejectIneligibleParticipant"
    },
    "RejectIneligibleParticipant": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${RejectSampleFunctionArn}",
        "Payload": {
          "reason": "PARTICIPANT_INELIGIBLE",
          "sample.$": "$"
        }
      },
      "ResultPath": "$.rejection",
      "End": true
    },
    "EligibilityError": {
      "Type": "Fail",
      "Error": "EligibilityCheckError",
      "Cause": "Participant eligibility check lambda failed unexpectedly"
    },
    "AnalyzeBiomarkers": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${AnalyzeBiomarkersFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.biomarkers",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "AnalysisError"
        }
      ],
      "Next": "DetectAdverseEvent"
    },
    "AnalysisError": {
      "Type": "Fail",
      "Error": "BiomarkerAnalysisError",
      "Cause": "Biomarker analysis lambda failed unexpectedly"
    },
    "DetectAdverseEvent": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${DetectAdverseEventFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.adverseEvent",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "AdverseDetectionError"
        }
      ],
      "Next": "GenerateReport"
    },
    "AdverseDetectionError": {
      "Type": "Fail",
      "Error": "AdverseEventDetectionError",
      "Cause": "Adverse event detection lambda failed unexpectedly"
    },
    "GenerateReport": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${GenerateReportFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.report",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "ReportGenerationError"
        }
      ],
      "Next": "NotifyInvestigator"
    },
    "ReportGenerationError": {
      "Type": "Fail",
      "Error": "ReportGenerationError",
      "Cause": "Report generation lambda failed unexpectedly"
    },
    "NotifyInvestigator": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${NotifyInvestigatorFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.notification",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "NotificationError"
        }
      ],
      "Next": "TrialPipelineComplete"
    },
    "NotificationError": {
      "Type": "Fail",
      "Error": "NotificationError",
      "Cause": "Investigator notification lambda failed unexpectedly"
    },
    "TrialPipelineComplete": {
      "Type": "Succeed"
    }
  }
}
JSON
Expand
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.

Free Trial