Skip to content

Data Models

This page describes the structure of every object returned by the HappyPathology API.


All dates in the Medical Document are represented as Unix (UTC) timestamps. Some are in Seconds, some are in Nanoseconds. Please reference the individual field’s documentation.

For Example:

Unix Seconds (UTC)

"date_of_birth": 1772581386

Unix Nanoseconds (UTC)

"created_timestamp": 1772581386000000000
"updated_timestamp": 1772581386000000000

The API uses standard HTTP status codes for errors.


Every response from the API wraps its payload in the same envelope:

FieldTypeDescription
statusnumberHTTP status code mirrored in the body
resultsobjectThe response payload (shape varies by endpoint)
debug_info.deltastringServer-side request duration
debug_info.versionstringAPI build version
{
"status": 200,
"results": { },
"debug_info": {
"delta": "102.707189ms",
"version": "happy_api.549.main.02ec7cd"
}
}

Returned inside results.upload_urls when creating a source. Each entry corresponds to one file.

FieldTypeDescription
urlstringSigned GCS URL — PUT your file here directly
file_namestringThe original file name you provided
{
"url": "https://storage.googleapis.com/...",
"file_name": "PatientCases.pdf"
}

Represents a batch of uploaded files being processed into cases.

FieldTypeDescription
idstringSource ID — reference this when polling status and in Step 4
statusstringCurrent processing state (this is NOT the http status code) — see Source Status
expected_file_countnumberNumber of files declared when the source was created
uploaded_file_countnumberNumber of files received so far
case_idsstring[] or nullIDs of extracted cases — populated when status is complete
created_timestampnumberWhen this source was originally created (Unix nanoseconds)
updated_timestampnumberWhen this source record was last modified (Unix nanoseconds)
account_idstringYour account ID
expiration_unix_timenumberWhen this source and all related data will be deleted (Unix Seconds)
original_file_namesmap[string]stringA map of the received files’ internal HappyPathology filepath to their original filenames
ValueMeaning
pending_uploadWaiting for files to arrive
processingFiles received, source is being created
completeSource created — case_ids is returned in the response
failedSource processing failed. You will need to start over from the beginning (create a new source)

Represents a single patient’s case extracted from a source’s document.

FieldTypeDescription
idstringCase ID
source_idstringThe source this case was extracted from
account_idstringYour account ID
statusstringCurrent processing state (this is NOT the http status code)
created_timestampnumberWhen this Case was originally created (Unix nanoseconds)
updated_timestampnumberWhen this Case was last modified (Unix nanoseconds)
expiration_unix_timenumberWhen this case and all its related data will be deleted (Unix seconds)
secure_file_urlsmap[string]stringA map of temporary URLs to download the files that were used to create this case. The URLs expire after 5 minutes.
medical_datamap[string]objectExtracted medical documents — see Medical Document
ValueMeaning
createdWaiting for system to begin processing
processingThe Case is in the middle of processing
completeThe case processing is done (Extracted JSON contents will be available)
failedThe case processing is done, but it failed. You will need to start over from the beginning (create a new source)

HappyPathology intelligently scans your files to determine related pages of information. Then, it groups these pages into “Medical Documents” (For example, an Lab Order Form and a CBC Report would result in two Medical Documents). Lastly, it extracts data from the Medical Document’s pages and stores the structured data.

The medical_data object is a map of all Medical Documents and their data.

Each Medical Document is keyed by a document ID (a ULID). A medical document’s data is split into two categories: patient_info and medical_tests.

The Medical Document’s structure looks like this:

FieldTypeDescription
patient_infoobjectPatient demographic, billing, and clinical history extracted from this document
medical_testsArray<object>Distinct Medical orders/requisitions, and Medical Test Results
tagsArray<string>Document tags used to identify special documents (e.g. "precipio_requisition_form")

Inside patient_info and each item in medical_tests, each field the values can be in either of the following formats:

FormatDescription
stringText value
numberint64
Array<string>Array of text values
medical_test_formatObject with value, unit, and reference range

Medical Test Format

Medical Test Format is an object used to represent medical test results, such as CBC tests. The struct has the following fields:

FieldTypeDescription
valuenumberMeasured value
measurement_unitstringUnit of measurement, e.g. "K/uL", "g/dL", "%"
range.minnumberLower bound of the reference range
range.maxnumberUpper bound of the reference range
{
"value": 10.14,
"measurement_unit": "K/uL",
"range": {
"min": 4,
"max": 11
}
}
{
"patient_info": {
"patient_address_1": "123 main rd",
"patient_city": "fairfax",
"patient_clinical_data": "chronic pancreatitis / leukopenia",
"patient_dob": 953575425,
"patient_first_name": "bob",
"patient_last_name": "smith",
"patient_phone_home": "4016134421",
"patient_sex": "male",
"patient_state": "va",
"patient_zip": "22030"
},
"medical_tests": [
{
"specimen_collection_date": 1658760300,
"specimen_ordering_facility": "good care llc",
"specimen_ordering_physician": "dr. mary zhao",
"specimen_performing_lab": "labcorp virginia",
"specimen_received_date": 1658793600,
"specimen_type": "peripheral blood"
}
],
}

This is a comprehensive list of fields that are extracted and placed into the patient_info object.

FieldTypeDescription
patient_first_namestring
patient_last_namestring
patient_middle_namestring
patient_suffixstring
patient_mrnstringMedical record number
patient_idstringThis is not the MRN. Labs often have their own unique ID for the patient
patient_dobnumberUnix Seconds timestamp
patient_ssnstringSocial Security Number or a subset of it
patient_sexstring
patient_genderstring
patient_address_1string
patient_address_2string
patient_citystring
patient_statestring
patient_zipstring
patient_countrystring
patient_phone_homestring
patient_phone_mobilestring
FieldTypeDescription
patient_clinical_datastringA summary of the patient’s signs, symptoms, clinical impressions, and prior diagnosis mentioned in the document
patient_icd10_codesArray<string>Patient’s listed ICD10 codes in the document (Does not generate/infer ICD10 Codes)
FieldTypeDescription
document_printed_datenumberWhen the document was printed or downloaded (Unix seconds)
hp_metadataobjectMetadata about the extraction process — see Flags

Precipio Patient and Physician Information

Section titled “Precipio Patient and Physician Information”
FieldTypeDescription
precipio_patient_next_appointment_datetimenumberUnix seconds
precipio_patient_clinical_statusstring
precipio_patient_clinical_indicationsArray<string>
precipio_copy_physician_namestring

This is a comprehensive list of fields that are extracted and placed into the medical_tests objects.

FieldTypeDescription
specimen_typestringWhat type of sample is the specimen (Blood, Bone Marrow, Etc)
specimen_ordering_facilitystring
specimen_ordering_physicianstring
specimen_performing_labstring
specimen_collection_datenumberThe date the specimen was extracted from the Patient (Unix seconds)
specimen_received_datenumberThe date the specimen was received by the lab (Unix seconds)
specimen_reported_datenumberThe date the test was performed on the specimen (Unix seconds)
FieldTypeDescription
rbc_countmedical_test_format
wbc_countmedical_test_format
hemoglobinmedical_test_format
hematocritmedical_test_format
mcvmedical_test_format
mchmedical_test_format
mchcmedical_test_format
rdwmedical_test_format
platelet_countmedical_test_format
mpvmedical_test_format
neutrophils_percentmedical_test_format
lymphocytes_percentmedical_test_format
monocytes_percentmedical_test_format
eosinophils_percentmedical_test_format
basophils_percentmedical_test_format
absolute_neutrophilmedical_test_format
absolute_lymphocytemedical_test_format
absolute_monocytemedical_test_format
absolute_eosinophilmedical_test_format
absolute_basophilmedical_test_format
immature_granulocyte_percentmedical_test_format
absolute_immature_granulocytemedical_test_format
nrbc_countmedical_test_format
blast_cell_percentmedical_test_format
promyelocytes_percentmedical_test_format
absolute_promyelocytesmedical_test_format
myelocytes_percentmedical_test_format
absolute_myelocytesmedical_test_format
metamyelocytes_percentmedical_test_format
absolute_metamyelocytesmedical_test_format
bands_percentmedical_test_format
absolute_bandsmedical_test_format
segmented_neutrophils_percentmedical_test_format
reticulocytes_percentmedical_test_format
absolute_reticulocytesmedical_test_format
immature_reticulocyte_fraction_percentmedical_test_format
atypical_lymphocytes_percentmedical_test_format
absolute_atypical_lymphocytesmedical_test_format
plasma_cell_countmedical_test_format
normoblasts_percentmedical_test_format
unclassified_cells_percentmedical_test_format
absolute_unclassified_cellsmedical_test_format
FieldTypeDescription
precipio_test_requestedstring
precipio_test_idstring
FieldTypeDescription
hp_metadataobjectMetadata about the extraction process — see Flags

Inside patient_info and each item in medical_tests, there can be an optional hp_metadata object that contains flags about the extracted data. This object has the following structure:

FieldTypeDescription
keystringThe name of the patient field or test field that is being flagged
valuestring[]An array of flag values, can be uncertain_value, uncertain_range or uncertain_measurement_unit

For example the following is a snippet of a medicalDocument with flags:

...
medical_data": {
"01KPDPTD2BWT40T5BEP3QK786R": {
"patient_info": {
"hp_metadata": {
"patient_account_id": [
"uncertain_value"
],
"patient_gender": [
"uncertain_value"
]
},
"patient_account_id": "3145142",
"patient_address_1": "123 Main street",
"patient_city": "Anytown",
"patient_country": "usa",
"patient_dob": 12345678,
"patient_first_name": "Jane",
"patient_gender": "female",
"patient_id": "123456",
"patient_last_name": "Dorian",
},
"medical_tests": [
{
"hp_metadata": {
"specimen_ordering_facility": [
"uncertain_value"
],
"specimen_ordering_physician": [
"uncertain_value"
]
},
"specimen_collection_date": 1770768000,
"specimen_ordering_facility": "oncology laboratories",
"specimen_ordering_physician": "jim dale md",
"specimen_type": "peripheral blood"
},
]
},
...