depending on the amount of data this can take some time to crunch together, so results are sent through a webhook message:
patient consolidated data
You should expect to get more than one Webhook message per patient per request (document query and/or consolidated data).
To enable this integration approach with Metriport, and for some prerequesite reading to understand
how the Webhook flow works, see our Webhooks guide.
When you receive a webhook message, you should respond
with a 200 status code within 4 seconds. We recommend
processing the webhook request asynchronously.
You can pass metadata to endpoints that support webhooks, and you will receive the meta.data field of the webhook request.
Metadata holds a record of up to 50 custom string key-value pairs. Key names can be up to 40 characters long and values up to 500 characters long. You may use this to attach whatever metadata is relevant for your use-case - for example, external IDs.
Below is an example payload you could send in the request body of one of those endpoints and how you would use the sdk:
These are messages you can expect to receive in the following scenarios:
When queried documents have completed
downloading, the message type will be medical.document-download, and at this point
you’ll be able to download the raw files;
Then, if the downloaded documents contained C-CDA/XML files, when the conversion to FHIR has
completed, the message type will be medical.document-conversion, and at this point
you’ll be able to query for patient consolidated data
in FHIR-compliant format.
Note that the webhooks will only contain updates for new
data fetched in the current document query.
The type of the Medical API webhook data message. Can be one of: medical.document-download, medical.document-conversion,
medical.consolidated-data, medical.document-bulk-download-urls.
A Patient’s consolidated data is the result of converting all C-CDA documents into deduplicated and standardized FHIR, as well as other FHIR data your application
has inserted into Metriport’s FHIR repository.
This data can be retrieved in either FHIR JSON format, or a rendered PDF or HTML Medical Record Summary.
Patients can have a large amount of data, so in order to have access to a Patient’s data:
When the result is ready, we’ll send a webhook message with the results (below).
Note that inside the Bundle you’ll find a DocumentReference resource with the first item in the content array containing
an attachment with a url which can be used to download the data.
If there was no data available for the Patient, the
Bundle will be empty (the entry array will have no
elements).
The start date (inclusive) for which to filter returned resources - formatted YYYY-MM-DD as per
ISO 8601. If not provided, no start date filter will be applied.
The end date (inclusive) for which to filter returned resources - formatted YYYY-MM-DD as per
ISO 8601. If not provided, no end date filter will be applied.
A FHIR Bundle containing a DocumentReference resource with the first item in the content array containing
an attachment with a url which can be used to download the FHIR JSON payload - the url is valid for 3 minutes.
During the processing of a Bulk Patient Create,
the Metriport API sends Webhook messages of type medical.bulk-patient-create to indicate the status
update and provide relevant information.
You can expect to get two messages of this type for each Bulk Patient Create, with the status
being the main difference between each:
First message:
processing: the CSV file has been uploaded and is being processed;
Second message - one of:
completed: the bulk create is completed - includes the result CSV file;
failed: the bulk create failed (likely due to the uploaded file being invalid).
The URL will only be valid for 180 seconds (3 minutes).
The message medical.bulk-patient-create with status completed includes a URL in the result
field, which you can use to download the result of the Bulk Patient Create.
The URL will only be valid for 180 seconds (3 minutes).
The file is based on the same format as the
input CSV, with the
following additional columns:
If you want to download all of a patient’s documents, especially when they have a large volume of documents, you can start a Bulk Get Document URL query. We’ll send a webhook message with all the downloadable URLs for all the patient’s documents.
You can use the value of the url property in the returned documents objects to download the files.
The URLs will only be valid for 600 seconds (10 minutes).