Lab Network iframe

Version: 1.2
Welcome to Health Gorilla's Developer Portal. Access API documentation for our suite of clinical data APIs.

The Lab Network iFrame allows developers to embed our ordering portal UI into their own products. This functionality enables users (providers or assisting staff) to submit lab orders through Health Gorilla without leaving their product's UI. The Lab Network iFrame supports lab orders only and does not support results delivery. This guide describes the iframe API and contains simple examples of requests to the corresponding endpoints.

Resources

1. Using OAuth 2.0 to Access Health Gorilla Diagnostic Network iframe

OAuth 2.0 protocol is used to secure Health Gorilla's API.
Your application must get an access token to access private data using Health Gorilla's API.

  • The place_orders scope is required to be granted to your client application to submit orders via Health Gorilla API.

You must follow OAuth 2.0 guidelines when making calls to Health Gorilla API.

2. Endpoints

Health Gorilla endpoints are accessible only over SSL, and plain text HTTP calls are rejected.

2.1. Lab Network iFrame API Endpoint

This service is based on the JSON-RPC protocol. You should be familiar with JSON-RPC protocol specification to clarify the common rules and error handling.
Health Gorilla healthcare providers endpoint is:

https://api.healthgorilla.com/doctor/api

3. API Definition

3.1. Place Order Request

To begin the application makes JSON-RPC call to Lab Network iFrame API Endpoint. You may pass in the patient by lookup, or patient by reference.

3.1.1 Patient By Lookup

Request contains the following fields:

FieldValuesDescription
facilityTypeOne of the facility types available for ordering.Identifies the type of the order.
patientPatient JSON.Defines the patient for the order. You may either pass in a patient profile using the patient JSON to look up the patient, or you can pass in a resource ID to directly reference the patient.
callbackUrl

The callback URL.

It is required to use https scheme for security reasons

Determines where the response will be sent to.
Read more about the response.

You can include some additional parameters to that URL. Any you need to pass to the callback.

stateAny string. Optional.A value used by the client to maintain state between the request and callback.
Recommended to prevent XSRF attacks.
If specified then the value will be included to the callback invocation. See Chapter 3.2. Place Order Callback
tz-offsetOptional.Timezone offset as minutes from UTC

Supported facility types

Facility TypeDescription
DiagnosticLaboratoriesDiagnostic Laboratories
RadiologyImagingRadiology Imaging
GeneticTestingGenetic Testing
SurgicalCenterSurgical Centers
PhysicalTherapyPhysical Therapy (PT)
SkilledNursingFacilitiesSkilled Nursing Facilities
HomeHealthAgenciesHome Health Agencies (HHA)
SleepCentersSleep Centers
HospiceHospices
AssistedLivingFacilitiesAssisted Living Facilities
SpecialistSpecialists

A patient JSON

Contains the following fields (case sensitive)

FieldValuesDescription
id2OptionalMRN in your system or External ID
classNameRequiredWill always be "com.informedika.common.shared.vo.PatientVO"
firstNameAny string.
Required
The given name of the patient.
middleNameAny string.
Optional
The middle name of the patient.
lastNameAny string.
Required.
The surname of the patient.
titleOne of the following constants:
  • mr
  • ms
    Optional
The desired patient’s title.
genderOne of the following constants:
  • male
  • female
  • other
  • unknown
    Required
The gender of the guarantor.
dateOfBirthLocal Date JSON
Required.
The date of birth of the patient.
addressJSON Address
Optional
Patient address.
licenseOptional stringLicense ID
ssnOptional stringSocial Security Number
maritalStatusOne of the following constants:
  • married
  • single
  • divorced
  • widowed
  • separated
  • domesticPartner
  • livingTogether
  • unknown
    Optional
The marital status of the patient.
languageOne of the following constants:
  • en
  • es
  • pt
  • zh
  • ru
  • fr
  • de
  • it
  • jp
  • un
  • dc
    Optional
Language preference
needTranslatorTrue or False
Optional
Determines if patient needs a translator services
racesOne or several of the following constants:
  • indian
  • asian
  • black
  • hawaiian
  • white
  • unknown
  • declined
    Optional
The list of races of the patient.
ethnicityOne of the following constants:
  • hispanicLatino
  • notHispanicLatino
  • unknown
  • declined
    Optional
homePhoneA phone number.
Optional
Home phone number.
mobilePhoneA phone number.
Optional
Mobile phone number.
workPhoneA phone number.
Optional
Work phone number.
workPhoneExtAny digits.
Optional
Work phone extension
emailAn email address.
Optional
The valid email address.
contactMethodOne of the following constants:
  • email
  • phone
  • mail
    Optional
Prefered contact method.
primaryInsuranceAn insurance JSON
Optional
Primary insurance.
secondaryInsuranceAn insurance JSON
Optional
Secondary insurance.
tertiaryInsuranceAn insurance JSON
Optional
Tertiary insurance.

An insurance JSON

Contains the following fields

FieldValuesDescription
providerAny string.
Required
The name of the insurance provider.
policyIdAny string.
Required
Policy number/id
groupNumberAny string.
Optional
Policy group number if available
providerInfoA provider JSON
Required
Describes the payer for the given insurance plan.
insuredA guarantor JSON
Required
Defines the guarantor.

An insurance provider JSON

Contains the following fields

FieldValuesDescription
nameAny string.
Required.
The name of the insurer.
phoneA phone number.A valid US phone number.
addressJSON AddressThe claims address of the insurance provider.

A guarantor JSON

Contains the following fields

FieldValuesDescription
firstNameAny string.
Mandatory.
Given name of the guarantor.
lastNameAny string.
Mandatory.
Last name of the guarantor.
genderOne of the following constants:
  • male
  • female
    Required
Gender of the guarantor.
dateOfBirthLocal Date JSON
Required
Date of birth of the guarantor.
employerAny string.
Optional
Company name where the guarantor works if available.
relationshipOne of the following constants:
  • self
  • spouse
  • parent
  • other
    Mandatory.
Identifies the relationship between the patient and the guarantor.
phoneA phone number.
Required
Valid US phone number.
addressJSON Address
Required
Guarantor’s mailing address.

An address JSON

Contains the following fields

FieldValuesDescription
address1Any string
Required
Address 1
address2Any string
Optional
Address 2
cityAny string
Required
City name.
stateA state code
Required
Two-letters state code.
zip5-digit ZIP code.
Required
Postal ZIP code.
countryUSA
Required
Country code. A predefined constant.

A local date JSON

Contains the following fields

FieldValuesDescription
year

1900
Required
Mandatory

Year.
month1 - 12
Required
Mandatory
Month number.
day1 - 31
Required
Mandatory
Day of the month.

Below you can find an example of a such request:

POST /doctor/api HTTP/1.1 
Authorization: Bearer fb0ecb5f514a02dbe044d54b8dd29cac 
Host: api.healthgorilla.com

{     
    "id": 8,
    "jsonrpc": "2.0", 
    "method": "placeOrder",
    "params": [{
        "facilityType" : "DiagnosticLaboratories",          
        "callbackUrl" : "https://yourapp.com/neworder/callback", 
        "state" : "1",
        "patient" : {
            "className" : "com.informedika.common.shared.vo.PatientVO",
            "firstName" : "Marcy",
            "lastName" : "Pop",
            "title" : "mrs",
            "gender" : "female",
            "dateOfBirth" : {
                "year" : 1990,
                "month" : 12,
                "day" : 28
            },
            "address" : {
                "address1" : "555 River Road",
                "city" : "Washougal",
                "state" : "WA",
                "zip" : "98671"
            },
            "maritalStatus" : "married",
            "races" : ["white"],
            "email" : "[email protected]",
            "homePhone" : "777-777-7777",
            "workPhone" : "888-446-7455",
            "primaryInsurance" : {
                "className" : "com.informedika.common.shared.vo.InsuranceVO",
                "provider" : "MediCare",
                "policyId" : "123456789",
                "providerInfo" : {
                    "className" : "com.informedika.common.shared.vo.BaseInsurerVO",
                    "name" : "MediCare",
                    "address" : {
                        "address1" : "PO BOX 272855",
                        "city" : "Chico",
                        "state" : "CA",
                        "zip" : "95927"}
                    },
                "insured" : {
                    "className" : "com.informedika.common.shared.vo.GuarantorVO",
                    "firstName" : "Jim",
                    "lastName" : "Pop",
                    "relationship" : "other",
                    "employer" : "Health Gorilla Inc.",
                    "address" : {
                        "address1" : "555 River Road",
                        "city" : "Washougal",
                        "state" : "WA",
                        "zip" : "98671"
                    },
                    "homePhone" : "844-446-7455",
                    "gender" : "male",
                    "dateOfBirth" : {
                        "year" : 1990,
                        "month" : 10,
                        "day" : 22}
                    }
            },
            "secondaryInsurance" : {
                "className" : "com.informedika.common.shared.vo.InsuranceVO",
                "provider" : "ANTHEM BLUE CROSS OF CALIFORNIA",
                "policyId" : "619A988989",
                "groupNumber" : "54545454",
                "providerInfo" : {
                    "className" : "com.informedika.common.shared.vo.BaseInsurerVO",
                    "name" : "ANTHEM BLUE CROSS OF CALIFORNIA",
                    "phone" : "877-800-4725",
                    "address" : {
                        "address1" : "PO BOX 60007",
                        "city" : "Los Angeles",
                        "state" : "CA",
                        "zip" : "90060"}
                    },
                "insured" : {
                    "className" : "com.informedika.common.shared.vo.GuarantorVO",
                    "firstName" : "Jim",
                    "lastName" : "Pop",
                    "relationship" : "other",
                    "employer" : "Health Gorilla Inc.",
                    "address" : {
                        "address1" : "555 River Road",
                        "city" : "Washougal",
                        "state" : "WA",
                        "zip" : "98671"
                    },
                    "homePhone" : "844-446-7455",
                    "gender" : "male",
                    "dateOfBirth" : {
                        "year" : 1990,
                        "month" : 10,
                        "day" : 22}
                    }
        }
    }
    }]
}

3.1.2 Patient By Reference

Alternatively, you may directly reference the patient's resource ID (HG ID) if it is known, which will directly reference the patient as opposed to populating the entire Patient JSON and performing a lookup.

FieldValuesDescription
patientIdPatient Resource ID (HG ID)The Patient resource ID or HG ID, i.e. the internal resource ID.

Below you can find an example of such a payload.

{     
    "id": 1,
    "jsonrpc": "2.0", 
    "method": "placeOrder",
    "params": [
        {
        "facilityType" : "DiagnosticLaboratories",          
        "callbackUrl" : "https://yourapp.com/neworder/callback", 
        "state" : "1",
        "patientId" : "59f71f62e8f8cc8cbe17cfd7"
        }
    ]
}

Response

A successful response contains the following fields:

FieldDescription
callbackUrlThe URL to open the New Order wizard.

Below you can find an example of such a response:

{ 
  "jsonrpc": "2.0", 
  "result": [
    {
      "callbackUrl" : "https://healthgorilla.com/newsession?go=https%3A%2F%healthgorilla%2Fmarketplace%23new%2Forder%2Flab%26processId%3D62631e55e85ee9304c9bad80%26mode%3Dembedded%26patientIds%3Dd03d19550d4e030ad9bea63b"
    }
  ], 
  "id": 8
}

Callback URl is a URL to access Health Gorilla New Order wizard. Your application should take this URL from the response, append OAuth access token (access_token parameter) and then open it in a separate window or in a frame. The URL with the appended access token parameter will look like this:

https://sandbox.healthgorilla.com/newsession?go=https%3A%2F%2Fsandbox.healthgorilla.com%2Fclinicalnetwork%23new%2Forder%2Flab%26processId%3D60d14069afbd9a026a092bd9%26mode%3Dembedded%26patientIds%3D59f71f62e8f8cc8cbe17cfd7&access_token=eed75a66c1ff8e0db23c424bcdebaa3b

3.1.1. Example

Below you can see how to call JSON-RPC with curl tool.

curl -X POST -k -H "Content-Type: application/json" -H "Authorization: Bearer b0d14637fa9e47541e3e55c32828c307" --data-binary @path\to\file.json  https://api.healthgorilla.com/doctor/api

Where @path\to\file.json is the the path to the file that contains JSON request.
For example: @C:\tmp\placeOrder.json
Then copy JSON example from 3.1 to the file and execute the command.

Once you get successful response to your call you can use value of callbackUrl response parameter to navigate iframe or new browser window to

3.2. Place Order Callback

Once Place New Order Wizard finishes it will be redirected to the callbackUrl you have provided. It will pass the following parameters:

ParameterDescription
responseCodeThe result of Place New Order Wizard. Possible values are:
  • success -- a new order has been successfully placed;
  • canceled-- the process has been canceled by the user;
  • error-- an error has occurred during the process.
responseMessageOptional. Can provide error description in case when responseCode = error
stateThe state parameter, if it was included to the initial request.
orderIdOptional. Placed order ID in case when responseCode = success for use in Get Order Request. See Chapter 3.3. Get Order Request
orderIdsOptional. Contains joined string (separated by ‘|’) of placed orders IDs in case if order was split during placement

Examples:

https://yourapp.com/neworder/callback?responseCode=success&orderId=c0ef7755a39e3e76a91d00ba

https://yourapp.com/neworder/callback?responseCode=error&responseMessage=Failed%20while%20getting%20EMR%20Integration%20data

https://yourapp.com/neworder/callback?youCanHave=yourOwnParameters&responseCode=canceled