member_quality_summary

member_quality_summarygenerated

Overview

One row per patient summarizing care-quality signals. Computed by joining encounters, observations, conditions, and providers.

Primary key
patient_id
Total columns
6

Columns

ColumnTypeDescriptionLineage
diabetes_flagBOOLEANTrue if the patient has ever been diagnosed with type 2 diabetes.
↑ 1 upstream
encounter_countINTEGERTotal number of encounters for the patient.
↑ 1 upstream
latest_a1cDECIMALMost recent Hemoglobin A1c result for the patient.
↑ 1 upstream
latest_bmiDECIMALMost recent recorded Body Mass Index for the patient.—
patient_idVARCHARPatient this summary is for.
↑ 1 upstream
pcp_nameVARCHARName of the patient's primary care provider.

Engineering detail

Per-column derivations, validations, downstream links. Click any column above to jump.

diabetes_flag

BOOLEAN

True if the patient has ever been diagnosed with type 2 diabetes.

Derivation rule
Priority 1 Source: conditions.CODE
MAX(CASE
        WHEN CODE = '44054006' THEN TRUE
        ELSE FALSE
    END)
Why:

SNOMED 44054006 = Diabetes mellitus type 2.

encounter_count

INTEGER

Total number of encounters for the patient.

Derivation rule
Priority 1 Source: encounters.Id
COUNT(DISTINCT Id)
Why:

Distinct encounters per patient.

latest_a1c

DECIMAL

Most recent Hemoglobin A1c result for the patient.

Derivation rule
Priority 1 Source: observations.VALUE
Why:

Latest A1c observation by observation date.

Survivorship logic

Strategy: take the most recent qualifying A1c observation.

Default: null when the patient has no A1c on file.

latest_bmi

DECIMAL

Most recent recorded Body Mass Index for the patient.

Derivation rule
Priority 1 Source: observations
MAX_BY(CAST(VALUE AS DECIMAL(5, 2)), DATE) FILTER (
                                                   WHERE DESCRIPTION = 'Body Mass Index')
Why:

Latest BMI observation by observation date.

patient_id

VARCHARlen ≤ 36

Patient this summary is for.

Derivation rule
Priority 1 Source: patients.Id
Why:

One summary row per patient, keyed by the patient id.

pcp_name

VARCHARlen ≤ 200

Name of the patient's primary care provider.

Derivation rules
Priority 1 Source: providers.NAME
Filter: SPECIALITY = 'GENERAL PRACTICE'
Why:

Prefer the provider whose specialty is general practice.

Priority 2 Source: providers.NAME
Filter: encounter_rank = 1
Why:

Fall back to the most recent encounter's provider.

Survivorship logic

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.