OnMedicalReportFinished


Triggered when a structured medical report finishes processing.

It covers reports produced inside the platform and those produced through SOFT Integration. The latter carry two extra fields, origin and consultationMetadata, described below.

Payload

{
  "eventName": "OnMedicalReportFinished",
  "organizationId": "1111111",
  "userId": "1111111",
  "timestamp": "2026-03-31T19:06:58.667Z",
  "consultationSessionId": "medical-consultation-u1234-1234567890-abc123",
  "medicalReport": {
    "fields": [
      {
        "id": "3ef6969c-c62d-43fb-9cf6-7d270f1cd4a1",
        "customHistory": [],
        "customContext": "",
        "templateId": "285b5a84-9a1e-4b3c-9a3f-0711ba7bc4a7",
        "createdAt": 1776123550031,
        "customType": "string",
        "order": 1,
        "enumerableSelectionOption": "SINGLE",
        "customEnumerableOptions": [],
        "customValue": "mock value.",
        "customName": "mock value",
        "customDescription": "mock value",
        "updatedAt": 1776123550031
      },
      {
        "customHistory": [],
        "customContext": "",
        "templateId": "285b5a84-9a1e-4b3c-9a3f-0711ba7bc4a7",
        "customType": "string",
        "id": "5c14f3f4-8d43-4307-b7ca-f1802ffe4363",
        "enumerableSelectionOption": "SINGLE",
        "customEnumerableOptions": [],
        "createdAt": 1776123559943,
        "customValue": "mock value.",
        "customName": "mock value",
        "updatedAt": 1776123559943,
        "customDescription": "mock value",
        "order": 2
      }
    ],
    "summary": "Consultation summary...",
    "createdAt": 1711900000000
  },
  "requestSignature": "abcdef1234567890"
}

Payload from a SOFT Integration consultation

Same event and same structure, with origin and consultationMetadata added. Here consultationSessionId is the requestId you generated when requesting the signature:

{
  "eventName": "OnMedicalReportFinished",
  "organizationId": "1111111",
  "userId": "1111111",
  "timestamp": "2026-03-31T19:06:58.667Z",
  "consultationSessionId": "2222-2222-2222-2222",
  "origin": "SOFT_INTEGRATION",
  "consultationMetadata": {
    "patientId": "PAT-123-56",
    "hcId": "1234567"
  },
  "medicalReport": {
    "fields": [],
    "summary": "Consultation summary...",
    "createdAt": 1711900000000
  },
  "requestSignature": "abcdef1234567890"
}
consultationMetadata is whatever your system sent when generating the signature, returned untouched. It is absent if you sent none, so treat both fields as optional.

Field description

FieldTypeRequiredDescription
eventNamestringYesAlways "OnMedicalReportFinished"
organizationIdstringYesOrganization ID
userIdstringNoUser ID
timestampstringYesISO 8601 UTC
consultationSessionIdstringNoConsultation session ID. In SOFT Integration it is the requestId you generated.
originstringNoOnly for SOFT Integration consultations. Always "SOFT_INTEGRATION".
consultationMetadataobjectNoOnly for SOFT Integration consultations. The metadata you sent when generating the signature, returned untouched. Absent if you sent none.
medicalReportobjectYesStructured report object (see below)
medicalReport.fieldsarrayYesReport field entries (see field structure below)
medicalReport.summarystringYesFree-text report summary
medicalReport.createdAtnumberYesUnix timestamp (ms) of creation
requestSignaturestringNoHMAC-SHA256 in Base64. Present if the organization has credentials configured.

medicalReport.fields[] structure

FieldTypeDescription
idstringUnique field identifier (UUID)
templateIdstringTemplate identifier this field belongs to (UUID)
customNamestringDisplay name of the field
customDescriptionstringDescription of the field
customValuestringThe generated value/content for this field
customTypestringData type of the field (e.g., "string")
customContextstringAdditional context for the field
customHistoryarrayHistory of previous values
customEnumerableOptionsarrayAvailable options for enumerable fields
enumerableSelectionOptionstringSelection mode for enumerable fields (e.g., "SINGLE")
ordernumberDisplay order of the field
createdAtnumberUnix timestamp (ms) of creation
updatedAtnumberUnix timestamp (ms) of last update

Signature string

The medicalReport object is serialized as JSON. The fields are signed in the following order:

organizationId|userId|timestamp|consultationSessionId|{"fields":[...],"summary":"...","createdAt":...}|API_KEY

The optional fields userId and consultationSessionId are left out of the payload when they have no value. If either is missing, sign it as "" in its position.

SOFT Integration signs two extra values. When origin is "SOFT_INTEGRATION", the signature uses this order instead:
organizationId|userId|timestamp|consultationSessionId|origin|{"patientId":"..."}|{"fields":[...],...}|API_KEY
Choose the order by origin, and pass it to the same function as the general one. The optional fields origin and consultationMetadata are left out of the payload when they have no value (consultationMetadata is absent when you sent no metadata); if consultationMetadata is missing, sign it as "" in its position.