Documents API

Overview

The Documents API is used to manage documents that are linked to patients within Particle Health's Master Patient Index.

Documents can be created, updated, retrieved, and deleted. All documents can also be listed for a given patient. The networks ask for C-CDA documents, but the actual format of the document is typically flexible (typically in XML, which is the format that most EMRs use, but PDFs are also acceptable).

Important Notes

  • Each document requires a patient_id, and this patient_id must already exist in Particle's Master Patient Index before a document can be successfully uploaded. See Patients API for more information.
  • Details on acceptable document types can be found in the FAQs.
  • Successful requests will return a 200 OK, but you can also use a GET request to retrieve a document and verify that it was uploaded successfully.

API Functions

Document Create and Update

Description:Creates a new document and stores it in Particle Health's system, or updates an existing document.
Path:api/v1/documents
Method:POST
Content-Type Header:"Content-Type: multipart/form-data"

Required Fields

The metadata part must be a JSON string with the following fields:

FieldRequiredFormat / Constraints
patient_idYesYour external patient ID. Must already exist in Particle's MPI (see Patients API). Max 200 chars.
document_idYesYour external document ID. Max 200 chars.
typeYesCLINICAL or CONSENT
titleYesHuman-readable document title. Max 128 chars.
mime_typeYesMust be a supported MIME type (e.g. application/xml, application/pdf, text/xml). See Supported MIME Types below.
creation_timeYesRFC3339 format. Cannot be a future date.
format_codeYesIHE format code. Max 100 chars. See Code Value Sets.
type_codeYesLOINC code. Format: 4-9 digits, dash, 1 digit (e.g. 11369-6). Max 100 chars.
class_codeYesLOINC code. Same format as type_code (e.g. 11506-3). Max 50 chars.
practice_setting_codeYesSNOMED code (e.g. 394733009). Defaults to 394733009 if omitted. Max 50 chars.
confidentiality_codeNoIHE confidentiality code. Defaults to N (Normal). See valid values below.
healthcare_facility_type_codeNoSNOMED facility code. Defaults to 394777002 if omitted. Max 50 chars.
service_start_timeNoRFC3339 format. Cannot be a future date. Must be before service_stop_time.
service_stop_timeNoRFC3339 format. Cannot be a future date.

Valid confidentiality_code Values

CodeMeaning
NNormal (default)
RRestricted
VVery Restricted
LLow
MModerate
UUnrestricted
ETHSubstance Abuse Related
HIVHIV Related
PSYPsychiatry Related
SDVSexual and Domestic Violence Related

Supported MIME Types

application/xml, application/pdf, application/json, text/xml, text/plain, text/html, text/csv, image/jpeg, image/png, image/tiff, image/gif, application/dicom, application/x-hl7, application/msword, application/vnd.ms-excel, multipart/related

Multipart File - “file” - required
Multipart Field - “metadata” (JSON string) - required
{
    “patient_id”: “examplepatientid1”,
    “document_id”: “encounter_summary123”,
    “type”: “CLINICAL”,
    “title”: “History_Of_Immunization_Testingson_20200304.xml”,
    “mime_type”: “application/xml”,
    “creation_time”: “2020-01-01T12:30:00Z”,
    “format_code”: “urn:ihe:pcc:xphr:2007”,
    “confidentiality_code”: “N”,
    “class_code”: “11369-6”,
    “type_code”: “11369-6”,
    “healthcare_facility_type_code”: “394777002”,
    “practice_setting_code”: “394733009”,
    “service_start_time”: “2020-01-01T00:00:00+05:00”,
    “service_stop_time”: “2020-01-04T00:00:00-07:00”
}

Example Request

curl -X POST “https://api.particlehealth.com/api/v1/documents” \
-H "Authorization: $AuthToken" \
-F "metadata={
    \"patient_id\": \"{patient_id}\",
    \"document_id\": \"encounter_summary123\", 
    \"type\": \"CLINICAL\", 
    \"title\":\"Encounter_Summary_Test.xml\", 
    \"mime_type\":\"application/xml\", 
    \"creation_time\": \"2020-01-01T12:30:00Z\", 
    \"format_code\": \"urn:ihe:pcc:xphr:2007\", 
    \"confidentiality_code\": \"N\", 
    \"class_code\": \"11369-6\", 
    \"type_code\": \"11369-6\", 
    \"healthcare_facility_type_code\": \"394777002\", 
    \"practice_setting_code\": \"394733009\", 
    \"service_start_time\": \"2020-01-01T00:00:00+05:00\", 
    \"service_stop_time\": \"2020-01-04T00:00:00-07:00\"
}" \
-F "file=@$PathToFile"   

Model Response

{
    "patient_id": "examplepatientid1", 
    "document_id": "encounter_summary123", 
    "type": "CLINICAL", 
    "title":"Encounter_Summary_Test.xml", 
    "mime_type":"application/xml", 
    "creation_time": "2020-01-01T12:30:00Z", 
    "format_code": "urn:ihe:pcc:xphr:2007", 
    "confidentiality_code": "N", 
    "class_code": "11369-6", 
    "type_code": "11369-6", 
    "healthcare_facility_type_code": "394777002", 
    "practice_setting_code": "394733009", 
    "service_start_time": "2020-01-01T00:00:00+05:00", 
    "service_stop_time": "2020-01-04T00:00:00-07:00"
}
📘

Note: Learn more about code sets in the response here.

Retrieve Posted Document

Description:Retrieves a specific document's metadata that your organization has uploaded to Particle Health. Can be used to verify that a document has been successfully uploaded.
Path:api/v1/documents/{document_id}
Method:GET

Example Request

curl -H “Authorization: $authToken” \
https://api.particlehealth.com/api/v1/documents/encounter_summary123

Response Model

{
	"patient_id": "examplepatientid1", 
	"document_id": "encounter_summary123", 
	"type": "CLINICAL", 
	"title":"Encounter_Summary_Test.xml", 
	"mime_type":"application/xml", 
	"creation_time": "2020-01-01T12:30:00Z", 
	"format_code": "urn:ihe:pcc:xphr:2007", 
	"confidentiality_code": "N", 
	"class_code": "11369-6", 
	"type_code": "11369-6", 
	"healthcare_facility_type_code": "394777002", 
	"practice_setting_code": "394733009", 
	"service_start_time": "2020-01-01T00:00:00+05:00", 
	"service_stop_time": "2020-01-04T00:00:00-07:00"
}

Delete Document

Description:Removes a document that your organization has uploaded to Particle Health.
Path:api/v1/documents/{document_id}
Method:DELETE

Example Request

curl -X DELETE -H “Authorization: $authToken” \
https://api.particlehealth.com/api/v1/documents/encounter_summary123

Model Response

“delete successful”

List Patient Documents

Description:Retrieves all documents that have been uploaded for a given patient.
Path:api/v1/documents/patient/{patient_id}
Method:GET

Example Request

curl -H “Authorization: $authToken” \
https://api.particlehealth.com/api/v1/documents/patient/`{patient_id}`

Model Response

 [ 
	{ Documents Model },
	{ Documents Model },
	{ Documents Model }
]

Code Value Sets

To enable systems to parse and handle documents successfully, all document metadata must include codes to identify the type, format, and content of the data that the document contains. The following value sets should be used wherever possible:

Code TypeDescriptionResource Link
Format CodeThe code specifying the technical format of the document. There is no value to default to, so this field is required.<https://build.fhir.org/ig/IHE/FormatCode/CodeSystem-formatcode.html>
Practice Setting CodeThe code specifying the clinical specialty where the act that resulted in the document was performed (e.g., Family Practice, Laboratory, Radiology). If no value is specified, this field will default to “394733009”, which corresponds to “Medical specialty--OTHER--NOT LISTED”<https://www.hl7.org/fhir/valueset-c80-practice-codes.html>
Healthcare Facility Type CodeThe code specifying the type of organizational setting of the clinical encounter during which the documented act occurred. If no value is specified, this field will default to “394777002”, which corresponds to “Health encounter site--NOT LISTED”.<https://www.hl7.org/fhir/valueset-c80-facilitycodes.html>
Class CodeThe code specifying the high-level category of document (e.g. Prescription, Discharge Summary, Report, etc.). There is no value to default to, so this field is required.<https://www.hl7.org/fhir/r4/valueset-document-classcodes.html>
Type CodeThe code specifying the precise type of document from the user perspective (e.g. LOINC code). There is no value to default to, so this field is required.<https://www.hl7.org/fhir/r4/valueset-doc-typecodes.html>
Confidentiality CodeThe code specifying the security classification of the document. If no value is specified, this field will default to ‘N’ for Normal.<https://terminology.hl7.org/2.1.0/CodeSystem-v3-Confidentiality.html>