Skip to main content
Loading navigation

Build a Synthetic Cohort Clinical Trial Protocol Amendment Simulator — implementation

Prompt source

implementation96 lines11 sectionsNo variables1 code block
## Build
Simulate the impact of proposed clinical trial protocol amendments on participant eligibility using synthetic cohort records. Quantify candidate pool expansion and flag potential protocol safety margin deviations.

## User
Clinical Protocol Design Analyst

## Workflow
1. Ingest existing trial eligibility criteria and proposed amendment delta values.
2. Execute comparative eligibility queries across a benchmark synthetic patient repository.
3. Quantify marginal recruitment gain and calculate shifts in baseline cohort risk distributions.
4. Compile an amendment impact dossier with visual trade-off matrices for protocol review committees.

## Interface
Interactive parameter slider interface comparing baseline vs amended criteria yields and demographic distributions.

## Data
Construct synthetic patient datasets with lab ranges, vitals, and condition histories or load open mock datasets.
Starter examples below are synthetic. They are not downloaded records.

## Source
[HL7 FHIR overview](https://hl7.org/fhir/overview.html)
Apply FHIR Clinical Reasoning and ResearchStudy definitions to encode baseline and amended eligibility parameters.

## Tools
crewai, pandas, pydantic.
crewai coordinates multi-agent evaluation of protocol safety limits, recruitment delta calculations, and summary writing.
Hosted LLM with reasoning capability for comparative clinical criteria analysis.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Parses baseline and amended criteria configurations without numeric ambiguities.
- Calculates net change in eligible synthetic subjects across stratified biomarker ranges.
- Produces a structured impact scorecard detailing recruited delta and risk shift warnings.
- Allows protocol analysts to download reproducible simulation manifests.

## Starter Examples
```json
[
  {
    "input": {
      "amendment_id": "AMD-42",
      "criteria_changes": {
        "platelet_count_min": {
          "baseline": 100000,
          "amended": 75000
        }
      },
      "synthetic_records": [
        {
          "id": "S1",
          "platelet_count": 80000
        },
        {
          "id": "S2",
          "platelet_count": 120000
        },
        {
          "id": "S3",
          "platelet_count": 60000
        }
      ]
    },
    "expected_output": {
      "amendment_id": "AMD-42",
      "baseline_eligible": 1,
      "amended_eligible": 2,
      "net_gain": 1,
      "newly_eligible_ids": [
        "S1"
      ],
      "safety_margin_flag": "mild_relaxation"
    }
  },
  {
    "input": {
      "amendment_id": "AMD-43",
      "criteria_changes": {
        "platelet_count_min": {
          "baseline": 100000,
          "amended": 100000
        }
      },
      "synthetic_records": [
        {
          "id": "S4",
          "platelet_count": 90000
        }
      ]
    },
    "expected_output": {
      "amendment_id": "AMD-43",
      "baseline_eligible": 0,
      "amended_eligible": 0,
      "net_gain": 0,
      "newly_eligible_ids": [],
      "safety_margin_flag": "no_change"
    }
  }
]
```

## Safety
Research protocol modeling application; evaluated exclusively on synthetic data; no medical advice or care delivery.
Use mock external writes. Require human review before any real deployment.