Draft/Publish System
The Draft/Publish system (SP-5) provides the separation layer between AI-extracted draft data (taxonomy entities awaiting operator review) and validated live data consumed by the RAG pipeline. It is the final gate before taxonomy changes reach search users.
SP-5 receives approved entities from the Entity Resolution Pipeline (SP-4) and exposes versioned snapshots to the Frozen Taxonomy Registry. The Pipeline Wizard (SP-6) provides the operator UI for triggering publish, previewing deltas, and managing version history.
The Problem
Without a draft/publish boundary, any change to taxonomy data would immediately affect the live RAG pipeline:
- An operator approving a batch of entities mid-review could expose an incomplete taxonomy to search users
- Rolling back a bad extraction run would require manual, surgical edits to live data
- Regulatory auditors (EU AI Act, Art. 12) cannot reconstruct which entity inventory was active at any point in time
The draft/publish system solves all three: operators work entirely in draft space, publish is an atomic snapshot operation, rollback removes every version after the chosen one, and every version is permanently recorded.
Architecture
Published Data
Three stores hold the published snapshot. Their exact schema is an implementation detail; functionally they are:
- Published entities. A version-per-row store: each publish inserts new rows tagged with the version number. Each row carries the entity type (doctor, department, condition and so on), its canonical name, aliases, descriptive metadata, an optional medical-terminology concept code, a link back to the draft entity it came from, and who published it and when. Rows from previous versions are kept for rollback and audit.
- Published relationships. The same version-per-row strategy: the source and target entity, the relationship type (for example a department handling a condition, offering a treatment, or a doctor working in a schedule), and a link back to the draft relationship.
- Version registry. One record per publish: the version number (increasing per hospital), which draft version was published, how many entities and relationships the snapshot contains, who published it and when, and the operator's notes.
The alternative, a single serialised snapshot per version, would require unpacking large blobs to reconstruct the entity inventory. Version-per-row lets the registry load a version with a simple filter at normal database speed.
Publish Flow
Publishing runs as a single database transaction:
Exclusive lock. Only one publish runs at a time per hospital. If a second operator triggers a publish concurrently, the second call waits for the lock rather than producing a corrupt snapshot.
ID remapping. Draft relationships reference draft entities. During publish, the pipeline re-maps these to the newly created published entities so that published relationships reference only published rows.
Impact Preview
Before committing a publish, operators can request a preview of the difference against the current live version. It reports, for entities and for relationships, how many would be added, modified and removed, with a breakdown per entity type (for example: 14 entities added, 3 modified, 2 removed; most of the additions being conditions). The delta is computed by comparing approved draft entities with the currently published version. Nothing is written during a preview.
Rollback
Rolling back to version N removes all published entities, relationships and version records after version N, then reloads the registry from the now-current version.
Rolled-back versions cannot be recovered without re-running the publish. The draft data is never touched by a rollback, so operators can re-approve and re-publish as needed.
Registry Integration
The frozen taxonomy registry can be built directly from a published version (the latest by default, or a specific one). It converts the flat published rows into immutable doctor, department and other objects, from which its fast lookup indexes are built. The older initialisation path from raw scrape results still exists for unit tests and legacy tooling; the published-version path is the production path from SP-5 onwards.
Version-Check Cache Invalidation
The running registry checks for a new published version about once a minute and reloads when a newer one exists. After every publish or rollback the publish service also forces an immediate rebuild, so the change is reflected in search without waiting for the next check.
Administrative Functions
Operators can preview a publish, publish, roll back to a chosen version, remove all published data for a hospital, and list versions with their details. All functions that change data require administrator authorisation; preview and listing require ordinary authentication.
Regulatory Compliance
The versioned publish system is designed to support the following obligations (this is the project's own mapping, not a legal opinion):
- EU AI Act Art. 12. Every publish creates a permanent record of which entity inventory was active, with who published it and when.
- EU AI Act Art. 14. Human oversight is enforced in the workflow: entities cannot reach the RAG pipeline without explicit operator approval and a deliberate publish action.
- GDPR Art. 22. An audit trail of every approve/reject decision, with the responsible user, supports the right to human review.
References
- Brewer, E. A. (2000). Towards robust distributed systems. PODC 2000 Keynote. (CAP theorem — basis for advisory lock design)
- Kleppmann, M. (2017). Designing Data-Intensive Applications. O'Reilly Media. (Chapter 7: Transactions)
- European Parliament. (2024). EU AI Act, Regulation (EU) 2024/1689. https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32024R1689