hdsfhir

package module
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

README

HDS to FHIR Build Status

This project converts JSON data for a patient in the structure used byhealth-data-standards into the HL7 FHIR DSTU2 models defined in the Intervention Engine fhir project.

NOTE: The HDS-to-FHIR conversion focuses only on those data elements that are needed by Intervention Engine. It is not a complete and robust conversion.

Building hdsfhir Locally

For information on installing and running the full Intervention Engine stack, please see Building and Running the Intervention Engine Stack in a Development Environment.

The hdsfhir project is a Go library. For information related specifically to building the code in this repository (hdsfhir), please refer to the following sections in the above guide:

To build the hdsfhir library, you must install its dependencies via go get first, and then build it:

$ cd $GOPATH/src/github.com/intervention-engine/hdsfhir
$ go get
$ go build

For information on using the uploadhds tool to convert HDS patients to FHIR and upload them to a FHIR server, please refer to the uploadhds section of the tools repository README.

Using hdsfhir as a library

The following is a simple example of converting a HDS patient to the corresponding slice of FHIR models:

import (
	"encoding/json"
	"io/ioutil"
	"github.com/intervention-engine/hdsfhir"
)

func ExampleConversion(pathToHdsPatient string) ([]interface{}, error) {
	data, err := ioutil.ReadFile(pathToHdsPatient)
	if err != nil {
		return nil, err
	}

	p := &hdsfhir.Patient{}
	err = json.Unmarshal(data, p)
	if err != nil {
		return nil, err
	}

	return p.FHIRModels(), nil
}

License

Copyright 2016 The MITRE Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodeSystemMap = map[string]string{
	"CPT":                             "http://www.ama-assn.org/go/cpt",
	"LOINC":                           "http://loinc.org",
	"SNOMED-CT":                       "http://snomed.info/sct",
	"RxNorm":                          "http://www.nlm.nih.gov/research/umls/rxnorm",
	"ICD-9-CM":                        "http://hl7.org/fhir/sid/icd-9",
	"ICD-10-CM":                       "http://hl7.org/fhir/sid/icd-10",
	"ICD-9-PCS":                       "http://hl7.org/fhir/sid/icd-9",
	"ICD-10-PCS":                      "http://hl7.org/fhir/sid/icd-10",
	"NDC":                             "http://www.fda.gov/Drugs/InformationOnDrugs",
	"CVX":                             "http://www2a.cdc.gov/vaccines/iis/iisstandards/vaccines.asp?rpt=cvx",
	"HCP":                             "urn:oid:2.16.840.1.113883.6.14",
	"HCPCS":                           "urn:oid:2.16.840.1.113883.6.285",
	"HL7 Marital Status":              "http://hl7.org/fhir/ValueSet/v3-MaritalStatus",
	"HITSP C80 Observation Status":    "http://hl7.org/fhir/ValueSet/v3-ObservationInterpretation",
	"NCI Thesaurus":                   "urn:oid:2.16.840.1.113883.3.26.1.1",
	"FDA SPL":                         "urn:oid:2.16.840.1.113883.3.26.1.1",
	"FDA":                             "urn:oid:2.16.840.1.113883.3.88.12.80.20",
	"UNII":                            "http://fdasis.nlm.nih.gov",
	"HL7 ActStatus":                   "http://hl7.org/fhir/ValueSet/v3-ActStatus",
	"HL7 Healthcare Service Location": "urn:oid:2.16.840.1.113883.6.259",
	"HSLOC":                           "urn:oid:2.16.840.1.113883.6.259",
	"DischargeDisposition":            "urn:oid:2.16.840.1.113883.12.112",
	"HL7 Act Code":                    "http://hl7.org/fhir/ValueSet/v3-ActCode",
	"HL7 Relationship Code":           "urn:oid:2.16.840.1.113883.1.11.18877",
	"CDC Race":                        "urn:oid:2.16.840.1.113883.6.238",
	"NLM Mesh":                        "urn:oid:2.16.840.1.113883.6.177",
	"Religious Affiliation":           "http://hl7.org/fhir/ValueSet/v3-ReligiousAffiliation",
	"HL7 ActNoImmunicationReason":     "urn:oid:2.16.840.1.113883.1.11.19717",
	"NUBC":                            "urn:oid:2.16.840.1.113883.3.88.12.80.33",
	"HL7 Observation Interpretation":  "urn:oid:2.16.840.1.113883.1.11.78",
	"Source of Payment Typology":      "urn:oid:2.16.840.1.113883.3.221.5",
	"SOP":                             "urn:oid:2.16.840.1.113883.3.221.5",
	"CDT":                             "urn:oid:2.16.840.1.113883.6.13",
	"AdministrativeSex":               "urn:oid:2.16.840.1.113883.18.2",
}

Functions

func ConvertToConditionalUpdates

func ConvertToConditionalUpdates(bundle *models.Bundle) error

ConvertToConditionalUpdates converts a bundle containing POST requests to a bundle with PUT requests using conditional updates. For patient resources, the update is based on the Medical Record Number. For all other resources it is based on reasonable indicators of sameness (such as equal dates and codes).

Types

type Allergy

type Allergy struct {
	Entry
	Reaction *CodeObject `json:"reaction"`
	Severity *CodeObject `json:"severity"`
}

func (*Allergy) FHIRModels

func (a *Allergy) FHIRModels() []interface{}

type CodeMap

type CodeMap map[string][]string

func (*CodeMap) FHIRCodeableConcept

func (c *CodeMap) FHIRCodeableConcept(text string) *fhir.CodeableConcept

type CodeObject

type CodeObject struct {
	Code       string `json:"code"`
	CodeSystem string `json:"codeSystem"`
}

func (*CodeObject) FHIRCodeableConcept

func (c *CodeObject) FHIRCodeableConcept(text string) *fhir.CodeableConcept

type CodedResult

type CodedResult struct {
	Codes       CodeMap `json:"codes"`
	Description string  `json:"description"`
}

type Condition

type Condition struct {
	Entry
	// NOTE: HDS has inconsistent representations of severity, but the only working importer (cat1)
	// models it like a CodeMap -- so that's what we assume.  Note the difference from Allergy.
	Severity CodeMap `json:"severity"`
}

func (*Condition) FHIRModels

func (c *Condition) FHIRModels() []interface{}

type Encounter

type Encounter struct {
	Entry
	Reason               *Entry      `json:"reason"`
	DischargeDisposition *CodeObject `json:"dischargeDisposition"`
}

func (*Encounter) FHIRModels

func (e *Encounter) FHIRModels() []interface{}

type Entry

type Entry struct {
	TemporallyIdentified
	Patient        *Patient    `json:"-"`
	StartTime      *UnixTime   `json:"start_time"`
	EndTime        *UnixTime   `json:"end_time"`
	Time           *UnixTime   `json:"time"`
	Oid            string      `json:"oid"`
	Codes          CodeMap     `json:"codes"`
	MoodCode       string      `json:"mood_code"`
	NegationInd    bool        `json:"negationInd"`
	NegationReason *CodeObject `json:"negationReason"`
	StatusCode     CodeMap     `json:"status_code"`
	Description    string      `json:"description"`
}

func (*Entry) GetFHIRPeriod

func (e *Entry) GetFHIRPeriod() *fhir.Period

type Immunization

type Immunization struct {
	Entry
	SeriesNumber *uint32 `json:"seriesNumber"`
}

func (*Immunization) FHIRModels

func (i *Immunization) FHIRModels() []interface{}

type Medication

type Medication struct {
	Entry
}

func (*Medication) FHIRModels

func (m *Medication) FHIRModels() []interface{}

type Patient

type Patient struct {
	TemporallyIdentified
	MedicalRecordNumber string          `json:"medical_record_number"`
	FirstName           string          `json:"first"`
	LastName            string          `json:"last"`
	BirthTime           *UnixTime       `json:"birthdate"`
	Gender              string          `json:"gender"`
	Encounters          []*Encounter    `json:"encounters"`
	Conditions          []*Condition    `json:"conditions"`
	VitalSigns          []*VitalSign    `json:"vital_signs"`
	Procedures          []*Procedure    `json:"procedures"`
	Medications         []*Medication   `json:"medications"`
	Immunizations       []*Immunization `json:"immunizations"`
	Allergies           []*Allergy      `json:"allergies"`
}

func (*Patient) FHIRModel

func (p *Patient) FHIRModel() *fhir.Patient

func (*Patient) FHIRModels

func (p *Patient) FHIRModels() []interface{}

func (*Patient) FHIRTransactionBundle

func (p *Patient) FHIRTransactionBundle(conditionalUpdate bool) *fhir.Bundle

FHIRTransactionBundle returns a FHIR bundle representing a transaction to post all patient data to a server

func (*Patient) MatchingEncounterReference

func (p *Patient) MatchingEncounterReference(entry Entry) *fhir.Reference

func (*Patient) UnmarshalJSON

func (p *Patient) UnmarshalJSON(data []byte) (err error)

type PhysicalQuantityResult

type PhysicalQuantityResult struct {
	Unit   string `json:"unit"`
	Scalar string `json:"scalar"`
}

Result Types

type Procedure

type Procedure struct {
	Entry
	AnatomicalTarget *CodeObject   `json:"anatomical_target"`
	Values           []ResultValue `json:"values"`
}

func (*Procedure) FHIRModels

func (p *Procedure) FHIRModels() []interface{}

type ResultValue

type ResultValue struct {
	TemporallyIdentified
	Physical *PhysicalQuantityResult
	Coded    *CodedResult
}

func (*ResultValue) FHIRModels

func (v *ResultValue) FHIRModels() []interface{}

func (*ResultValue) UnmarshalJSON

func (v *ResultValue) UnmarshalJSON(data []byte) (err error)

type TemporallyIdentified

type TemporallyIdentified struct {
	// contains filtered or unexported fields
}

func (*TemporallyIdentified) FHIRReference

func (t *TemporallyIdentified) FHIRReference() *fhir.Reference

func (*TemporallyIdentified) GetTempID

func (t *TemporallyIdentified) GetTempID() string

type UnixTime

type UnixTime int64

func NewUnixTime

func NewUnixTime(offset int64) *UnixTime

func (*UnixTime) FHIRDate

func (t *UnixTime) FHIRDate() *fhir.FHIRDateTime

func (*UnixTime) FHIRDateTime

func (t *UnixTime) FHIRDateTime() *fhir.FHIRDateTime

func (*UnixTime) Time

func (t *UnixTime) Time() time.Time

type VitalSign

type VitalSign struct {
	Entry
	Description    string        `json:"description"`
	Interpretation *CodeObject   `json:"interpretation"`
	Values         []ResultValue `json:"values"`
}

func (*VitalSign) FHIRModels

func (v *VitalSign) FHIRModels() []interface{}

Jump to

Keyboard shortcuts

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