A package to get started using Metriport - universal and open-source API for healthcare data.
Check out the documentation at https://docs.metriport.com
npm install --save @metriport/api-sdk
# or
yarn add @metriport-api-sdk
import { MetriportClient } from "@metriport/api-sdk";
const metriport = new MetriportClient({
apiKey: 'YOUR_API_KEY',
});
const response = await metriport.medical.organization.create({
type: Metriport.OrgType.PostAcuteCare,
name: "Metriport Inc.",
location: {
addressLine1: "2261 Market Street",
addressLine2: "#4818",
city: "San Francisco",
state: Metriport.UsState.CA,
zip: "94114",
country: "USA",
}
});
console.log('Organization creted at Metriport:', response);
// ...
const patient = await metriport.medical.patient.get("patientId");
When the API returns a non-success status code (4xx or 5xx response), a subclass of MetriportError will be thrown:
import { MetriportError } from "@metriport/api-sdk";
try {
await metriport.medical.patients.get("patient-id");
} catch (err) {
if (err instanceof MetriportError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
}
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json
file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
,▄,
▄▓███▌
▄▀╙ ▀▓▀ ²▄
▄└ ╙▌
,▀ ╨▄
▌ ║
▌
▌
,▓██▄ ╔███▄
╙███▌ ▀███▀
▀▄
▀╗▄ ,▄
'╙▀▀▀▀▀╙''
by Metriport Inc.