Skip to content

feat(flow4d): Phase D — governed DRG catalog → conformance bridge (ships dark) - #115

Merged
sudoshi merged 2 commits into
mainfrom
feature/flow4d-pathway-bridge
Jul 27, 2026
Merged

sudoshi merged 2 commits into
mainfrom
feature/flow4d-pathway-bridge

Conversation

@sudoshi

@sudoshi sudoshi commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Phase D of the Flow-4D Patient-Journey & Conformance plan — the bridge between the governed 250-DRG care-pathway catalog and the Arena conformance engine. Ships dark: nothing per-patient from the DRG catalog reaches a screen without [SU]/clinical sign-off (plan G-9). The only visible artifact is a synthetic, clearly-labeled demo overlay under the already-on demo flag. No migration; no prod flags changed.

  • D1 ReferenceModelCompiler — pure compile() → the declarative portion of the sidecar PATHWAYS spec (ordered activities, timing targets, data-driven deviation labels) + a content-address digest; DB adapter returns null for a version with no persisted executable layer (every version in the inactive release). Deliberately does not emit the sidecar's imperative evaluate callable.
  • D2 near-empty config/care-pathways-ocel-map.php + care-pathways:ocel-coverage — the honest unmapped-milestone gap report.
  • D3 decision memo: adopt CPG-on-FHIR PlanDefinition as canonical representation (serving-gated follow-up), defer CQL execution, ship the bespoke compiler now.
  • D4 PathwayInstanceReadService — assignment_enabled + Schema::hasTable guarded, append-only reads via the current_*_statuses views, grant resolved by source_encounter_id.
  • D5 FlowPathwayDemoService — curated HF milestones → the same pure compiler → LOS-driven synthetic progress in the journey drawer (PathwayProgressPanel), gated by care_pathways.demo. New flow4d.pathway_progress serving flag composes with assignment_enabled.

Why it's safe (dark)

  • Journey response omits pathway_progress entirely when both the serving flag and the demo flag are off — byte-identical inertness, test-pinned.
  • Real serving needs FLOW4D_PATHWAY_PROGRESS_ENABLED and CARE_PATHWAYS_ASSIGNMENT_ENABLED (both off by default) — checked at the service AND the orchestrator/component.
  • clinical_use is always false; the demo carries an explicit "Demo — not clinical guidance" notice and writes nothing to the DB.
  • Reads never mutate the append-only pathway history (asserted).

Test plan

  • PHPUnit — 25 new tests (compiler determinism + digest pin, compileVersion adapter, OCEL coverage report, read-service progress + flag-off inertness + append-only-untouched, demo synthesis, journey inertness + demo-attach). Full CarePathways + PatientFlow suites: 113 green.
  • Vitest — 6 new (drawer pathway panel render + absent, schema tolerance). Drawer + journey suites: 36 green.
  • tsc --noEmit, vite build (stricter), check-ui-canon.sh, Pint — all clean.
  • Design hook: navigator overlay findings are the pre-existing sanctioned F-9 exception (CLAUDE.md); the new panel reuses that scoped palette, status by glyph + word.

Deferred (with serving; not scheduled)

PlanDefinition projection output (D3); any real per-patient serving from the DRG catalog ([SU]/clinical, G-9); authoring the executable milestone layer.

🤖 Generated with Claude Code

sudoshi added 2 commits July 27, 2026 19:32
…ips dark)

D1 ReferenceModelCompiler: pure declarative compile (ordered activities, timing
targets, data-driven deviation labels) + content-address digest; thin DB adapter
returns null for a version with no persisted executable layer (every version in
the current inactive release). D2 milestone↔OCEL activity map + the
`care-pathways:ocel-coverage` gap report. D4 PathwayInstanceReadService:
flag+schema-guarded, append-only reads via the current-status views. D5 synthetic
demo overlay — curated HF milestones → the SAME pure compiler → LOS-driven progress
in the journey drawer, gated only by care-pathways.demo; new flow4d.pathway_progress
serving flag composes with the assignment gate (both off by default). D3
CPG-on-FHIR-vs-bespoke decision memo.

Serving stays dark (plan G-9): nothing per-patient from the DRG catalog reaches a
screen without [SU]/clinical sign-off; the journey response is byte-identical when
both flags are off. No migration. 25 new PHP tests + 6 JS tests, all green
(compiler determinism/digest pin, coverage report, read-service inertness +
append-only untouched, demo synthesis, journey inertness + demo attach, drawer
render + schema tolerance).
@sudoshi
sudoshi merged commit e4866a7 into main Jul 27, 2026
19 checks passed
@sudoshi sudoshi mentioned this pull request Jul 28, 2026
3 tasks done
sudoshi added a commit that referenced this pull request Jul 28, 2026
Follows the independent review of PR #115 (no CRITICAL/HIGH; PHI-opaqueness,
dark-serving inertness, append-only reads all confirmed).

- PatientJourneyService: cast Carbon 3's float diffInMinutes to int before
  intdiv (was E_DEPRECATED lossy float→int per demo journey-open, TypeError under
  PHP 9); cache the designated-demo-encounter lookup 60s (was an unindexed
  ORDER BY admitted_at scan per journey request while the demo flag is on).
- PathwayInstanceReadService: select only the 3 columns used from
  patient_experience.pathway_instances (the table also carries an encrypted
  source-identity column — never pull it into memory).
- ReferenceModelCompiler: dedup duplicate stable_keys in the public compile()
  (first occurrence wins; compileVersion already relies on the DB unique key).
- Tests: fractional-timestamp LOS regression with an E_DEPRECATED trap (PHPUnit
  here isn't set to fail on deprecations), null-encounter-id short-circuit,
  duplicate-stable_key dedup. 116 CarePathways+PatientFlow green; Pint clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant