{
  "contract": "cure.ard.spec.v1",
  "schemaVersion": 1,
  "specId": "9f2b7c1d-4e63-4a80-b5d1-7c3e9a2f6b40",
  "provenance": {
    "kind": "authored"
  },
  "cohort": {
    "ruleVersionId": "cm-rule-v3",
    "ruleContentHash": "3e8a1f6b2c9d40e7a5b18c3f6d2e9a7b4c1f8e5d2a6b9c3f0e7d4a1b8c5f2e96",
    "expression": {
      "ConceptSets": [
        {
          "id": 0,
          "name": "Type 2 diabetes mellitus",
          "expression": {
            "items": [
              {
                "concept": {
                  "CONCEPT_ID": 201826,
                  "CONCEPT_NAME": "Type 2 diabetes mellitus",
                  "STANDARD_CONCEPT": "S",
                  "INVALID_REASON": "V",
                  "CONCEPT_CODE": "44054006",
                  "DOMAIN_ID": "Condition",
                  "VOCABULARY_ID": "SNOMED",
                  "CONCEPT_CLASS_ID": "Clinical Finding"
                },
                "isExcluded": false,
                "includeDescendants": true,
                "includeMapped": false
              }
            ]
          }
        },
        {
          "id": 1,
          "name": "metformin",
          "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
              }
            ]
          }
        },
        {
          "id": 2,
          "name": "sulfonylurea",
          "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
              }
            ]
          }
        },
        {
          "id": 3,
          "name": "Hemoglobin A1c",
          "expression": {
            "items": [
              {
                "concept": {
                  "CONCEPT_ID": 3004410,
                  "CONCEPT_NAME": "Hemoglobin A1c/Hemoglobin.total in Blood",
                  "STANDARD_CONCEPT": "S",
                  "INVALID_REASON": "V",
                  "CONCEPT_CODE": "4548-4",
                  "DOMAIN_ID": "Measurement",
                  "VOCABULARY_ID": "LOINC",
                  "CONCEPT_CLASS_ID": "Lab Test"
                },
                "isExcluded": false,
                "includeDescendants": true,
                "includeMapped": false
              }
            ]
          }
        },
        {
          "id": 4,
          "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
              }
            ]
          }
        }
      ],
      "PrimaryCriteria": {
        "CriteriaList": [
          {
            "ConditionOccurrence": {
              "CodesetId": 0
            }
          },
          {
            "DrugExposure": {
              "CodesetId": 1
            }
          }
        ],
        "ObservationWindow": {
          "PriorDays": 0,
          "PostDays": 0
        },
        "PrimaryCriteriaLimit": {
          "Type": "First"
        }
      },
      "QualifiedLimit": {
        "Type": "All"
      },
      "ExpressionLimit": {
        "Type": "All"
      },
      "InclusionRules": [
        {
          "name": "No prior myocardial infarction",
          "expression": {
            "Type": "ALL",
            "CriteriaList": [
              {
                "Criteria": {
                  "ConditionOccurrence": {
                    "CodesetId": 4
                  }
                },
                "StartWindow": {
                  "Start": {
                    "Days": 180,
                    "Coeff": -1
                  },
                  "End": {
                    "Days": 1,
                    "Coeff": -1
                  },
                  "UseEventEnd": false,
                  "UseIndexEnd": false
                },
                "Occurrence": {
                  "Type": 1,
                  "Count": 0,
                  "IsDistinct": false,
                  "CountColumn": "DOMAIN_CONCEPT"
                },
                "RestrictVisit": false,
                "IgnoreObservationPeriod": false
              }
            ],
            "DemographicCriteriaList": [],
            "Groups": []
          }
        }
      ],
      "CensoringCriteria": [],
      "CollapseSettings": {
        "CollapseType": "ERA",
        "EraPad": 0
      },
      "CensorWindow": {}
    },
    "contentHash": "6c1d0a8f5b3e27c4a9d81f0b2e6c7d34a1b8c5e9f2d6073a4c1b8d5e9f26a7c3"
  },
  "index": {
    "anchor": "cohort_start_date",
    "event": "first"
  },
  "conceptSets": [
    {
      "bindingId": "cs-t2dm",
      "name": "Type 2 diabetes mellitus",
      "ref": {
        "conceptSetId": "cs-t2dm",
        "versionId": "6",
        "contentHash": "d26d1a7a580fdd098a6f19125aa458b9659940b9a7741415ad53c68dcdbb9b56",
        "hashAlgoVersion": 2
      },
      "expression": {
        "id": 0,
        "name": "Type 2 diabetes mellitus",
        "expression": {
          "items": [
            {
              "concept": {
                "CONCEPT_ID": 201826,
                "CONCEPT_NAME": "Type 2 diabetes mellitus",
                "STANDARD_CONCEPT": "S",
                "INVALID_REASON": "V",
                "CONCEPT_CODE": "44054006",
                "DOMAIN_ID": "Condition",
                "VOCABULARY_ID": "SNOMED"
              },
              "isExcluded": false,
              "includeDescendants": true,
              "includeMapped": false
            }
          ]
        }
      }
    },
    {
      "bindingId": "cs-metformin",
      "name": "metformin",
      "expression": {
        "id": 1,
        "name": "metformin",
        "expression": {
          "items": [
            {
              "concept": {
                "CONCEPT_ID": 1503297,
                "CONCEPT_NAME": "metformin",
                "STANDARD_CONCEPT": "S",
                "INVALID_REASON": "V",
                "DOMAIN_ID": "Drug",
                "VOCABULARY_ID": "RxNorm"
              },
              "isExcluded": false,
              "includeDescendants": true,
              "includeMapped": false
            }
          ]
        }
      }
    },
    {
      "bindingId": "cs-sulfonylurea",
      "name": "sulfonylurea",
      "expression": {
        "id": 2,
        "name": "sulfonylurea",
        "expression": {
          "items": [
            {
              "concept": {
                "CONCEPT_ID": 1560171,
                "CONCEPT_NAME": "glipizide",
                "STANDARD_CONCEPT": "S",
                "INVALID_REASON": "V",
                "DOMAIN_ID": "Drug",
                "VOCABULARY_ID": "RxNorm"
              },
              "isExcluded": false,
              "includeDescendants": true,
              "includeMapped": false
            }
          ]
        }
      }
    },
    {
      "bindingId": "cs-hba1c",
      "name": "Hemoglobin A1c",
      "expression": {
        "id": 3,
        "name": "Hemoglobin A1c",
        "expression": {
          "items": [
            {
              "concept": {
                "CONCEPT_ID": 3004410,
                "CONCEPT_NAME": "Hemoglobin A1c/Hemoglobin.total in Blood",
                "STANDARD_CONCEPT": "S",
                "INVALID_REASON": "V",
                "CONCEPT_CODE": "4548-4",
                "DOMAIN_ID": "Measurement",
                "VOCABULARY_ID": "LOINC"
              },
              "isExcluded": false,
              "includeDescendants": true,
              "includeMapped": false
            }
          ]
        }
      }
    },
    {
      "bindingId": "cs-mi",
      "name": "Myocardial infarction",
      "expression": {
        "id": 4,
        "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"
              },
              "isExcluded": false,
              "includeDescendants": true,
              "includeMapped": false
            }
          ]
        }
      }
    }
  ],
  "windows": [
    {
      "windowId": "baseline-365",
      "startDay": -365,
      "endDay": -1,
      "startInclusive": true,
      "endInclusive": true,
      "dateField": "start",
      "restrictToIndexObservationPeriod": true
    },
    {
      "windowId": "initiation-7",
      "startDay": -7,
      "endDay": 7,
      "startInclusive": true,
      "endInclusive": true,
      "dateField": "start",
      "restrictToIndexObservationPeriod": true
    },
    {
      "windowId": "washout-180",
      "startDay": -180,
      "endDay": -1,
      "startInclusive": true,
      "endInclusive": true,
      "dateField": "start",
      "restrictToIndexObservationPeriod": true
    },
    {
      "windowId": "followup",
      "startDay": 0,
      "endDay": null,
      "startInclusive": true,
      "endInclusive": true,
      "dateField": "start",
      "restrictToIndexObservationPeriod": true
    }
  ],
  "baselineCovariates": [
    {
      "kind": "demographic",
      "name": "AGE",
      "label": "Age at index",
      "field": "age_at_index",
      "missingBirthDate": "birth_year_mid_year"
    },
    {
      "kind": "demographic",
      "name": "SEX",
      "label": "Sex",
      "field": "sex"
    },
    {
      "kind": "event_aggregate",
      "name": "HBA1C_L",
      "label": "Most recent HbA1c before index",
      "domain": "measurement",
      "conceptSetBindingId": "cs-hba1c",
      "windowId": "baseline-365",
      "aggregation": "last",
      "valueField": "value_as_number",
      "missing": "missing",
      "unit": "%",
      "orderBy": "event_date_then_source_record_id"
    },
    {
      "kind": "event_aggregate",
      "name": "PRI_MET",
      "label": "Any metformin exposure in the prior year",
      "domain": "drug_exposure",
      "conceptSetBindingId": "cs-metformin",
      "windowId": "baseline-365",
      "aggregation": "exists",
      "missing": "false",
      "unit": null
    },
    {
      "kind": "event_aggregate",
      "name": "N_HBA1C",
      "label": "Number of HbA1c measurements in the prior year",
      "domain": "measurement",
      "conceptSetBindingId": "cs-hba1c",
      "windowId": "baseline-365",
      "aggregation": "count",
      "missing": "zero",
      "unit": null
    }
  ],
  "followUp": {
    "startDay": 0,
    "maxDays": 730,
    "end": [
      {
        "kind": "observation_end"
      },
      {
        "kind": "death"
      },
      {
        "kind": "data_cutoff",
        "date": "2025-06-30"
      }
    ],
    "dayCountConvention": "exclusive"
  },
  "outcomes": [
    {
      "paramcd": "MI_TTE",
      "param": "Time to first myocardial infarction",
      "criterion": {
        "domain": "condition_occurrence",
        "conceptSetBindingId": "cs-mi",
        "windowId": "followup",
        "occurrence": {
          "op": "atLeast",
          "count": 1
        }
      },
      "washoutWindowId": "washout-180",
      "kind": "time_to_event"
    }
  ],
  "output": {
    "datasets": [
      "ADSL",
      "ADTTE",
      "ADCOV",
      "ADCOVREF"
    ],
    "formats": [
      "dataset-json",
      "parquet"
    ],
    "subjectId": {
      "kind": "pseudonym",
      "saltRef": "salt-2026-q3"
    }
  }
}
