{
  "schemaVersion": 2,
  "summary": "Observational comparative-effectiveness study using the target trial emulation framework: new users of a first-line oral antihyperglycaemic in class A versus class B, followed for the first hospitalisation for myocardial infarction. Replace every identifier and every clinical clause with the study's own design before approval.",
  "studyType": {
    "classification": "observational"
  },
  "arms": [
    {
      "armId": "arm-class-a",
      "name": "Class A initiators (target)",
      "description": "New users of a drug in class A."
    },
    {
      "armId": "arm-class-b",
      "name": "Class B initiators (comparator)",
      "description": "New users of a drug in class B."
    }
  ],
  "eligibility": [
    {
      "criterionId": "elig-incident-use",
      "type": "inclusion",
      "text": "No dispensing of either study class in the 365 days before index."
    },
    {
      "criterionId": "elig-index-age",
      "type": "inclusion",
      "text": "Age 18 years or older at index."
    },
    {
      "criterionId": "elig-coverage",
      "type": "inclusion",
      "text": "Continuous enrolment with drug coverage for 365 days before index."
    },
    {
      "criterionId": "excl-prior-outcome",
      "type": "exclusion",
      "text": "Any hospitalisation for the study outcome in the 365 days before index."
    }
  ],
  "objectives": [
    {
      "objectiveId": "obj-primary",
      "kind": "primary",
      "text": "Estimate the effect of initiating class A versus class B on the time to first hospitalisation for myocardial infarction."
    }
  ],
  "endpoints": [
    {
      "endpointId": "endpoint-primary",
      "objectiveId": "obj-primary",
      "kind": "primary",
      "text": "Time from index to first hospitalisation whose primary diagnosis is myocardial infarction, censored at disenrolment, death, or 730 days."
    },
    {
      "endpointId": "endpoint-safety",
      "objectiveId": "obj-primary",
      "kind": "safety",
      "text": "All-cause hospitalisation during follow-up."
    }
  ],
  "epochs": [
    {
      "epochId": "epoch-follow-up",
      "name": "Follow-up",
      "phase": "follow-up",
      "sequence": 1
    }
  ],
  "studyCells": [
    {
      "studyCellId": "cell-class-a-follow-up",
      "armId": "arm-class-a",
      "epochId": "epoch-follow-up"
    },
    {
      "studyCellId": "cell-class-b-follow-up",
      "armId": "arm-class-b",
      "epochId": "epoch-follow-up"
    }
  ],
  "encounters": [],
  "activities": [],
  "scheduledActivities": [],
  "interventions": [
    {
      "interventionId": "intervention-class-a",
      "name": "A first-line oral antihyperglycaemic in class A",
      "role": "experimental",
      "description": "Any drug in class A, by any route, dispensed at index."
    },
    {
      "interventionId": "intervention-class-b",
      "name": "A first-line oral antihyperglycaemic in class B",
      "role": "active-comparator",
      "description": "Any drug in class B, by any route, dispensed at index."
    }
  ],
  "estimands": [
    {
      "estimandId": "estimand-primary",
      "name": "Hazard ratio for the primary endpoint",
      "populationSummary": "New users of class A or class B who meet every eligibility criterion at index.",
      "variableSummary": "Time from index to first hospitalisation for myocardial infarction.",
      "interventionIds": ["intervention-class-a", "intervention-class-b"],
      "intercurrentEventStrategies": [
        {
          "intercurrentEventId": "ice-discontinuation",
          "strategy": "while-on-treatment"
        }
      ]
    }
  ],
  "intercurrentEvents": [
    {
      "intercurrentEventId": "ice-discontinuation",
      "name": "Discontinuation or switch of the index treatment",
      "description": "Stopping or switching the index drug before the outcome."
    }
  ],
  "targetTrialDesign": {
    "schemaVersion": 1,
    "designId": "5f0c2c4e-8b1a-4f9d-9d5e-2f6a7c8b9d10",
    "eligibility": [
      {
        "criterionId": "incident-use",
        "type": "inclusion",
        "expression": "no dispensing of either study class in the 365 days before index"
      },
      {
        "criterionId": "adult",
        "type": "inclusion",
        "expression": "age 18 years or older at index"
      },
      {
        "criterionId": "prior-outcome",
        "type": "exclusion",
        "expression": "no hospitalisation for the outcome in the 365 days before index"
      }
    ],
    "treatmentStrategies": [
      {
        "strategyId": "target",
        "arm": "target",
        "label": "Initiate class A",
        "definition": "Initiate a drug in class A at index.",
        "structured": {
          "exposure": {
            "domain": "drug_exposure",
            "conceptSetBindingId": "cs-class-a",
            "windowId": "index-day",
            "occurrence": { "op": "atLeast", "count": 1 }
          }
        }
      },
      {
        "strategyId": "comparator",
        "arm": "comparator",
        "label": "Initiate class B",
        "definition": "Initiate a drug in class B at index.",
        "structured": {
          "exposure": {
            "domain": "drug_exposure",
            "conceptSetBindingId": "cs-class-b",
            "windowId": "index-day",
            "occurrence": { "op": "atLeast", "count": 1 }
          }
        }
      }
    ],
    "assignmentProcedure": "observed treatment assignment at index (new-user active-comparator design)",
    "timeZero": {
      "anchor": "first_dispensation",
      "definition": "Date of the first dispensing of the index drug.",
      "structured": { "anchor": "cohort_start_date" }
    },
    "gracePeriod": {
      "days": 30,
      "rule": "the index drug must be dispensed within 30 days of the eligibility anchor"
    },
    "followUp": {
      "startRule": "index",
      "endRule": "first of outcome, disenrolment, death, or 730 days after index",
      "maxDays": 730,
      "structured": {
        "startDay": 0,
        "dayCountConvention": "exclusive",
        "maxDays": 730,
        "end": [
          { "kind": "observation_end" },
          {
            "kind": "event",
            "reasonCode": "outcome",
            "criterion": {
              "domain": "condition_occurrence",
              "conceptSetBindingId": "cs-outcome",
              "windowId": "follow-up",
              "occurrence": { "op": "atLeast", "count": 1 }
            }
          }
        ]
      }
    },
    "outcomes": [
      {
        "outcomeId": "primary",
        "kind": "primary",
        "definition": "First hospitalisation for myocardial infarction after index.",
        "structured": {
          "criterion": {
            "domain": "condition_occurrence",
            "conceptSetBindingId": "cs-outcome",
            "windowId": "follow-up",
            "occurrence": { "op": "atLeast", "count": 1 }
          },
          "washoutWindowId": "lookback-365",
          "kind": "time_to_event"
        }
      }
    ],
    "causalContrast": "per_protocol",
    "estimand": {
      "summaryMeasure": "hazard_ratio",
      "populationSummary": "new users of class A or class B meeting every eligibility criterion"
    },
    "intercurrentEventPolicy": [
      {
        "eventType": "treatment_discontinuation",
        "strategy": "while_on_treatment"
      }
    ],
    "estimatorStrategy": {
      "family": "inverse_probability_weighting",
      "strategy": "stabilised inverse probability of treatment weighting",
      "adjustmentCovariates": ["age", "sex", "prior_hospitalisation"]
    },
    "requiredDiagnostics": ["positivity", "covariate_balance"],
    "calibration": {
      "required": false,
      "negativeControlOutcomes": []
    },
    "compatibilityConstraints": {
      "estimatorFamiliesAllowed": ["inverse_probability_weighting"],
      "requiredCohortCapabilities": ["time_varying"]
    },
    "covariates": [
      {
        "kind": "demographic",
        "name": "AGE",
        "label": "Age at index",
        "field": "age_at_index",
        "missingBirthDate": "set_missing"
      },
      {
        "kind": "demographic",
        "name": "SEX",
        "label": "Sex",
        "field": "sex"
      },
      {
        "kind": "event_aggregate",
        "name": "PRIORHSP",
        "label": "Any hospitalisation in the prior year",
        "domain": "visit_occurrence",
        "conceptSetBindingId": "cs-prior-hospitalisation",
        "windowId": "lookback-365",
        "aggregation": "exists",
        "missing": "false",
        "unit": null
      }
    ],
    "conceptSets": [
      {
        "bindingId": "cs-class-a",
        "name": "Class A antihyperglycaemics",
        "ref": {
          "conceptSetId": "cs-class-a",
          "versionId": "1",
          "contentHash": "0000000000000000000000000000000000000000000000000000000000000001",
          "hashAlgoVersion": 2
        },
        "expression": {
          "id": 0,
          "name": "Class A antihyperglycaemics",
          "expression": {
            "items": [
              {
                "concept": {
                  "CONCEPT_ID": 1503297,
                  "CONCEPT_NAME": "metformin",
                  "STANDARD_CONCEPT": "S",
                  "INVALID_REASON": "V",
                  "DOMAIN_ID": "Drug",
                  "VOCABULARY_ID": "RxNorm",
                  "CONCEPT_CLASS_ID": "Ingredient"
                },
                "isExcluded": false,
                "includeDescendants": true,
                "includeMapped": false
              }
            ]
          }
        }
      },
      {
        "bindingId": "cs-class-b",
        "name": "Class B antihyperglycaemics",
        "ref": {
          "conceptSetId": "cs-class-b",
          "versionId": "1",
          "contentHash": "0000000000000000000000000000000000000000000000000000000000000002",
          "hashAlgoVersion": 2
        },
        "expression": {
          "id": 1,
          "name": "Class B antihyperglycaemics",
          "expression": {
            "items": [
              {
                "concept": {
                  "CONCEPT_ID": 1560171,
                  "CONCEPT_NAME": "glipizide",
                  "STANDARD_CONCEPT": "S",
                  "INVALID_REASON": "V",
                  "DOMAIN_ID": "Drug",
                  "VOCABULARY_ID": "RxNorm",
                  "CONCEPT_CLASS_ID": "Ingredient"
                },
                "isExcluded": false,
                "includeDescendants": true,
                "includeMapped": false
              }
            ]
          }
        }
      },
      {
        "bindingId": "cs-outcome",
        "name": "Myocardial infarction",
        "ref": {
          "conceptSetId": "cs-outcome",
          "versionId": "1",
          "contentHash": "0000000000000000000000000000000000000000000000000000000000000003",
          "hashAlgoVersion": 2
        },
        "expression": {
          "id": 2,
          "name": "Myocardial infarction",
          "expression": {
            "items": [
              {
                "concept": {
                  "CONCEPT_ID": 4329847,
                  "CONCEPT_NAME": "Myocardial infarction",
                  "STANDARD_CONCEPT": "S",
                  "INVALID_REASON": "V",
                  "CONCEPT_CODE": "22298006",
                  "DOMAIN_ID": "Condition",
                  "VOCABULARY_ID": "SNOMED",
                  "CONCEPT_CLASS_ID": "Clinical Finding"
                },
                "isExcluded": false,
                "includeDescendants": true,
                "includeMapped": false
              }
            ]
          }
        }
      },
      {
        "bindingId": "cs-prior-hospitalisation",
        "name": "Any inpatient visit",
        "ref": {
          "conceptSetId": "cs-prior-hospitalisation",
          "versionId": "1",
          "contentHash": "0000000000000000000000000000000000000000000000000000000000000004",
          "hashAlgoVersion": 2
        },
        "expression": {
          "id": 3,
          "name": "Any inpatient visit",
          "expression": {
            "items": [
              {
                "concept": {
                  "CONCEPT_ID": 9201,
                  "CONCEPT_NAME": "Inpatient Visit",
                  "STANDARD_CONCEPT": "S",
                  "INVALID_REASON": "V",
                  "DOMAIN_ID": "Visit",
                  "VOCABULARY_ID": "Visit"
                },
                "isExcluded": false,
                "includeDescendants": true,
                "includeMapped": false
              }
            ]
          }
        }
      }
    ],
    "windows": [
      {
        "windowId": "index-day",
        "startDay": 0,
        "endDay": 0,
        "startInclusive": true,
        "endInclusive": true,
        "dateField": "start",
        "restrictToIndexObservationPeriod": true
      },
      {
        "windowId": "lookback-365",
        "startDay": -365,
        "endDay": -1,
        "startInclusive": true,
        "endInclusive": true,
        "dateField": "start",
        "restrictToIndexObservationPeriod": true
      },
      {
        "windowId": "follow-up",
        "startDay": 1,
        "endDay": null,
        "startInclusive": true,
        "endInclusive": true,
        "dateField": "start",
        "restrictToIndexObservationPeriod": true
      }
    ]
  }
}
