import { MetriportMedicalApi } from "@metriport/api-sdk";
import axios from "axios";
const metriport = new MetriportMedicalApi("YOUR_API_KEY");
const docRef: Partial<DocumentReference> = {
description: "Third degree wrist burn treatment",
type: {
text: "Burn management Hospital Progress note",
coding: [
{
code: "100556-0",
system: "http://loinc.org",
display: "Burn management Hospital Progress note",
},
],
},
context: {
period: {
start: "2023-10-10T14:14:17Z",
},
facilityType: {
text: "My Clinic Name - Acute Care",
},
},
};
const resp = await metriport.createDocumentReference("018a80c4-292a-7486-a1234-76yuhe23yu14", docRef);
// Upload the document using this url in a PUT request, something along these lines for a PDF:
// const fileContent = <medical-document-document-contents>;
// await axios.put(resp.uploadUrl, fileContent, {
// headers: {
// "Content-Length": <size-in-bytes>,
// "Content-Type": "application/pdf",
// },
// });