MD Logic API Specifications
Version 1.0 Release Date: 9/25/2017
INTRODUCTION
The MD Logic API (Application Programming Interface) is a web service that exposes a set of methods for accessing patient data stored in an MD Logic EHR System. The MD Logic API is a RESTful service which is implemented using the HTTP protocol and returns JSON formatted data that is logically structured according to the Fast Healthcare Interoperability Resources (FHIR) specification. The patient data available to an API client application is specified by the Common Clinical Data Set (CCDS) as documented by the ONC and is logically organized into 15 data categories which may be retrieved in whole or in parts. The API also supports retrieving a Continuity of Care Document (CCD) for a patient. This document is a patient summary often used in transitions of care and is formatted as XML according to the HL7 CCD specifications.
REQUIREMENTS
Client applications developed to use the MD Logic API must be compliant with HTTP standards, FHIR specifications, JSON data formatting specifications and require a signed Terms of Use agreement with MD Logic Inc.
End users wishing to use a client application leveraging the MD Logic API must have credentials (username and password) in order to log in and access patient data. End user credentials are granted to users by providers in MD Logic following a formal request and acceptance by the provider.
CONFIGURATION
Client applications developed to use the API do not require being registered in advance with MD Logic. However, in order to use the API features, the application must successfully login into the API with valid user credentials entered by the end user of the client application. The application itself needs only an internet connection, the URL of the API, the user’s credentials, and the ability to process the API FHIR responses.
End user credentials are created and maintained by providers in MD Logic. A user’s credentials can be configured to limit data access to a particular patient, a list of designated patients or all patients in the practice.
SECURITY
The MD Logic API is hosted on a web server using a trusted connection (SSL). This ensures that all patient information is transferred using high level encryption. All accesses of patient information are audited by the MD Logic EHR.
API FUNCTIONS
Login
This function attempts to authenticate the user’s credentials. If the user’s credentials are successfully authenticated, then a session is started and a unique “OAuth 2” session token is generated. This session token is required in all subsequent API calls to identify the end user and their access privileges. The user remains logged into the API for the duration of the session until the Logout function is called or the session is terminated due to an activity timeout.
Http Method: Post
Headers:
Content-Type: application/x-www-form-urlencoded
Body Content:
Property Type
UserName string
Password string
Url Parameters: None
Url Syntax:
https://mdlogicapi.com/fhir/Login
Return Values:
HTTP Status Code: 200 for success, otherwise an error code
access_token: Session token that identifies user’s session (e.g. e8bb6981-8375-4b72-bfea-47127569e00a)
token_type: Bearer
expires_in: Time in seconds
Error Conditions:
HTTP Status Code |
Message |
Scenario |
400 (Bad Request) |
The User Name or password is incorrect |
Entered invalid username or password |
400 (Bad Request) |
Unsupported_grant_type |
Indicates grant_type or HTTP method is invalid |
404 (Not Found) |
No HTTP resource found that matches the request URL |
Indicates required data is missing or contains invalid request |
Get Patient
This method searches for patients matching the provided input parameters and returns a list of matching patients. The patients returned are limited to the list of accessible patients set up by the practice provider for that end user of the client application. Each Patient Resource returned contains an ID field (Patient Token) which uniquely identifies the patient. This Patient Token is needed throughout the remainder of the session in order to use the Get Patient Data function.
Http Method: Get
Headers:
Content-Type: application/json
Authorization: Bearer 6364e90c-7a02-4455-ab15-541daa65fca6 (Session Token)
Url Parameters:
Name Type Case-Sensitive Optional
Firstname string No Yes
Lastname string No No
Url Syntax:
https://mdlogicapi.com/fhir/Patient?Parameter1=Value1 {&Parametern=Valuen …}
https://mdlogicapi.com/fhir/Patient?Lastname=Newman
https://mdlogicapi.com/fhir/Patient?Lastname=Newman&Firstname=Alice
Return Values:
The Get Patient method returns a list of Patient Resources matching the given input parameters. The patient data is structurally formatted as FHIR Patient objects using JSON data format. For patient resource data structure details refer to the Patient resource on HL7.org.
Error Conditions:
HTTP Status Code |
Message |
Scenario |
401 (Unauthorized) |
Authorization has been denied for this request |
Invalid session token, user is not logged in, or session has expired |
404 (Not Found) |
No HTTP resource found that matches the request URL |
Indicates required data is missing or contains invalid request |
405 (Method Not Allowed) |
The requested resource does not support HTTP method |
Indicates HTTP method is invalid |
Get Patient Data
This function retrieves patient data for the patient identified by the PatientID parameter in the URL. The type and quantity of data returned is controlled by the DataCategory parameter. Data can also be filtered by date if the StartDate and EndDate parameters are included in the URL.
Http Method: Get
Url Parameters:
Name Type Case-Sensitive Optional Value(s)_____________
DataCategory string Yes No See Appendix A
PatientID string No No Patient ID from Get Patient
StartDate string No Yes
EndDate string No Yes
Url Syntax:
https://mdlogicapi.com/fhir/v1/Patient?DataCategory=Category1{,Categoryn}&PatientID=Value
Examples:
Retrieve “Patient Name” and “Problem List” for patient with PatientID = 72075
https://mdlogicapi.com/fhir/v1/Patient?DataCategory=PatientName,Problem&PatientID=72075
Retrieve All Patient Data for patient with PatientID = 72075 (includes all category resources and a CCD)
https://mdlogicapi.com/fhir/v1/Patient?DataCategory=AllData&PatientID=72075
Retrieve a “CCD” (Continuity of Care Document) for patient with PatientID = 72075
https://mdlogicapi.com/fhir/v1/DocumentReference?DataCategory=CCDA&PatientID=72075
Retrieve all encounters for patient with PatientID = 72075 between 1/1/2000 and 1/1/2012
Return Values:
The Get Patient Data method returns a list of FHIR Resources for the patient identified by the PatientID input parameter. The resources returned are constrained by the DataCategory, StartDate, and EndDate parameters. The data is structurally formatted as FHIR Resources using JSON data format. For structure details of Patient resources and other FHIR resources refer to Appendix A.
Error Conditions:
HTTP Status Code |
Message |
Scenario |
400 (Bad Request) |
Unknown DataCategory. DataCategories are case sensitive. |
Indicates DataCategory value is invalid |
400 (Bad Request) |
Unknown FHIR resource. ResourceTypes are case sensitive |
Indicates ResourceType is invalid |
401 (Unauthorized) |
Authorization has been denied for this request |
Indicates invalid Token, session expired, or the user is not logged in |
404 (Not Found) |
No HTTP resource found that matches the request URL |
Indicates required data is missing or contains an invalid request |
405 (Method Not Allowed) |
The requested resource does not support HTTP method |
Indicates HTTP method is invalid |
LogOut
This function terminates the API session and deletes the associated Session Token. The user will no longer have permission to access any API functions except for LogIn.
Http Method: Delete
Parameters: None
Eg: https://mdlogicapi.com/fhir/v1/logout
Return Values:
HTTP Status Code : 200
Message: You have Signed Out
Error Conditions:
HTTP Status Code |
Message |
Scenario |
404 (Not Found) |
No HTTP Response was found matches the Request URL |
Indicates required data is missing or contains invalid request |
405 (Method Not Allowed) |
The requested resource does not support HTTP method |
Indicates HTTP method is invalid |
APPENDIX A
Patient Data Categories
Data Categories |
FHIR Resource |
Resource Reference |
Patient Demographics including Race/Ethnicity |
Patient |
Refer to Patient resource on HL7.org |
Encounter |
Encounter |
Refer to Encounter resource on HL7.org |
Problem |
Condition |
Refer to Condition resource on HL7.org |
Procedures |
Procedure |
Refer to Procedure resource on HL7.org |
careTeam |
Practitioner |
Refer to Practitioner resource on HL7.org |
Medications |
MedicationStatement |
Refer to MedicationStatement resource on HL7.org |
MedicationAllergies |
AllergyIntolerance |
Refer to AllergyIntolerance resource on HL7.org |
Immunizations |
Immunization |
Refer to Immunization resource on HL7.org |
Goals |
Goal |
Refer to Goal resource on HL7.org |
CarePlan |
CarePlan |
Refer to CarePlan resource on HL7.org |
VitalSigns |
Observation |
Refer to Observation resource on HL7.org |
SmokingStatus |
Observation |
Refer to Observation resource on HL7.org |
LabTests |
DiagnosticOrder |
Refer to DiagnosticOrder resource on HL7.org |
LabResults |
Observation |
Refer to Observation resource on HL7.org |
UniqueDeviceIds |
device |
Refer to Device resource on HL7.org |
Assessment |
ClinicalImpression |
Refer to ClinicalImpression resource on HL7.org |
ReasonforReferral |
ReferralRequest |
Refer to ReferralRequest resource on HL7.org |
HealthConcerns |
Condition |
Refer to Condition resource on HL7.org |
FunctionalStatus |
Condition |
Refer to Condition resource on HL7.org |
CognitiveStatus |
Condition |
Refer to Condition resource on HL7.org |
Reference Guides for API, FHIR Resources, and Developers
FHIR RESTful API : https://www.hl7.org/fhir/http.html
Details of each FHIR Resource: https://www.hl7.org/fhir/resourcelist.html
Data types supported in FHIR: https://www.hl7.org/fhir/datatypes.html
Developers guide to accessing FHIR: https://www.hl7.org/fhir/overview-dev.html