The repository layer, with a harness that proves it boots

Featurekamo-shared-library
Shipped
August 25, 2026 at 6:39 PM UTC
Author
Kamo
Commit
b3daf54

Repositories for patients, encounters, scheduling, the chart, notes, questionnaires, coverage and claims. Every query leads with tenantId because on YugabyteDB the leading index column decides which tablet serves it, and every query that could grow without bound is either bounded by a code or takes a Pageable — "all observations for this patient" works beautifully in a demo and times out on a diabetic patient of fifteen years. Three rules are enforced by the query shapes rather than by the callers. Resolved problems are excluded in the database, because "the UI filters it" is a promise every future caller has to keep and a resolved condition on an active problem list is a clinician acting on something untrue. Coverage comes back primary-first from the database, because billing the secondary first is a denial that costs a month. Allergy and medication checking is never paged, because a page boundary in the middle of an allergy list is a prescription that missed the allergy on page two. Observation gained a diagnosticReportId, and its index took the slot an encounter index would have had. The trade is deliberate: a chart screen showing one visit already knows the patient, so encounter-scoped reads come off the patient index — but a clinician reviewing a result does NOT know which of a patient's thousands of values belong to the report in front of them, and finding out without that index is a scan of the largest table in the schema. ClinicalQueryParseTest is the part worth reading. A JPQL string is not checked by the compiler, and Spring Data validates annotated queries at BEAN CREATION — so o.codeCode where the mapping says o.code.code compiles, ships, and takes the service down at startup rather than returning nothing. On this platform that is SecurityService crash-looping and every login on it stopping. The harness builds Hibernate metadata over the clinical entities and asks the HQL parser to translate every @Query, and parses every derived finder name with Spring Data's own PartTree. No database is touched: parsing needs the mapping, not a connection, so it costs the build seven seconds and needs no container. Both halves were mutation-proven — o.code.code -> o.codeCode and ...OrderByActualStartDesc -> ...OrderByPeriodStartDesc each fail it with the exact message a startup would have produced. 1834 tests green.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing