BiobadamexAI architecture
This page shows the BiobadamexAI components and how they connect. Figure 1 shows intake and extraction. Figure 2 shows review and submission.
| Term | Meaning |
|---|---|
| Surface | A group of API routes for one type of client. |
| Job | One unit of work in a pg-boss queue. |
| Extractor | The code that turns a note into a typed record. |
| Registry worker | The Playwright program that fills the BIOBADAMEX forms. |
| Tri-state | A field that keeps three cases apart: a documented value, an explicit negation (false) and unknown. |
System map: intake and extraction
Section titled “System map: intake and extraction”Figure 1 shows these connections:
- The React console and the service intake call the Hono API.
- The Hono API stores the encrypted originals in R2.
- The Hono API stores the metadata and the drafts in PostgreSQL.
- The Hono API and the Agent API put extraction jobs into
pg-boss. - The RheumAI audit proxy calls the Audit API. The Audit API calls the extractor directly.
pg-bossgives each job to the extractor.- The extractor sends the de-identified note to Nebius.
- The extractor applies the tri-state schema, DAS-28 and completeness. The result goes to PostgreSQL.
Review and submission
Section titled “Review and submission”A draft goes through these steps after extraction. The numbers in Figure 2 are the numbers in this list.
- Correct. The clinician reviews and corrects the draft in the console. The API saves the correction in
record, in PostgreSQL. - Approve. The clinician approves the draft. The API changes the state to
approved. - Request the submission. The clinician requests the submission. The API puts a job into the
registry-submitqueue. - Start the microVM. The registry worker runs in a disposable Tenki microVM.
- Fill the forms. The worker logs in to BIOBADAMEX and goes through
crdAtocrdE. - Read the
idpac. The worker gets theidpacafter it savescrdA. - Confirm the summary. The worker requires the final summary to show the same
idpac. - Save the result. The
idpacand the summary come back as a receipt. The receipt stays in PostgreSQL.
Components
Section titled “Components”Web application
Section titled “Web application”The React console puts daily work into one list of notes. Filters show which notes need attention. Each row has an action for its state: extract, review or view. Review screens show the source document, the structured record, the corrections and the treatment episodes. A separate confirmation comes before submission.
The Hono API mounts these surfaces:
| Route | Function |
|---|---|
/api/biobadamex/intake |
Pasted text, files and service intake. |
/api/biobadamex/uploads |
Inventory, on-demand extraction and retrieval of the original. |
/api/biobadamex/drafts |
Review queue, detail, correction, approval, rejection and submission. |
/api/biobadamex/audit |
Grading and submission for review from RheumAI. |
/api/biobadamex/agent |
Limited access for an agent that works for one clinician. |
/api/flujos |
Operational timeline with a reduced, PHI-light view. |
Console routes require a session, a resolved user and research access. Machine-to-machine surfaces use separate service keys.
Storage
Section titled “Storage”- R2 keeps the original file, encrypted with AES-256-GCM.
- PostgreSQL stores the file metadata, jobs, drafts, audit and submission outcomes.
- The working copy of the record keeps the tri-state values.
agentRecordkeeps the original extraction and does not change.recordis the copy that the clinician can correct.- The system encrypts the draft source text when a valid master key is available.
pg-boss keeps extraction separate from registration. The API registers the workers only when BIOBADAMEX_QUEUE_ENABLED=1. The extraction queue has retries and a dead letter. Registration uses a different queue. Each worker processes one registration job at a time. An installation with more than one instance needs extra coordination for global serialization.
Domain package
Section titled “Domain package”@poktahealth/biobadamex-registry contains the record schema, the unknown semantics and the disease rules. It also contains DAS-28, the job contracts, the external field map and the correction and completeness rules.
Registry worker
Section titled “Registry worker”The Playwright worker runs in a disposable microVM. The worker logs in and goes through crdA to crdE. It reads the idpac after it saves crdA. It requires the final summary to show the same identifier.
Three distinct boundaries
Section titled “Three distinct boundaries”| Boundary | What it controls | What it does not prove |
|---|---|---|
| Extraction | It turns a note into a typed record. | That every value is correct. |
| Clinical review | It lets the clinician correct and approve. | That the external platform received every field. |
| Worker confirmation | It reads the idpac and the summary. |
A field-by-field read-back after submission. |