Intake and extraction
This page describes how a note enters the system, how the system protects it and how the system turns it into a draft.
| Term | Meaning |
|---|---|
| Intake | The entry of a note into the system. |
| Original | The bytes of the file that the clinician uploaded. |
| Inventory | The list of stored files of one clinician. |
| De-identification | The step that removes identifiers from the note before the model call. |
| Dead letter | The destination of a job that used all its attempts. |
Intake modes
Section titled “Intake modes”| Input | Persistence of the original | Extraction timing |
|---|---|---|
| Pasted text in the console | It makes no original-file row. | Immediate. The API queues the note when it receives it. |
| PDF, Word or text file in the console | Encrypted original in R2 and a metadata row. | On demand, from the inventory. |
| Service-key batch | One encrypted original for each note. | Storage only. The clinician extracts later. |
| RheumAI “submit for review” | It makes no upload row. | The server extracts again and makes a held draft. |
| Dedicated clinician agent | It uses only the uploads of the configured clinician. | On demand, with an agent key. |
| WhatsApp study-channel document | Encrypted original in R2. | Immediate, when the channel, the consent and the clinician are configured. |
The batch response proves storage, not extraction. Each note returns its own result. One invalid note does not stop the other notes in the batch.
A file goes through these steps. The numbers in Figure 1 are the numbers in this list.
- Validate. The API validates the format, the filename and the size. The API does this before it decodes the full file.
- Extract the text. The API extracts the text locally. For PDF it uses
unpdf. For Word it uses the document parser. Plain text is decoded directly. - Encrypt. The API encrypts the original bytes with AES-256-GCM.
- Store. The API stores the ciphertext in R2. The API stores the metadata in PostgreSQL.
- Show in the inventory. The inventory shows the state and a derived name. The inventory does not show the note body.
- Request the extraction. The API checks the scope before it gets or decrypts the file.
The current limit for the original file is 20 MiB. The API cleans filenames. Thus a filename cannot contain control characters or path separators.
Extraction job
Section titled “Extraction job”The extraction worker does these steps. The numbers in Figure 2 are the numbers in this list.
- Get the text. The worker gets the note text.
- De-identify. The worker applies best-effort de-identification.
- Call the model. The worker calls the configured
registro-extractionmodel. - Parse. The worker parses the JSON reply.
- Convert the nulls. The worker changes each null value to
unknown. - Validate. The worker validates the record against the schema.
- Calculate DAS-28. The worker calculates DAS-28.
- Calculate the missing fields. The worker calculates the missing fields for the disease.
- Make the draft. The worker makes a
review_pendingdraft with the encrypted source and the attribution.
Integrity
Section titled “Integrity”- The model does not set the tri-state semantics.
- The system keeps a real zero as zero.
falsemeans only an explicit negation. The exception is the comorbidities that the clinician confirms at submission.- The system compares the reported DAS-28. The system calculates the authoritative value from the components when possible.
- A biologic episode keeps the role, the drug, the dates and the stop reason separate.
- A requested biologic episode with no date of its own can use the request date or the note date. Current and previous episodes do not use this rule.
Privacy and residual risk
Section titled “Privacy and residual risk”De-identification removes generic identifiers. It also removes patient-name tokens when it finds them. De-identification is not a compliance guarantee. An unlabelled name can stay in the note. Clinical dates, sex, the center and the clinician can stay because they are part of the record.
The clinical extraction job payload can contain plaintext note text in PostgreSQL. The study path encrypts its note before the queue. The clinical path does not have that protection yet.
Retries and failures
Section titled “Retries and failures”- Extraction permits five attempts with backoff.
- After the last attempt, a dead letter makes a failure that the app shows. The dead letter does not store the note text.
- The clinician can extract a failed or rejected note again.
- A pending or approved draft prevents a duplicate extraction.
Operational gaps
Section titled “Operational gaps”- A failure between the R2 write and the metadata insert can leave an orphan encrypted object.
- A queue failure after the upload is stored gives a partial success. The source exists, but no job exists.
- The system can make the draft and then fail at the audit step. Then a retry can make a second draft. The insert has no idempotency key for each attempt.
- A pasted note that goes to the dead letter has no recoverable original in the inventory.
- Source completion fills only
unknownscalar fields. It does not merge episode arrays. It has no clinician UI.