Kulcare Docs
DeveloperHospital surgery center

Hospital MAR Local U1 Execution Record

Model routing, characterization evidence, review limits, and manual QA for the first local MAR unit.

Scope And State

This record tracks local U1 of the programme U6 plan. It is not programme U1 and does not complete programme U6. Use the source guide for current behavior and later writer protection. Delivery stays in draft PR 2757.

BoundaryState
Source characterization T01-T04Added; focused checks pass
API contract and developer handoffAdded; documentation checks pass, scoped CodeRabbit review complete
Managed-source schema and commandsNot implemented by local U1; local U2-U5 remain pending
Live frontend integrationNot implemented by local U1; local U6-U8 remain pending
Deployment / human QA / D4 approvalNot performed or accepted by this unit

Model Trial Record

  • Requested implementation: GPT-6 Luna, High, for the bounded local U1 trial.
  • Actual execution: native Codex session. The host identifies the GPT-5 family; an exact serving-model ID and reasoning-effort receipt are not exposed.
  • Fallback reason: the supported cross-model adapter requires npx, which conflicts with this repo's pnpm-only rule. No external implementation worker was started. The host disclosed native fallback before the first edit.
  • Result: the Luna trial did not run. Do not use this unit as evidence of Luna quality, speed, or cost. Sol/Astra routing for later units must be verified when used.
  • Initial test repair: one round corrected an observation fixture to use the current polymorphic value setter and changed the replacement expectation after SQL evidence showed Rails nullifies old order encounter links. No production behavior was changed to satisfy the test.
  • Formatting: changed-test RuboCop corrections are separate from functional repair.
  • Tokens, credits, and attributable model cost: unavailable. No saving is claimed.
  • Independent Astra review: not run; the supported cross-model launcher has the same package-management constraint. CodeRabbit coverage is recorded separately.

The result log lives here during execution; the plan remains a decision document. Use this record to decide later model assignments, not a presumed successful trial.

Verification Evidence

Starting source HEAD: cc77679260939b24ea7991a46ea48a3b45fc5236. Base: 647645d15695549bf172f196f52c9c51c620d249. The added unit files are tested as an uncommitted diff over that source. No application implementation or schema file changes are part of local U1.

Existing tests inspected and exercised: medication request/administration model and request tests, encounter batch-save service/request tests, and Hospital case model/service tests. Some old request-test comments claim a red baseline; the actual run, not those comments, supplies current evidence.

CheckResult
Existing medication and encounter baseline, six files135 tests, 279 assertions, zero failures/errors/skips
Characterization plus baseline and Hospital case tests, nine filesFinal formatted run: 178 tests, 548 assertions, zero failures/errors/skips
Changed-test RuboCopOne file, zero offenses; existing configuration warnings remain
Fumadocs build and local linksBuild/search index passes with 496 pages; 17 local guide/plan links and both rendered MAR pages verified
Scoped CodeRabbit reviewCLI 0.9.0 review --agent --uncommitted; completed, eight files reviewed, zero findings
CE code-review panelAttempted, unavailable; no completed panel receipt

Tests use owned disposable database kulcare_hospital_u6_u1_20261019_test. The checked-in SQL schema was loaded there. The first boot reported missing Rails environment metadata; the host then set this database's environment to test and the focused rerun passed without that warning. No shared development or staging database was reset or seeded.

The test command is in the source guide. It includes two additional Hospital case files for the nine-file run: domains/clinical/test/services/hospital/surgical_cases_test.rb and domains/clinical/test/models/hospital/surgical_case_and_ot_test.rb. There is no red-feature/fix pair: this unit characterizes unchanged source behavior.

Not claimed: new non-bypass MAR RLS proof, managed-link eligibility, concurrency protection, full backend/frontend CI, a real-HTTP nursing journey, clinical policy approval, or staging acceptance. Those belong to later implementation gates. No frontend runtime changed, so a new nursing browser journey is not available.

Code review: skipped (ce-code-review unavailable). The required separate reviewer, validator, merge, and report agents cannot run in this session. Its tools expose no agent dispatch/collection capability. A manual source/diff scan and the separately approved CodeRabbit pass provide the available review; they are not reported as a completed CE panel or an Astra review.

The CodeRabbit snapshot contains the eight approved U1 files and 14 separately approved source-context files. It excludes credentials, local configuration, schema dumps, patient records, and session artifacts. The serving model and effort are not exposed. No separate model identity is inferred from the service name. The review ran without a Git remote in the private snapshot and used the CLI allowance; no paid-credit option was enabled. After review, the host refreshed this evidence record and replaced one remaining prototype audit-list use of skipped with the explicit planned outcomes. Those documentation-only changes received a manual consistency scan, not a second external review.

The available review found no unresolved local U1 implementation issue. This is not permission to mark the umbrella PR ready: the remaining local MAR units and the later programme recovery/discharge units are still pending.

Findings For Later Units

  1. Local U2/U3: an encounter medication replacement detaches the old source rows and creates new IDs. Prevent managed detachment and deletion. Preserve whole-batch rollback and source history under concurrent enrollment.
  2. Local U2/U5: current request validation does not prove registration/patient/ facility agreement. Add scoped constraints and actual eligible-order policies.
  3. Local U2/U4: Staff nurses need authenticated User performer and recorder provenance. Keep explicit grants and current assignment checks.
  4. Local U3: cross-tenant imports copy most columns. Exclude future MAR lineage fields explicitly so snapshots cannot acquire authority from an origin order.
  5. Local U3/U6/U7: reconcile nested administration dosage and display semantics with canonical readers; do not call the unsupported prescription builder.

These are required later work, not unresolved defects in a completed live U1 feature. Local U1 has no live clinical feature and cannot authorize activation.

Manual QA And Approval

  • Backend/frontend owners review the wire contract and distinguish request, version, occurrence, administration, and operation-key IDs.
  • Review replacement/detachment and mixed-batch rollback evidence with the source owner before local U3 managed enrollment is exposed.
  • Review the real Staff-without-Practitioner example and planned explicit grants.
  • Confirm day-care needs no encounter or Recovery API and that foreign-order selection still needs local U2/U5 implementation proof.
  • Name qualified nursing/clinical reviewers and retain open D4 policy inputs.
  • Keep live MAR writes disabled; record deployment and acceptance separately.

Simmi remains the deployment coordinator. This record does not appoint a clinical approver or convert a coordinator role into a qualified nursing sign-off.

On this page