Express Eligibility Check

Provides a low-latency express path for participant eligibility screening. It immediately checks eligibility on the incoming request and, if cleared, runs a preliminary biomarker scan, then applies a brief Wait to allow the result to propagate to downstream reporting systems before completing with a Succeed or Fail terminal state.
{
  "Comment": "Express eligibility check — low-latency path covering Pass, Task, Choice, Wait, Succeed, and Fail states.",
  "StartAt": "SetCheckMeta",
  "States": {
    "SetCheckMeta": {
      "Type": "Pass",
      "Parameters": {
        "sampleId.$": "$.sampleId",
        "participantId.$": "$.participantId",
        "trialId.$": "$.trialId",
        "sampleType.$": "$.sampleType",
        "collectionDate.$": "$.collectionDate",
        "biomarkers.$": "$.biomarkers",
        "participant.$": "$.participant",
        "investigatorId.$": "$.investigatorId",
        "checkId.$": "$$.Execution.Id",
        "channel": "EXPRESS"
      },
      "Next": "EligibilityScreen"
    },
    "EligibilityScreen": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${CheckParticipantEligibilityFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.eligibility",
      "Retry": [
        {
          "ErrorEquals": [
            "Lambda.ServiceException",
            "Lambda.AWSLambdaException"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "EligibilityCheckFailed"
        }
      ],
      "Next": "IsEligible"
    },
    "IsEligible": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.eligibility.Payload.isEligible",
          "BooleanEquals": true,
          "Next": "PreliminaryBiomarkerScan"
        }
      ],
      "Default": "ParticipantRejected"
    },
    "PreliminaryBiomarkerScan": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${AnalyzeBiomarkersFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.biomarkerScan",
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "EligibilityCheckFailed"
        }
      ],
      "Next": "ResultPropagationDelay"
    },
    "ResultPropagationDelay": {
      "Type": "Wait",
      "Comment": "Brief hold to allow eligibility and biomarker results to propagate to downstream reporting systems.",
      "Seconds": 2,
      "Next": "EligibilityConfirmed"
    },
    "EligibilityConfirmed": {
      "Type": "Succeed"
    },
    "ParticipantRejected": {
      "Type": "Fail",
      "Error": "ParticipantIneligible",
      "Cause": "Participant does not meet trial inclusion criteria"
    },
    "EligibilityCheckFailed": {
      "Type": "Fail",
      "Error": "EligibilityCheckFailed",
      "Cause": "Eligibility or biomarker lambda encountered an unexpected error"
    }
  }
}
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