How to read this document
First parse the WebSocket frame with JSON.parse(event.data), then parse message.allData.processedText. The result is one clinical object for the shared consultation, not one object per microphone.
assessment[].doctor_id means the key in every investigation row. Empty text "", empty arrays [], null, boolean false, and string "0" have different meanings. A heading-only narrative contains no clinical details. Preserve returned types and Markdown text such as **Diagnosis:**.
socket.addEventListener("message", ({ data }) => {
const message = JSON.parse(data);
if (message.type !== "session.processed") return;
const clinical = JSON.parse(message.allData.processedText);
console.log(clinical.assessment);
console.log(clinical.medication_templates);
// Render returned text using textContent or a sanitized Markdown renderer.
});Every WebSocket response envelope key
The clinical keys below are inside allData.processedText; the session and result metadata stay outside that string.
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
type | string | Message kind. session.processed identifies the final processed-result event. |
session_id | string | Shared consultation session ID originally sent by all sources. |
interaction_id | string | Created interaction identifier. String "154679" in this sample. |
status | string | Processing state. processed means the final payload is available. |
allData | object | Result envelope containing clinical output and interaction metadata. |
Every key in allData
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
workflow_request_id | null | Workflow correlation identifier when supplied. null in this response. |
interaction_id | string | Interaction identifier repeated inside the envelope. String "154679" here. |
user_id | null | User identifier when supplied. null in this response. |
doctor_id | number | Internal doctor identifier for the interaction. Number 143 in this response; not an array of all connected doctors. |
organization_id | number | Internal organization identifier. Number 9 in this response. |
attachment_url | string | Cloud-storage URI for the processed output text file. Not a direct HTTP download link. |
processedText | string | JSON-encoded string containing all clinical fields documented below. Parse this string after parsing the outer frame. |
funct_name | null | Function metadata when supplied. null here; preserve this exact returned key spelling. |
interaction_type | string | Output interaction type. get-opd in this response. |
textingestIntraction | null | Text-ingestion metadata when supplied. null here; preserve the exact returned spelling rather than renaming it. |
Doctor attribution in a multi-source consultation
Each doctor connects with a unique source_id and their own practitioner_id. Exactly one source declares primary_practitioner_id. Source IDs identify audio connections; they are not doctor identifiers.
doctor_id, practitioner_id, and doctor_name. In this supplied response all investigation and medication rows identify practitioner 1001. The sample does not demonstrate rows attributed to a second doctor. Do not create a row for every connected doctor or infer that a missing row means a doctor never joined.Keep row attribution when displaying, editing, grouping, or forwarding orders. Do not replace every row?s identifiers with the current viewer?s ID. cross_dr_id and admission_dr_id are referral selections, not the participant roster. Use WebSocket session.state.sources to inspect the recording sources.
All 34 top-level keys in processedText
These are the keys in the decoded clinical object, in the same order as the supplied response.
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
chief_complaints | string | Main reasons for the visit. This sample describes abdominal pain with headache and a two-day duration. |
history_of_presenting_illness | string | Narrative of symptom onset, progression, recurrence, associated symptoms, and reported negatives. This sample describes abdominal pain, intermittent headache, fatigue, dehydration, and nausea/vomiting sensations. |
past_medical_history | string | Prior illnesses, operations, and relevant history. This sample records appendectomy, hypertension, and hypothyroidism. |
past_medications | string | Medicines taken before this consultation. Separate from new prescription rows; the sample mentions antihypertensive treatment and Dolo. |
personal_history | string | Lifestyle and personal history. This sample describes prolonged sitting, screen time, and limited exercise. |
obstetric_history | string | Pregnancy and childbirth history. The sample supplies only a heading; no details are provided. |
examination_findings | string | Recorded examination observations. Obesity is mentioned in this sample. |
procedure | string | Procedure narrative. Heading only; it does not establish that any planned procedure was performed. |
investigations | string | Narrative investigation text. Heading only here, while structured investigation orders appear in assessment[]. Keep those two representations distinct. |
diagnosis | string | Narrative diagnostic text. The sample lists abdominal pain, migraine, dehydration, and obesity. Separate from ICD-coded diagnosis rows. |
recommendations | string | Recorded general advice. The sample describes walking breaks and exercise advice; retain the supplied text. |
diet | string | Recorded dietary and hydration advice. The sample describes ORS, vegetables, fiber, and avoiding oily foods. |
follow_up | string | Narrative review advice: review after one week. Separate from the structured followup_date and followup_time fields. |
plan | string | Planned management and investigations. The sample mentions MRI and ultrasound evaluation. Narrative alone does not establish an appointment or completed test. |
continue_current_medications | boolean | Medication-continuation metadata. false is supplied; it must not be converted into an instruction to stop every medicine. The original reference does not establish direct consumption by the outpatient form. |
omit_medications | null | Medication-omission metadata. null means no omission information is supplied; this sample does not define a non-null schema. |
assessment | array | Structured investigation orders. Two rows are supplied: MRI and Ultrasound scan. Each row includes doctor attribution; see every child key below. |
medication_templates | array | Prescription rows. Two objects describe Emeset and Thyronorm. Both include doctor attribution and use the same 28 child keys in this sample. |
blood_borne | object | Object with seven infection-related entries. All are null; no positive or negative results are supplied. |
drug_allergies | array | Drug-allergy rows. Empty in this sample; this is not confirmation of no drug allergies. |
food_allergies | array | Food-allergy rows. Empty in this sample; no item schema can be inferred from the response alone. |
other_allergies | array | Other allergy rows. Empty in this sample; see the existing reference for supported form row fields. |
vitals | array | Structured vital-sign rows. Empty here; no measurements are supplied. Do not substitute bp_apparatus_required for this array. |
detected_language | string | Detected spoken-language metadata, supplied as a Markdown-labelled string containing ta (Tamil), rather than a bare language code. |
family_history_notes | string | Relevant family medical history. The sample contains only a heading, so no history details are supplied. |
additional_response | string | Additional/canonical assessment narrative. Empty here. The original reference explains that the form formatter can consume this field; the separate top-level narratives are not automatically concatenated by that fallback. |
phonetic_uri | string | Cloud-storage reference for medication-correction CSV data. A gs:// URI is not a direct browser download URL and is separate from allData.attachment_url. |
icd_diagnosis | array | Structured coded-diagnosis rows. Empty here; no ICD codes are supplied. |
diagnosis_free_text | string | Uncoded diagnosis text for the ICD workflow. Empty here; separate from the populated diagnosis narrative. |
cross_dr_id | array | Cross-referral/opinion doctor selections. Empty here. This is not the roster of doctors connected to the audio session. |
admission_dr_id | array | Admission-referral doctor selections. Empty here. This does not identify every doctor contributing to the consultation. |
followup_date | null | Structured follow-up appointment date. null means no date is supplied, even though follow_up contains review advice. |
followup_time | string | Structured follow-up time, supplied as 00:00. Without a date this does not establish a midnight appointment. |
bp_apparatus_required | object | Dedicated current-value object for the BP/cardiology table: bp, hba1c, ldl, and basic_activity. All are null in this response; the object name does not make its children boolean equipment flags. |
Every field in assessment[]
Two investigation objects are supplied: MRI and Ultrasound scan. Each has 12 keys. Null template metadata does not remove the test name or doctor attribution.
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
assessment_template | null | Investigation-template metadata. null in both rows; the sample does not establish a populated structure. |
template_tests | string | Investigation/test name. The two values are MRI and Ultrasound scan. |
template_id | null | Investigation-template identifier when available. null in both rows. |
template_type | null | Template classification when available. null in both rows; no allowed non-null values are established by this sample. |
hospital_id | null | Hospital identifier attached to this investigation row. null in both rows; use the session/envelope context separately. |
remarks | string | Investigation remarks or preparation instructions. Empty text in both rows. |
active_from | null | Start of the investigation entry?s active period, when supplied. null in both rows; no date-format claim is made from these null values. |
active_to | null | End of the investigation entry?s active period, when supplied. null in both rows. |
is_active | boolean | Activity flag for the investigation entry. true in both rows; this is not a completed-test or test-result flag. |
doctor_id | string | Internal CareScribe doctor identifier. Supplied as the string "143" in each row; allData.doctor_id is the number 143. Keep the returned representation when forwarding the payload. |
practitioner_id | string | External/hospital practitioner identifier associated with this row. Supplied as "1001". Different from source_id, which identifies an audio connection. |
doctor_name | string | Doctor display name associated with this row. This sample uses Dr Ragul Palanisamy. Use identifiers for matching rather than the name. |
Every field in medication_templates[]
The two medication objects contain 28 keys each. Preserve row-specific schedules, quantities, dates, and attribution.
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
medication_name | string | Formatted/display medication name. The sample contains (EMESET 2MG TABLET) and THYROXINE SODIUM 25MCG (THYRONORM 25MCG TABLET). |
medication_type | string | Dosage form. Tablet in both rows. |
dosage | string | Dose/strength text as supplied: 2 mg and 25 mcg. Retain alongside dosage_value and unit; do not derive an administration amount from strength alone. |
route | string | Administration route. Oral in both rows. |
frequency_morning | string | Morning schedule slot. String "1" in both rows; preserve as a string rather than a boolean. |
frequency_afternoon | string | Afternoon schedule slot. String "0" in both rows. |
frequency_evening | string | Evening schedule slot. String "0" in both rows. |
frequency_night | string | Night schedule slot. String "1" for Emeset and "0" for Thyronorm. Slot values can carry amount/unit text in other responses. |
duration | string | Treatment-duration text. "3 days" for Emeset; empty for Thyronorm, meaning no duration is supplied in that row. |
instructions | string | Additional administration instructions. "after food" for Emeset; empty for Thyronorm. |
when_to_take | string | Meal-related timing. "after food" for Emeset; empty for Thyronorm. Separate from time-of-day slots. |
vaccine | boolean | Whether this is a vaccine row. false for both. |
is_stat | boolean | Immediate/stat-dose flag. false for both. |
is_once_only | boolean | One-time-dose flag. false for both. |
is_sos | boolean | As-needed/SOS flag. false for both. |
quantity | number | null | Supplied dispensing quantity. Number 6 for Emeset; null for Thyronorm. Do not substitute zero for the null quantity. |
medication_start_date | string | Prescription start date in this sample: 11/11/2026 (11 November 2026), using day/month/year. |
medication_end_date | string | Prescription end date: 13/11/2026 for Emeset; empty text for Thyronorm. Keep an unspecified end date distinct from a supplied date. |
doctor_id | string | Internal CareScribe doctor identifier. Supplied as the string "143" in each row; allData.doctor_id is the number 143. Keep the returned representation when forwarding the payload. |
actual_medication_name | string | Retained original/acquired name used in editing and correction workflows: emeset 2mg tablet and Thyronorm. |
auto_correct | boolean | Medication-correction/editor metadata. false for both; this alone does not establish clinical verification. |
brand_name | string | Structured brand/product name: emeset 2mg tablet and THYRONORM 25MCG TABLET. |
generic_name | string | Structured generic ingredient name. Empty for Emeset and THYROXINE SODIUM 25MCG for Thyronorm. Empty does not mean no active ingredient exists. |
med_from_llm | boolean | Medication-list/review flag used for editor highlighting. true for Emeset and false for Thyronorm. The existing reference describes true as a medicine outside the medication list requiring doctor review. |
dosage_value | string | Numeric portion of the dosage, returned as a string: "2" and "25". Used together with unit. |
unit | string | Unit for dosage_value: mg and mcg. Preserve the distinction between milligrams and micrograms. |
practitioner_id | string | External/hospital practitioner identifier associated with this row. Supplied as "1001". Different from source_id, which identifies an audio connection. |
doctor_name | string | Doctor display name associated with this row. This sample uses Dr Ragul Palanisamy. Use identifiers for matching rather than the name. |
Every field in blood_borne
All seven values are null. This sample does not establish the non-null result schema or any positive/negative finding.
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
hiv | null | Human immunodeficiency virus-related status/result metadata. |
hcv | null | Hepatitis C virus-related status/result metadata. |
hbv | null | Hepatitis B virus-related status/result metadata. |
syphilis | null | Syphilis-related status/result metadata. |
htlv | null | Human T-lymphotropic virus-related status/result metadata. |
malaria | null | Malaria-related status/result metadata. |
cmv | null | Cytomegalovirus-related status/result metadata. |
Every field in bp_apparatus_required
This is a dedicated current-value object, separate from vitals[]. The form helper reads strings and finite numbers from this object and shows null values as empty cells. It does not fill these values from vitals or top-level aliases.
| Key | Type in sample | Purpose and sample meaning |
|---|---|---|
bp | null | Blood-pressure current value for the dedicated table. null here, so no measurement is supplied. |
hba1c | null | HbA1c current value for the dedicated table. null here; no value or unit is supplied by this sample. |
ldl | null | LDL-cholesterol current value for the dedicated table. null here; no value or unit is supplied by this sample. |
basic_activity | null | Daily physical-activity current value for the dedicated table. null here; no activity duration is supplied. |
Arrays with no supplied rows
The sample has empty drug_allergies, food_allergies, other_allergies, vitals, icd_diagnosis, cross_dr_id, and admission_dr_id arrays. There are no child keys to enumerate from these sample arrays. Empty arrays do not establish negative clinical findings.
The existing reference documents the form-supported fields when these arrays are populated: vitals, ICD diagnoses, referrals, and allergies. Those definitions describe supported form data, not additional values present in this response.
Full parsed processedText sample
This is the clinical object after the second JSON parse. The integration guide contains the full outer response with the escaped string.
Show all decoded clinical fields
{
"chief_complaints": "**Chief Complaints:** **Abdominal pain** with headache, **Abdominal pain** for 2 days.",
"history_of_presenting_illness": "**History of Presenting Illness:** Patient reports experiencing **abdominal pain** associated with **headache (migraine-like)**, fatigue, dehydration, and nausea/vomiting sensations. No cold or cough reported. Abdominal pain has been persistent for the past 2 days; previously occurred once weekly. Headaches occur intermittently with abdominal pain, sometimes accompanied by vomiting, though no active vomiting currently.",
"past_medical_history": "**Past Medical History:** **Status post Appendectomy** 3 years ago at Leo Hospital, **Hypertension** for 2 years on medication, **Hypothyroidism** on treatment.",
"past_medications": "**Past Medications:** Antihypertensive medication, **Tab. Dolo 650 mg** weekly once.",
"personal_history": "**Personal History:** Patient has prolonged sitting and reduced physical mobility. Works in IT with daily screen time of 12 hours on laptop and 2 hours on phone (14–16 hours total), with no walking or physical exercise routine.",
"obstetric_history": "**Obstetric History:** ",
"examination_findings": "**Examination Findings:** Patient is noted to have **obesity**.",
"procedure": "**Procedure:** ",
"investigations": "**Investigations:** ",
"diagnosis": "**Diagnosis:** **Abdominal pain, Migraine, Dehydration, Obesity**",
"recommendations": "**Recommendations:** Advised to take a 5-minute walk every 30 minutes to maintain body mobility. Recommended morning walking, mild exercises, and 20–30 minutes of daily cardio.",
"diet": "**Diet:** Advised to take ORS sachet mixed in 150 ml of warm water to maintain hydration. Advised to consume a high-fiber diet, plenty of vegetables, and avoid oily foods.",
"follow_up": "**Follow-up:** Review after 1 week.",
"plan": "**Plan:** Advised to undergo an MRI scan and an ultrasound scan for evaluation.",
"continue_current_medications": false,
"omit_medications": null,
"assessment": [
{
"assessment_template": null,
"template_tests": "MRI",
"template_id": null,
"template_type": null,
"hospital_id": null,
"remarks": "",
"active_from": null,
"active_to": null,
"is_active": true,
"doctor_id": "143",
"practitioner_id": "1001",
"doctor_name": "Dr Ragul Palanisamy"
},
{
"assessment_template": null,
"template_tests": "Ultrasound scan",
"template_id": null,
"template_type": null,
"hospital_id": null,
"remarks": "",
"active_from": null,
"active_to": null,
"is_active": true,
"doctor_id": "143",
"practitioner_id": "1001",
"doctor_name": "Dr Ragul Palanisamy"
}
],
"medication_templates": [
{
"medication_name": "(EMESET 2MG TABLET)",
"medication_type": "Tablet",
"dosage": "2 mg",
"route": "Oral",
"frequency_morning": "1",
"frequency_afternoon": "0",
"frequency_evening": "0",
"frequency_night": "1",
"duration": "3 days",
"instructions": "after food",
"when_to_take": "after food",
"vaccine": false,
"is_stat": false,
"is_once_only": false,
"is_sos": false,
"quantity": 6,
"medication_start_date": "11/11/2026",
"medication_end_date": "13/11/2026",
"doctor_id": "143",
"actual_medication_name": "emeset 2mg tablet",
"auto_correct": false,
"brand_name": "emeset 2mg tablet",
"generic_name": "",
"med_from_llm": true,
"dosage_value": "2",
"unit": "mg",
"practitioner_id": "1001",
"doctor_name": "Dr Ragul Palanisamy"
},
{
"medication_name": "THYROXINE SODIUM 25MCG (THYRONORM 25MCG TABLET)",
"medication_type": "Tablet",
"dosage": "25 mcg",
"route": "Oral",
"frequency_morning": "1",
"frequency_afternoon": "0",
"frequency_evening": "0",
"frequency_night": "0",
"duration": "",
"instructions": "",
"when_to_take": "",
"vaccine": false,
"is_stat": false,
"is_once_only": false,
"is_sos": false,
"quantity": null,
"medication_start_date": "11/11/2026",
"medication_end_date": "",
"doctor_id": "143",
"actual_medication_name": "Thyronorm",
"auto_correct": false,
"brand_name": "THYRONORM 25MCG TABLET",
"generic_name": "THYROXINE SODIUM 25MCG",
"med_from_llm": false,
"dosage_value": "25",
"unit": "mcg",
"practitioner_id": "1001",
"doctor_name": "Dr Ragul Palanisamy"
}
],
"blood_borne": {
"hiv": null,
"hcv": null,
"hbv": null,
"syphilis": null,
"htlv": null,
"malaria": null,
"cmv": null
},
"drug_allergies": [],
"food_allergies": [],
"other_allergies": [],
"vitals": [],
"detected_language": "**detected_language:** ta",
"family_history_notes": "**Family History:** ",
"additional_response": "",
"phonetic_uri": "gs://medscribe-dev/9/GENERAL AND LAPAROSCOPIC SURGERY/153/medication_autocorrect.csv",
"icd_diagnosis": [],
"diagnosis_free_text": "",
"cross_dr_id": [],
"admission_dr_id": [],
"followup_date": null,
"followup_time": "00:00",
"bp_apparatus_required": {
"bp": null,
"hba1c": null,
"ldl": null,
"basic_activity": null
}
}Implementation references
The layout follows the original outpatient reference. The multi-source init and per-source metadata are implemented in Backend/src/transports/audio-websocket.ts. Dedicated BP table value handling is defined in Frontend/src/pages/OPD/forms/doctor/forms/OutpatientDataTemplate/bpApparatus.ts. Medication editing and investigation-template handling live in the adjacent OutpatientMedicationEditorSection.tsx, medicationNameChanges.ts, and OutpatientDataTemplate.tsx modules.