SDK Methods

This article gives general information about the methods found in the Orchestrate SDK.

Supported APIs

The SDK contains methods for each of the operations in the following APIs:

Identity API is not currently supported.

As mentioned in Getting Started, the SDK supports JavaScript (including TypeScript) and Python.

SDK methods mirror the names of the operations, following language-specific conventions. For example:

  • Python: terminology.classify_condition() or convert.hl7_to_fhir_r4().
  • JavaScript: terminology.standardizeMedication() or convert.cdaToFhirR4()

Request and Response Objects

Each SDK method accepts a single request object and returns a single response object. The specific parameters within the request object will correspond to the URL segments, query parameters, and body parameters of the operation. Some examples are given below. Refer to the API documentation for each operation for details.

Accessing the Terminology API

For the Terminology API, the request object contains the body parameters and the response object contains the response fields.

For example, for Standardize Medication:

Standardize Medication (JavaScript)
await orchestrate.terminology.standardizeMedication({
      code: "861004",
      system: "RxNorm",
    });

    // Returns:
    {
      "coding": [
        {
          "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
          "code": "861004",
          "display": "metformin hydrochloride 1000 MG Oral Tablet"
        }
      ]
    }
await orchestrate.terminology.standardizeMedication({ code: "861004", system: "RxNorm", }); // Returns: { "coding": [ { "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "861004", "display": "metformin hydrochloride 1000 MG Oral Tablet" } ] }
Standardize Medication (Python)
orchestrate.terminology.standardize_medication(
        code="861004",
        system="RxNorm",
    )

    # Returns:

    {
        "coding": [
            {
                "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                "code": "861004",
                "display": "metformin hydrochloride 1000 MG Oral Tablet"
            }
        ]
    }
orchestrate.terminology.standardize_medication( code="861004", system="RxNorm", ) # Returns: { "coding": [ { "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "861004", "display": "metformin hydrochloride 1000 MG Oral Tablet" } ] }

Accessing the Convert API

For the Convert API, the request object will contain any URL segments, query parameters, and a single parameter named content containing the original content to convert. This could be a FHIR bundle object, a HL7 message string, a C-CDA document as an XML string, etc.

For example, for Convert HL7 to FHIR R4:

Convert HL7 to FHIR R4 (JavaScript)
await orchestrate.convert.hl7ToFhirR4({
      content: "MSH|^~\\&|LAB|MYFAC|LAB||201411130917||ORU^R01|3216598|D|2.3|||AL|NE| ... ",
      patientID: "123",
    });
  
    // Returns:
    {
      resourceType: 'Bundle',
      type: 'batch-response',
      entry: [
        {
          resource: {
            resourceType: "Patient",
            ... (patient fields)
          }
        },
        {
          resource: {
            resourceType: "Encounter",
            ... (encounter fields)
          }
        },
        ...
       ]
    }
await orchestrate.convert.hl7ToFhirR4({ content: "MSH|^~\\&|LAB|MYFAC|LAB||201411130917||ORU^R01|3216598|D|2.3|||AL|NE| ... ", patientID: "123", }); // Returns: { resourceType: 'Bundle', type: 'batch-response', entry: [ { resource: { resourceType: "Patient", ... (patient fields) } }, { resource: { resourceType: "Encounter", ... (encounter fields) } }, ... ] }
Convert HL7 to FHIR R4 (Python)
orchestrate.convert.hl7_to_fhir_r4(
        content="MSH|^~\\&|LAB|MYFAC|LAB||201411130917||ORU^R01|3216598|D|2.3|||AL|NE| ... ",
        patientID="123",
    )

    # Returns:

    {
      "resourceType": 'Bundle',
      "type": 'batch-response',
      "entry": [
        {
          "resource": {
            "resourceType": "Patient",
            ... (patient fields)
          }
        },
        {
          "resource": {
            "resourceType": "Encounter",
            ... (encounter fields)
          }
        },
        ...
       ]
    }
orchestrate.convert.hl7_to_fhir_r4( content="MSH|^~\\&|LAB|MYFAC|LAB||201411130917||ORU^R01|3216598|D|2.3|||AL|NE| ... ", patientID="123", ) # Returns: { "resourceType": 'Bundle', "type": 'batch-response', "entry": [ { "resource": { "resourceType": "Patient", ... (patient fields) } }, { "resource": { "resourceType": "Encounter", ... (encounter fields) } }, ... ] }

Accessing the Insight API

For the Insight API, the request object contains any URL segments and query parameters, as well as a FHIR bundle named content with the original FHIR data.

For example, for Risk Profile:

Insight Risk Profile (JavaScript)
await orchestrate.insight.riskProfile({
      content: { "resourceType": "Bundle", "type": "searchset", ... },
      hccVersion: 23,
      period_end_date: "2023-01-31"
    });

    // Returns:

    {
      id: '4556d7fb-a4ab-492a-98d8-bd121aaae17a',
      entry: [
        {
          resource: {
            resourceType: "Patient",
            ... (patient fields)
          }
        },
        {
          resource: {
            resourceType: "Measure",
            ... (CMS risk model fields)
          }
        },
        ...
      ],
      ...
    }
await orchestrate.insight.riskProfile({ content: { "resourceType": "Bundle", "type": "searchset", ... }, hccVersion: 23, period_end_date: "2023-01-31" }); // Returns: { id: '4556d7fb-a4ab-492a-98d8-bd121aaae17a', entry: [ { resource: { resourceType: "Patient", ... (patient fields) } }, { resource: { resourceType: "Measure", ... (CMS risk model fields) } }, ... ], ... }
Insight Risk Profile (Python)
orchestrate.insight.risk_profile(
        content={"resourceType": "Bundle", "type": "searchset", ... },
        hccVersion="23",
        period_end_date="2023-01-31",
    )

    # Returns:

    {
      "id": "4556d7fb-a4ab-492a-98d8-bd121aaae17a",
      "entry": [
        {
          "resource": {
            "resourceType": "Patient",
            ... (patient fields)
          }
        },
        {
          "resource": {
            "resourceType": "Measure",
            ... (CMS risk model fields)
          }
        },
        ...
      ],
      ...
    }
orchestrate.insight.risk_profile( content={"resourceType": "Bundle", "type": "searchset", ... }, hccVersion="23", period_end_date="2023-01-31", ) # Returns: { "id": "4556d7fb-a4ab-492a-98d8-bd121aaae17a", "entry": [ { "resource": { "resourceType": "Patient", ... (patient fields) } }, { "resource": { "resourceType": "Measure", ... (CMS risk model fields) } }, ... ], ... }