Skip to content

Working with Records

Working with Records

Once a consultation is finalized, its data lives in the consultation records system. Records are immutable by default — every change creates a new version, preserving the full history for regulatory compliance and audit trails.

Retrieving a Record

Fetch the current state of a finalized consultation:

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}" \
-H "x-api-key: $DELPHOS_API_KEY"

Response:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"external_consultation_id": "ATD-2024-001234",
"external_patient_id": "PAT-5678",
"status": "GENERATED",
"soap": {
"subjective": "Paciente relata cefaleia tensional há 3 dias...",
"objective": "PA 120/80 mmHg, FC 72 bpm...",
"assessment": "Cefaleia tensional episódica...",
"plan": "Prescrição de analgésico..."
},
"doctor_notes": "",
"source_transcript": "Médico: Bom dia...",
"version_info": {
"current_version": 1,
"total_versions": 1,
"last_edited_by": "DOC-123",
"last_edited_at": "2026-04-14T10:45:00Z"
},
"created_at": "2026-04-14T10:30:00Z",
"updated_at": "2026-04-14T10:45:00Z"
}

Record Statuses

StatusDescription
GENERATEDInitial SOAP note created by DELPHOS
REVIEWEDPhysician has reviewed the note
APPROVEDPhysician approved — ready for the medical record
REJECTEDPhysician rejected — needs revision
AMENDEDModified after initial approval

Editing Doctor Notes

Update the physician’s notes on a finalized consultation. This creates a new version snapshot automatically:

Terminal window
curl -X PATCH "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}/notes" \
-H "x-api-key: $DELPHOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"doctor_notes": "Paciente orientado sobre retorno em 15 dias para reavaliação.",
"edited_by": "DOC-123"
}'

Regenerating the SOAP Note

If the physician wants a fresh SOAP note (for example, after adding extensive notes), they can trigger regeneration:

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}/regenerate-soap" \
-H "x-api-key: $DELPHOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"edited_by": "DOC-123",
"source": "notes+transcript"
}'

The source parameter controls what input is used:

SourceDescription
notes+transcriptUses both physician notes and the original transcript (default)
notes_onlyUses only physician notes, ignoring the transcript

A version snapshot is created before the regeneration, so the previous SOAP is always recoverable.


Version History

Every edit creates an immutable version snapshot. List all versions:

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}/versions" \
-H "x-api-key: $DELPHOS_API_KEY"
{
"consultation_id": "550e8400-e29b-41d4-a716-446655440000",
"versions": [
{
"version_number": 1,
"edited_by": "SYSTEM",
"edited_at": "2026-04-14T10:45:00Z"
},
{
"version_number": 2,
"edited_by": "DOC-123",
"edited_at": "2026-04-14T11:00:00Z"
}
],
"total": 2
}

Retrieving a Specific Version

Fetch the full content of any historical version:

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}/versions/1" \
-H "x-api-key: $DELPHOS_API_KEY"
{
"id": "990e8400-e29b-41d4-a716-446655440004",
"consultation_id": "550e8400-e29b-41d4-a716-446655440000",
"version_number": 1,
"content": {
"subjective": "...",
"objective": "...",
"assessment": "...",
"plan": "..."
},
"content_hash": "a3f2b1c4d5e6...",
"edited_by": "SYSTEM",
"edited_at": "2026-04-14T10:45:00Z"
}

Addendums

Addendums are append-only annotations attached to a finalized record. Unlike edits to doctor notes, addendums cannot be modified or deleted after creation — they are a permanent addition to the medical record.

Creating an Addendum

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}/addendums" \
-H "x-api-key: $DELPHOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Resultado de exame laboratorial recebido: hemograma completo normal.",
"author": "DOC-123"
}'

Response (201 Created):

{
"id": "aa0e8400-e29b-41d4-a716-446655440006",
"consultation_id": "550e8400-e29b-41d4-a716-446655440000",
"text": "Resultado de exame laboratorial recebido: hemograma completo normal.",
"author": "DOC-123",
"created_at": "2026-04-15T09:00:00Z"
}

Listing Addendums

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/consultation-records/{consultation_id}/addendums" \
-H "x-api-key: $DELPHOS_API_KEY"

Returns all addendums in chronological order.


Error Handling

StatusCause
404 Not FoundConsultation or version does not exist
409 ConflictConsultation not yet finalized (records endpoints only work on finalized consultations)
503 Service UnavailableSOAP regeneration service temporarily unavailable

Next Steps