allscripts

package module
v0.0.0-...-9d15bf8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2015 License: MIT Imports: 7 Imported by: 0

README

go-allscripts

TravisCI badge GoDoc

A Go library for accessing the Allscripts Professional Unity API. Visit developers.allscripts.com for more info on the API.

This library does not cover all calls to the Unity API, rather just the ones that we need at this time. We will accept pull requests for additional calls that you would like to see included. Please make sure to write tests for the functionality that you add.

Usage
client := allscripts.NewClient("appuserid", "appname", "appusername",
    "apppassword", "url")
raw, _ := client.GetClinicalSummary("patientid", "section")
var summary []allscripts.ClinicalSummary
_ = json.Unmarshal(raw, &summary)
Tests

A mock server with mock JSON responses is included in the mock directory. Set environment variables ALLSCRIPTS_USERNAME and ALLSCRIPTS_PASSWORD and then run the tests with:

go test

Notes
  • This package does not do any type casting. All Allscripts requests take string values and return string values.
  • All sample data included with the mock server is from FAKE patients in the Allscripts sandbox.

Documentation

Overview

A Go library for accessing the Allscripts Professional Unity API.

Example:

package main

import (
    "github.com/grandroundtable/go-allscripts"
)

func main() {
    client := allscripts.NewClient("appuserid", "appname", "appusername",
        "apppassword", "url")
    raw, _ := client.GetClinicalSummary("patientid", "section")
    var summary []allscripts.ClinicalSummary
    _ = json.Unmarshal(raw, &summary)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Appointment

type Appointment struct {
	PatientID        string `json:"patientID"`
	Patientname      string `json:"Patient"`
	Patientfirstname string `json:"PatientFirstName"`
	Patientlastname  string `json:"PatientLastName"`
	Image            string `json:"base64image"`
	Datetime         string `json:"ApptTime"`
	Time             string `json:"AppTime2"`
	Status           string `json:"Status"`
	Statuscolor      string `json:"statuscolor"`
	Duration         string `json:"Duration"`
	Timein           string `json:"TimeIn"`
	Timestart        string `json:"TimeStart"`
	Timeout          string `json:"TimeOut"`
	OrgID            string `json:"OrganizationID"`
	OrgMRN           string `json:"organizationMRN"`
	Orgname          string `json:"OrgName"`
	ProviderID       string `json:"ProviderID"`
	Providername     string `json:"Provider"`
	Location         string `json:"LocationName"`
	SchedComment     string `json:"SchedComment"`
	Comment          string `json:"Comment"`
	Schedtext        string `json:"SchedText"`
	Type             string `json:"type"`
}

Appointment includes details about the patient, the time and date, status, organization and provider.

type Appointments

type Appointments []Appointment

Appointments is an array of appointments return by the GetSchedule API call.

func (*Appointments) UnmarshalJSON

func (o *Appointments) UnmarshalJSON(b []byte) error

type Client

type Client struct {
	Userid      string
	Appname     string
	Appusername string
	Apppassword string
	Endpoint    string
	Token       string
	HTTPClient  *http.Client
}

Client is a HTTP client of the Allscripts Professional API.

func NewClient

func NewClient(userid string, appname string, appusername string,
	apppassword string, endpoint string) Client

NewClient creates a new Client and returns it.

func (*Client) GetClinicalSummary

func (c *Client) GetClinicalSummary(patientid string,
	section string) (findings []byte, err error)

GetClinicalSummary returns a snapshot of a patient's clinical history.

func (*Client) GetOrders

func (c *Client) GetOrders(patientid string,
	sincedate string, ordermask string, status string) (findings []byte,
	err error)

GetOrders lists orders in the system for particular patients, date ranges, statuses, and order names.

    sincedate: a string in the format of YYYY/MM/DD
    ordermask: a wildcard matcher, for example, "%injection%"
    status: Defaults to all status if not used.
            Valid values are: "Undefined", "Ordered", "Preliminary", "Final",
	           "Reviewed", "Pending", "Canceled"

func (*Client) GetPatient

func (c *Client) GetPatient(patientid string) (patient []byte, err error)

GetPatient returns information for the specified Patient ID.

func (*Client) GetSchedule

func (c *Client) GetSchedule(daterange string, sincedate string,
	includepic string, user string, appttype string) (resp []byte,
	err error)

GetSchedule lists appointments for the specified date or date range.

    daterange: single date (for example, 3/24/2015), or you can enter a date
               range separated by a pipe (3/24/2015|3/29/2015).
               Date format is MM/DD/YYYY
	   sincedate: a string in the format of MM/DD/YYYY
    includepic: include a 45px × 45px JPG of the patient? Valid values are Y,
                or N. Defaults to N.
	   user: the patient's MRN. For all patients, specify "All". Default is "All"
	   appttype: pipe-delimited list of desired appointment types.

func (*Client) GetToken

func (c *Client) GetToken() (token string, err error)

GetToken uses the Allscripts' /GetToken resource to get a token that may be used in MagicJson calls.

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(hc *http.Client) *Client

WithHTTPClient sets a Client's HTTP client for making HTTP requests, returning a Client pointer for chaining.

func (*Client) WithToken

func (c *Client) WithToken(t string) *Client

WithToken sets a Client's Allscripts' token, returning a Client pointer for chaining. Use this method when when you already have a token that you want to use to access MagicJson data. If the token has not be sent before making a data request, a Client will call GetToken to get and cache one.

type ClinicalSummary

type ClinicalSummary struct {
	Findings []Finding `json:"getclinicalsummaryinfo"`
}

ClinicalSummary is a snapshot of a patient's clinical history.

type Finding

type Finding struct {
	Detail      string `json:"detail"`
	Code        string `json:"code"`
	Transid     string `json:"transid"`
	Status      string `json:"status"`
	XMLDetail   string `json:"xmldetail"`
	Entrycode   string `json:"entrycode"`
	Description string `json:"description"`
	Section     string `json:"section"`
	Displaydate string `json:"displaydate"`
}

Finding is an individual finding from the patient's clinical summary.

type Order

type Order struct {
	Firstname     string `json:"firstname"`
	Lastname      string `json:"lastname"`
	PatientID     string `json:"patientid"`
	DOB           string `json:"dateofbirth"`
	Orderdate     string `json:"orderdate"`
	OrderID       string `json:"orderid"`
	OrderitemID   string `json:"OrderItemID"`
	Ordername     string `json:"ordername"`
	Orderstatus   string `json:"orderstatus"`
	Orderedbyname string `json:"orderedbyname"`
	Orderextid    string `json:"orderextid"`
	ReqID         string `json:"reqID"`
	RplID         string `js	on:"rplid"`
	Rplname       string `json:"rplname"`
	Rplcode       string `json:"rplcode"`
}

Order includes details about the patient and order.

type Orders

type Orders []Order

Orders is an array of orders returned by the GetOrders API call.

func (*Orders) UnmarshalJSON

func (o *Orders) UnmarshalJSON(b []byte) error

type Patient

type Patient struct {
	Firstname        string `json:"Firstname"`
	Middlename       string `json:"middlename"`
	Lastname         string `json:"LastName"`
	Suffix           string `json:"suffix"`
	Mrn              string `json:"mrn"`
	SSN              string `json:"ssn"`
	Gender           string `json:"gender"`
	Race             string `json:"Race"`
	Agedec           string `json:"AgeDec"`
	Age              string `json:"age"`
	DOB              string `json:"dateofbirth"`
	Maritalstatus    string `json:"MaritalStatus"`
	Image            string `json:"base64image"`
	Addressline1     string `json:"Addressline1"`
	Addressline2     string `json:"AddressLine2"`
	City             string `json:"City"`
	State            string `json:"State"`
	Zip              string `json:"ZipCode"`
	Phone            string `json:"PhoneNumber"`
	Homephone        string `json:"HomePhone"`
	Workphone        string `json:"WorkPhone"`
	Cellphone        string `json:"cellphone"`
	Language         string `json:"Language"`
	Email            string `json:"Email"`
	Homeemail        string `json:"HomeEmail"`
	Physusername     string `json:"PhysUserName"`
	Physfirstname    string `json:"PhysFirstName"`
	Physlastname     string `json:"PhysLastName"`
	Physphone        string `json:"PhysPhone"`
	Location         string `json:"PatientLocation"`
	Primaryinsurance string `json:"PrimaryInsurance"`
	DEM              string `json:"DEM_EXTERNALID"`
}

Patient is the details of a patient.

func (*Patient) UnmarshalJSON

func (p *Patient) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
Godeps
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL