{
  "transport_meta": {
    "schema": "rwednesdays.synthetic_oncology_ehr.v0.1",
    "style": "OpenEMR/FHIR-R4-like longitudinal patient bundle",
    "synthetic": true,
    "date_shifted": true,
    "contains_phi": false,
    "generated_at": "2026-06-18T12:00:00-04:00",
    "license_note": "Synthetic example for methods education only; not medical advice and not patient data."
  },
  "patient": {
    "synthetic_patient_id": "SYN-ONC-0007",
    "pseudonymized_ids": {
      "ehr_patient_token": "ehrtok_9b7a2d",
      "claims_patient_token": "clmtok_51fd90",
      "linkage_confidence": 0.94
    },
    "demographics": {
      "age_at_index": 66,
      "sex": "female",
      "race": "Black or African American",
      "ethnicity": "Not Hispanic or Latino",
      "region": "US-South"
    },
    "_rwe": "Cohort eligibility, baseline covariates, subgroup checks, and linkage denominator."
  },
  "diagnoses": [
    {
      "id": "cond-1",
      "resource_type": "Condition",
      "code": {
        "system": "ICD-10-CM",
        "code": "C34.11",
        "display": "Malignant neoplasm of upper lobe, right bronchus or lung"
      },
      "clinical_status": "active",
      "verification_status": "confirmed",
      "onset_date": "2024-01-18",
      "stage_at_diagnosis": "Stage IVB",
      "biomarkers": [
        {
          "name": "EGFR exon 19 deletion",
          "result": "positive",
          "date": "2024-02-02"
        }
      ],
      "_rwe": "Incident cancer diagnosis, disease site, stage, and molecular eligibility subgroup."
    }
  ],
  "encounters": [
    {
      "id": "enc-1",
      "resource_type": "Encounter",
      "class": "ambulatory",
      "date": "2024-01-18",
      "provider_type": "oncology",
      "reason": "new lung mass workup",
      "_rwe": "Care setting and index workup."
    },
    {
      "id": "enc-2",
      "resource_type": "Encounter",
      "class": "ambulatory",
      "date": "2024-02-09",
      "provider_type": "medical oncology",
      "reason": "systemic therapy start",
      "_rwe": "Index date anchor."
    },
    {
      "id": "enc-3",
      "resource_type": "Encounter",
      "class": "emergency",
      "date": "2024-07-21",
      "reason": "dyspnea and pleural effusion",
      "_rwe": "Acute utilization and possible progression signal."
    }
  ],
  "medications": [
    {
      "id": "medrx-1",
      "resource_type": "MedicationRequest",
      "drug": "osimertinib",
      "rxnorm": "1723758",
      "intent": "order",
      "status": "stopped",
      "start_date": "2024-02-09",
      "stop_date": "2024-08-05",
      "dose": "80 mg oral daily",
      "status_reason": "radiographic progression / non-response",
      "line_of_therapy": 1,
      "_rwe": "Exposure, line-of-therapy start/stop, and treatment discontinuation signal."
    },
    {
      "id": "medrx-2",
      "resource_type": "MedicationRequest",
      "drug": "carboplatin + pemetrexed + pembrolizumab",
      "status": "active",
      "start_date": "2024-08-12",
      "line_of_therapy": 2,
      "_rwe": "Post-failure regimen switch and next-line therapy."
    }
  ],
  "observations": [
    {
      "id": "lab-1",
      "resource_type": "Observation",
      "category": "laboratory",
      "loinc": "2160-0",
      "name": "Creatinine",
      "date": "2024-02-05",
      "value": 0.9,
      "unit": "mg/dL",
      "_rwe": "Baseline renal covariate."
    },
    {
      "id": "lab-2",
      "resource_type": "Observation",
      "category": "laboratory",
      "loinc": "2039-6",
      "name": "CEA",
      "date": "2024-07-15",
      "value": 21.4,
      "unit": "ng/mL",
      "trend": "rising from 8.2",
      "_rwe": "Tumor-marker progression support."
    },
    {
      "id": "ecog-1",
      "resource_type": "Observation",
      "category": "survey",
      "loinc": "89247-1",
      "name": "ECOG Performance Status",
      "date": "2024-02-09",
      "valueInteger": 1,
      "_rwe": "Baseline functional-status covariate."
    },
    {
      "id": "ecog-2",
      "resource_type": "Observation",
      "category": "survey",
      "loinc": "89247-1",
      "name": "ECOG Performance Status",
      "date": "2024-08-05",
      "valueInteger": 2,
      "_rwe": "Clinical deterioration and endpoint-support signal."
    },
    {
      "id": "img-1",
      "resource_type": "Observation",
      "category": "imaging-summary",
      "date": "2024-08-01",
      "valueCode": "progressive disease",
      "source": "oncology note abstraction",
      "_rwe": "Clinical response component; not RECIST-confirmed unless source report is available."
    }
  ],
  "treatment_failure_non_response": {
    "constructed_endpoint": true,
    "candidate_failure_date": "2024-08-05",
    "classification": "probable treatment failure / non-response",
    "certainty": "moderate",
    "signals": [
      {
        "source_id": "medrx-1",
        "signal": "MedicationRequest stopped for progression"
      },
      {
        "source_id": "medrx-2",
        "signal": "New line of therapy started within 7 days"
      },
      {
        "source_id": "img-1",
        "signal": "Imaging summary says progressive disease"
      },
      {
        "source_id": "ecog-2",
        "signal": "ECOG worsened from 1 to 2"
      },
      {
        "source_id": "enc-3",
        "signal": "Emergency encounter for dyspnea and pleural effusion"
      }
    ],
    "_rwe": "Composite endpoint combining clinical response evidence, treatment-pattern proxy, and intercurrent-event handling."
  },
  "claims_linkage": {
    "payer_type": "commercial",
    "subscriber_id_hash": "sub_44fd19",
    "member_id_hash": "mem_772ac1",
    "enrollment": [
      {
        "start": "2023-12-01",
        "end": "2024-12-31",
        "medical": true,
        "pharmacy": true
      }
    ],
    "claim_refs": [
      {
        "claim_id_hash": "claim_77aa",
        "date": "2024-02-09",
        "setting": "outpatient",
        "hcpcs": "99215",
        "linked_encounter": "enc-2"
      },
      {
        "claim_id_hash": "claim_91fd",
        "date": "2024-07-21",
        "setting": "emergency",
        "revenue_center": "0450",
        "linked_encounter": "enc-3"
      }
    ],
    "_rwe": "Coverage continuity, utilization capture, EHR-claims concordance, and subscriber/member identifier separation."
  },
  "provenance": {
    "source_systems": [
      "synthetic OpenEMR-like EHR",
      "synthetic adjudicated claims"
    ],
    "mapping_version": "oncology-ehr-rwe-map-0.1",
    "source_trace": {
      "line_of_therapy": "MedicationRequest sequence and stop/start dates",
      "treatment_failure_non_response": "Medication status reason, imaging summary, ECOG change, next-line therapy, and ED utilization",
      "claims": "Payer extract line-level claims linked to encounter IDs",
      "ecog": "Structured observation using LOINC 89247-1"
    }
  },
  "data_quality_flags": [
    {
      "flag": "synthetic_record",
      "severity": "info",
      "affects": "all fields"
    },
    {
      "flag": "date_shifted",
      "severity": "info",
      "affects": "calendar-time interpretation"
    },
    {
      "flag": "imaging_not_recist_confirmed",
      "severity": "medium",
      "affects": "treatment_failure_non_response"
    },
    {
      "flag": "claims_ehr_linkage_probabilistic",
      "severity": "medium",
      "confidence": 0.94,
      "affects": "claims_linkage"
    },
    {
      "flag": "oral_adherence_unobserved",
      "severity": "medium",
      "affects": "osimertinib exposure duration"
    }
  ],
  "source_references": [
    {
      "label": "OpenEMR FHIR API documentation",
      "url": "https://github.com/openemr/openemr/blob/master/Documentation/api/FHIR_API.md"
    },
    {
      "label": "HL7 FHIR R4 Encounter",
      "url": "https://hl7.org/fhir/R4/encounter.html"
    },
    {
      "label": "HL7 FHIR R4 Condition",
      "url": "https://hl7.org/fhir/R4/condition.html"
    },
    {
      "label": "HL7 FHIR R4 MedicationRequest",
      "url": "https://hl7.org/fhir/R4/medicationrequest.html"
    },
    {
      "label": "HL7 FHIR R4 Observation",
      "url": "https://hl7.org/fhir/R4/observation.html"
    },
    {
      "label": "mCODE ECOG Performance Status",
      "url": "https://build.fhir.org/ig/HL7/fhir-mCODE-ig/StructureDefinition-mcode-ecog-performance-status.html"
    },
    {
      "label": "FDA Real-World Data guidance",
      "url": "https://www.fda.gov/media/152503/download"
    }
  ]
}
