Skip to content

Commit f0b9aab

Browse files
author
Alexandra Pavlyshina
committed
measure-evaluate: add legacy indexes for BP panel (partial 85354-9) and encounter.class
1 parent b1eaced commit f0b9aab

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

aidbox-custom-operations/measure-evaluate/sql/03-performance.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ CREATE INDEX IF NOT EXISTS ix_medrq_med_code ON medicationrequest ((resource->'m
5555
CREATE INDEX IF NOT EXISTS ix_devicerq_subject ON devicerequest ((resource->'subject'->>'id'));
5656
CREATE INDEX IF NOT EXISTS ix_devicerq_code ON devicerequest ((resource->'code'->'CodeableConcept'->'coding'->0->>'system'), (resource->'code'->'CodeableConcept'->'coding'->0->>'code'));
5757

58+
-- Observation: partial index for BP panel (observation_bp_flat legacy view)
59+
-- Dramatically reduces rows scanned for CMS165 on legacy path
60+
CREATE INDEX IF NOT EXISTS ix_observation_bp ON observation ((resource->'code'->'coding'->0->>'code')) WHERE resource->'code'->'coding'->0->>'code' = '85354-9';
61+
62+
-- Encounter: class code (CMS165 disqualifying encounters)
63+
CREATE INDEX IF NOT EXISTS ix_encounter_class ON encounter ((resource->'class'->>'code'));
64+
5865
-- ============================================================
5966
-- 2. Update planner statistics
6067
-- On a fresh sample these complete in seconds. On a production-scale install

0 commit comments

Comments
 (0)