One row per patient summarizing care-quality signals. Computed by joining encounters, observations, conditions, and providers.
patient_id| Column | Type | Description | Lineage |
|---|---|---|---|
diabetes_flag | BOOLEAN | True if the patient has ever been diagnosed with type 2 diabetes. | ↑ 1 upstream |
encounter_count | INTEGER | Total number of encounters for the patient. | ↑ 1 upstream |
latest_a1c | DECIMAL | Most recent Hemoglobin A1c result for the patient. | ↑ 1 upstream |
latest_bmi | DECIMAL | Most recent recorded Body Mass Index for the patient. | — |
patient_id | VARCHAR | Patient this summary is for. | ↑ 1 upstream |
pcp_name | VARCHAR | Name of the patient's primary care provider. | ↑ 2 upstream |
Per-column derivations, validations, downstream links. Click any column above to jump.
diabetes_flagTrue if the patient has ever been diagnosed with type 2 diabetes.
MAX(CASE
WHEN CODE = '44054006' THEN TRUE
ELSE FALSE
END)
SNOMED 44054006 = Diabetes mellitus type 2.
encounter_countTotal number of encounters for the patient.
latest_a1cMost recent Hemoglobin A1c result for the patient.
Latest A1c observation by observation date.
Strategy: take the most recent qualifying A1c observation.
Default: null when the patient has no A1c on file.
latest_bmiMost recent recorded Body Mass Index for the patient.
MAX_BY(CAST(VALUE AS DECIMAL(5, 2)), DATE) FILTER (
WHERE DESCRIPTION = 'Body Mass Index')
Latest BMI observation by observation date.
patient_idPatient this summary is for.
One summary row per patient, keyed by the patient id.
pcp_nameName of the patient's primary care provider.
Prefer the provider whose specialty is general practice.
Fall back to the most recent encounter's provider.
Strategy: choose the patient's general-practice provider when one exists.
Fallback: if no GP is assigned, use the provider from the patient's most recent encounter.
Cardinality: 1:1 per patient. Null when the patient has no provider on file.