- Ya
- 25 Agosti 2026, 01:08 UTC
- Mwandishi
- Kamo
- Ahadi ya
- a69d4b7
The foundation every clinical entity reuses, and the build gate that stops it drifting. Both land together on purpose: a harness written before there is anything to police passes vacuously, which is a failure mode this codebase has been bitten by before. ClinicalBaseEntity is deliberately NOT BaseUuidEntity. That one uses LocalDateTime and TIMESTAMP, and FHIR instant requires an offset — this platform already shipped a bug where a LocalDateTime reached the wire with none and a 3:33 AM message rendered as 10:33 AM. On a clinical timestamp that is a charting error. It also carries tenantId, which leads every index because on Yugabyte the leading column decides the tablet AND is the isolation guarantee: the same human is a different patient in each practice, so the patient is not the boundary. The datatypes carry the decisions worth not re-litigating: - FhirConcept inlines the PRIMARY coding and sends the rest to fhir_coding. A pure child table would force a join on every Observation and Condition read, which is most of the chart. - FhirQuantity stores the UCUM-canonical pair separately, because quantity search compares magnitudes. Without it a query for 7500 ug misses a stored 7.5 mg and returns an empty result that reads exactly like the patient having no such observation. A silent miss on a lab value is the worst failure mode in the schema. - FhirPeriod keeps precision, because a FHIR date is an INTERVAL: 2026, 2026-08 and 2026-08-24 are different values and eq2026 means the year. - FhirReference is a discriminator plus an id, never Hibernate @Any, which cannot be joined in HQL or usefully indexed on a distributed store. - Names, addresses and contact points are child tables holding entered, normalized and (for addresses) USPS-standardized forms separately. Matching must not change what is displayed, and display must not decide what matches. The existing EmbNameFull, EmbAddress and EmbPhoneNumber cannot express this and cannot be widened without breaking CRM callers. The harness enforces by reflection over compiled classes rather than a source regex, because every rule is about an annotation VALUE. It is mutation-proven: four simultaneous violations were injected and all four rules fired with their own explanations before the revert. 1623 tests green.