Diagnosis and procedure coding (ICD-10-CM, SNOMED CT, CPT, HCPCS), CDS Hooks decision support, order sets, code set versioning, and HCC risk-adjustment re-capture.
Data Classification: Mixed scoping. Diagnosis and Procedure are global (patient-centric, SourceOrganizationID).
OrderSet and CdsRule are org-scoped (OrganizationID partition key).
CodeSet, CodeSetVersion, and CodeMapping are global reference data (no OrganizationID).
CdsHookEvent is org-scoped.
Trust tiers range T0 (reference) through T3 (clinical).
See Data Model for ownership conventions and Decisions for dual-coding rationale.
Diagnosis P0 — Trust Tier T3
A coded diagnosis on a patient, optionally linked to an encounter. Dual-coded (ICD-10-CM + SNOMED CT).
Supports HCC category tagging for risk-adjustment re-capture workflows.
graph TD
A[EHR Trigger Event] --> B{Hook Type}
B -->|patient-view| C[Load patient context]
B -->|order-sign| D[Load order context]
B -->|order-select| D
B -->|encounter-discharge| E[Load encounter context]
B -->|medication-prescribe| F[Load Rx context]
B -->|problem-list-item-create| G[Load problem context]
C --> H[CDS Rule Engine]
D --> H
E --> H
F --> H
G --> H
H --> I[Evaluate CQL / JSON-Logic expressions]
I --> J{Rules matched?}
J -->|No| K[No cards returned]
J -->|Yes| L[Generate CDS Hooks response cards]
L --> M[Return cards to EHR]
M --> N{Clinician action}
N -->|accepted| O[Apply suggestion]
N -->|overridden| P[Log override + reason]
N -->|dismissed| Q[Log dismissal]
N -->|timed-out| R[Log timeout]
O --> S[CdsHookEvent record]
P --> S
Q --> S
R --> S
Functional Requirements
P0 The system shall store Diagnoses with dual coding (ICD-10-CM + SNOMED CT) linked to active CodeSetVersions.
P0 The system shall store Procedures with CPT, HCPCS, up to 4 modifiers, E&M level, and MDM rationale.
P0 The system shall flag AI-augmented procedures with IsAiAugmented per CY2026 AMA guidelines.
P0 The system shall evaluate CDS rules at each CDS Hooks trigger point (patient-view, order-sign, order-select, encounter-discharge, medication-prescribe, problem-list-item-create).
P0 The system shall return CDS Hooks response cards with severity (info, warning, critical) and actionable suggestions.
P0 The system shall log every CDS rule firing as a CdsHookEvent with clinician action (accepted, overridden, dismissed, timed-out).
P0 The system shall require an override reason when a clinician overrides a critical-severity CDS card.
P0 The system shall flag chronic diagnoses (IsChronic) with HCC categories for annual risk-adjustment re-capture.
P0 The system shall flag AI-powered CDS rules with IsAiDsi and link to a ModelCardUri per HTI-1 DSI requirements.
P1 The system shall manage CodeSet, CodeSetVersion, and CodeMapping records for annual code set updates (ICD-10-CM FY rollover, CPT annual release).
P1 The system shall provide cross-walk mappings (equivalent, broader, narrower, inexact, retired-no-replacement) between code set versions.
P1 The system shall support OrderSets triggered by diagnosis codes containing FHIR R4 order stubs.
P2 The system shall provide a CDS analytics dashboard showing override rates, alert fatigue metrics, and rule effectiveness by kind.
Non-Functional Requirements
Latency: CDS rule evaluation must complete within 500 ms to avoid workflow disruption (CDS Hooks spec target).
Throughput: Support 100 concurrent CDS evaluations per organization during peak charting hours.
Code Set Size: CodeMapping table must handle 500K+ cross-walk records without query degradation (< 100 ms lookup).
Audit Trail: Every diagnosis/procedure mutation and CDS event is immutably logged with actor and timestamp.
HIPAA: All clinical data encrypted at rest (AES-256) and in transit (TLS 1.2+).
Retention: Diagnosis and procedure records retained for minimum 7 years; CDS event logs for 3 years.
icApplication Overrides
How the Coding & CDS noun-apps generate from AMI: module-specific stack additions, project layout, override component bindings, worked Cosmos container definitions, a versioning worked example, environment cascade, and RBAC enforcement.
Shared generation map. The IC platform code-gen flow, default bindings, environment cascade, RBAC model, and CLI commands are identical across all modules. See the IC Reference for the canonical shared reference. This section covers only Coding & CDS-specific content.
Technology stack P0
The shared platform stack (Cosmos DB, Redis, IC-generated API, Angular 21, SQS+SNS, OpenTelemetry, etc.) is documented in the IC Reference. Module-specific additions:
Layer
Choice
Notes
Language
TypeScript (Node 22 LTS)
Shared across IC-generated services in REV.health.
API framework
Fastify + tRPC; FHIR R4 facade via HAPI-style adapter
JSON-First per IC hard rule #10.
Terminology server
IMO Health (primary) with CTS2/FHIR Terminology API; NLM UMLS Metathesaurus, RxNorm, SNOMED-CT US Edition, LOINC consumed via the same façade; AMA CPT licensed and served through the terminology server.
Code sets are never embedded in container images. Tokens scoped per-deployment.
CDS Hooks runtime
BUILD — REV.health's own CDS service, implementing CDS Hooks 2.0.
Per the PRD §4.4 BUILD/BUY: CDS Hooks runtime is BUILD.
Rule expression language
CQL (HL7 Clinical Quality Language) for clinical rules; JSON-Logic for simple guard rules.
Stored in ExpressionText on CdsRule.
AI coding QA partner
HYBRID — CodaMetrix or Fathom for retrospective QA; native real-time per PRD §4.4.
QA partner is consulted via API; results round-trip into CdsHookEvent as analytic markers.
Drug knowledge
BUY — Lexidrug, FDB, or Medi-Span via licensed feed
The CDS Hooks 2.0 service is built alongside the generated services and deployed in the same cascade.
Component bindings P0
Default AMI-type bindings are listed in the IC Reference. Module-specific overrides are below.
AMI type / field
Override (module-specific)
Diagnosis.Icd10CodeString50
ic-ng21-cds-1-code-picker bound to system=icd-10-cm
Procedure.CptCodeString50
ic-ng21-cds-1-code-picker bound to system=cpt
Procedure.HcpcsCodeString50
ic-ng21-cds-1-code-picker bound to system=hcpcs
Procedure.EmLevelString50
ic-ng21-cds-1-em-leveler
OrderSet.OrderItemsJsonText
ic-ng21-cds-1-orderset-applier
CdsHookEvent.OverrideReasonString50
ic-ng21-cds-1-override-reason-picker
(suggestion card surface)
ic-ng21-cds-1-suggestion-card
Worked Cosmos container definitions (org-scoped CdsRule) P1
Emitted by the IC generator from CdsRule.ami.json. Types follow the Cosmos AMI mapping. Partition key isolates by OrganizationID.
CREATE TABLE cds_rule (
cds_rule_id UUID PRIMARY KEY,
rule_family_id UUID NOT NULL,
name_string100 VARCHAR(200) NOT NULL,
hook_type_string50 VARCHAR(64) NOT NULL,
rule_kind_string50 VARCHAR(32) NOT NULL,
severity_string50 VARCHAR(16) NOT NULL,
expression_text TEXT NOT NULL,
version_string50 VARCHAR(64) NOT NULL,
effective_datetime_utc TIMESTAMPTZ NOT NULL,
retired_datetime_utc TIMESTAMPTZ NULL,
override_threshold_decimal Decimal (JSON number) NULL,
is_ai_dsi_bool BOOLEAN NOT NULL DEFAULT false,
model_card_uri_string200 TEXT NULL,
organization_id UUID NOT NULL,
updated_datetime_utc TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_by_user_id UUID NOT NULL,
deleted_datetime_utc TIMESTAMPTZ NULL
);
CREATE INDEX cds_rule_org_active_idx
ON cds_rule (organization_id, rule_family_id, effective_datetime_utc DESC)
WHERE deleted_datetime_utc IS NULL AND retired_datetime_utc IS NULL;
-- Partition key: /organization_id (Cosmos container partition key for org isolation)
-- All queries automatically scoped to the request context's OrganizationID partition
Global tables (Diagnosis, Procedure, CodeSet, CodeSetVersion, CodeMapping) omit OrganizationID and do not use OrganizationID partition key. Authorization on Diagnosis / Procedure is enforced at the application layer via the patient-scoped authorization-chain trace and the read-access audit; DB-layer partition key would falsely partition global data. This is documented as DEC-RH-002.
Versioning · worked example for a CdsRule break P0
Versions follow the IC break.feature.bug.buildtimestamp scheme. Every change to a CdsRule creates a new immutable row; the prior row is retired with RetiredDateTimeUTC. The active version per (OrganizationID, RuleFamilyID, t) is the one with the highest EffectiveDateTimeUTC ≤ t and a null RetiredDateTimeUTC.
Step
Change
Old version
New version
Reason
1
Tweak warning text wording
1.0.0.20260115T1730Z
1.0.1.20260203T1010Z
Bug-fix bump (text-only). Backward compatible.
2
Add a new OverrideReasonString50 code benefit-outweighs-risk
1.0.1.20260203T1010Z
1.1.0.20260307T0915Z
Feature bump. Adds an option; old payloads remain valid.
3
Change HookTypeString50 from order-sign to medication-prescribe only
1.1.0.20260307T0915Z
2.0.0.20260411T1404Z
Break. Trigger surface changed; consumers and hook-binding configs must be updated. Prior version retired.
Permission gating (IC hard rule #5). The break in step 3 cannot ship without the compliance.lead or practice.admin role; the build pipeline rejects break-bumps lacking the role's signed approval marker.
Illustrative timestamps. The buildtimestamp values above are illustrative formatting examples (YYYYMMDDTHHMMZ); they are not asserted to correspond to any real build artifact.
Coding & CDS environment details
Dev: ephemeral; scale-to-zero; mock terminology server with a fixture subset; license-bearing code sets (CPT, SNOMED-CT) are not present.
QA: auto-deployed on green Dev; full terminology server with non-prod tokens; replay corpus runs as a release gate.
UAT: design-partner facing; production terminology entitlements; rule promotions captured to an audit log.
Prod: production terminology entitlements; CDS service replicas across ≥ 3 availability zones; Object-Lock S3 retains all CdsHookEvent payloads beyond the row's TTL.
Coding & CDS RBAC notes
SMART on FHIR scopes. Patient scopes (patient/Diagnosis.read) limit reads to the authenticated patient's own rows. Compliance writes (CdsRule, OrderSet) require the compliance.lead or practice.admin role plus AAL2 step-up.
Global clinical-fact authorization. Global tables (Diagnosis, Procedure) are not partition-key isolated; their authorization is enforced by the patient-scope chain at the application layer (see Data Model).
Cross-Module Links
Clinical Documentation — Diagnosis and Procedure link to Encounter; problem-list changes fire CDS hooks.
Eligibility — Diagnosis and procedure codes feed PriorAuth service/diagnosis fields.
Scheduling — VisitType maps to default E&M level; HCC re-capture flagged at annual visits.