GithubHelp home page GithubHelp logo

fhir's Introduction

Intervention Engine FHIR Server Build StatusGoDoc

NOTE: This project is not under active development. Others have forked and continue work on the code. If you would like your fork added/removed from this list, please file an issue.

Active Forks

This project provides HL7 FHIR DSTU2 models and server components implemented in Go and using MongoDB as storage. Other versions of FHIR are also supported on other branches within this repository:

This is a library that can be embedded into other server applications. The library is not a complete implementation of FHIR, as features that are selected are driven by the Intervention Engine, eCQM Engine, Patient Matching Test Harness and Synthetic Mass projects.

Currently, this server library supports:

  • JSON representations of all resources
  • Create/Read/Update/Delete (CRUD) operations
  • Conditional update and delete
  • Some but not all search features
    • All defined resource-specific search parameters except composite types and contact (email/phone) searches
    • Chained searches
    • _include and _revinclude searches (without _recurse)
  • Batch bundle uploads (POST, PUT, and DELETE entries)

Currently, this server does not support the following major features:

  • XML representations of resources
  • History (versions, etc.)
  • Extension of primitive types and resource sub-components

As mentioned above, this repository contains a library. It does not build into a stand alone application. If you would like to build a server application, please see fhir-server project.

NOTE: Most of the fhir source code is generated by the fhir-golang-generator. In most cases, updates to source code in the fhir repository need to be accompanied by corresponding updates in the fhir-golang-generator.

Development

This project uses Go 1.7 and MongoDB. To test the library, first, install all of the dependencies:

$ go get -t ./...

Once the dependencies are installed, you should make sure that MongoDB is also running. The test suite will create a fhir-test database in a local instance of MongoDB to execute some tests. You can then run the test suite with the following:

$ go test ./...

Usage

Users of this library should work with the FHIRServer struct. Web request handlers in this library are implemented using Gin.

Examples of usage can be found in the server set up of the eCQM Engine or the server set up of Intervention Engine.

License

Copyright 2017 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.

fhir's People

Contributors

cmoesel avatar eedrummer avatar ssayer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fhir's Issues

"Open Type Elements" have incomplete representation

"Open Type Elements" are those elements whose type is represented as "*" and generally have names like value[x]. Currently, our code has representations for the following types:

  • String
  • Integer
  • DateTime
  • Boolean
  • CodeableConcept
  • Range

According to the spec, however, there are quite a few more types. See 1.19.0.18 Open Type Element for the full list. This affects Parameters, Extension, and ElementDefinition. The generator should be updated to represent the full spectrum of types.

C-CDA

Hi, C-CDA to FHIR and vice versa conversation possible? Any help would be appreciated.

Thanks

Long-Term Organization of This Repo

Now that FHIR 2 has been released, we should consider our long-term organization of this repository. Ideally I'd like to see 4 or 5 tagged releases instead of many branches, one for each of:

  • DSTU2
  • DSTU3 1.4
  • DSTU3 1.6
  • DSTU3 1.8
  • STU3

Was there a 1.2?

Searching for message:MessageHeader.destination-uri now returns OperationOutcome and no result

Querying FHIR server for /Bundle?message:MessageHeader.destination-uri=urihere is no longer returning search results. Instead, an operation outcome with an error is returned.

Querying for /Bundle?message:MessageHeader works as expected.

A patch file with a suggested unit test is attached.

This uri against the IE FHIR Server embedded with ptmatch returns the json below:
http://localhost:3001/Bundle?message:MessageHeader.destination-uri=http://mitre.org/ptmatchadapter-fril

{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "processing",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/operation-outcome",
"code": "MSG_PARAM_MODIFIER_INVALID",
"display": "Parameter "message" modifier is invalid"
}
],
"text": "Parameter "message" modifier is invalid"
}
}
]

}

Extensions in Contained Resources Not Unmarshaled Correctly

This is a known issue when retrieving resources that inherit from DomainResource and have one or more contained resources. As these resources are unmarshaled from the database the exact type of the contained resources is not known, so they are unmarshaled into the generic interface{} type.

This unmarshaling operation names the fields in this interface{} exactly as they are in the database, meaning the id is actually _id, and the fields used to store the extension (@context, @id, @type) remain that way.

The _id field is corrected to id in the web layer before being returned to a client, but the extensions are not.

Running IE and FHIR in parrallel

Both of servers, fhit and ie, bind to port 3001. I understand both need to be running but maybe I'm missing something. Is there an up and running guide that outlines setup for all the inter-related components?

XML parsing fails

XML parsing doesn't work at all. The struct tags for XML are all of the form

`xml:"tag"`

but the values are taken from the "value" attribute. The problem is that it is not possible to specify that the value for an element is taken from an attribute of the same element. It is only possible to specify that the value of a field of the element is taken from an attribute. As a result, the struct tags don't correspond to the XML format, and parsing fails. See this Stackoverflow discussion for details.

The solution seems to be to implement a custom unmarshaller/marshaller for XML that is aware of this usage of the "value" attribute.

Content-Type of responses for FHIR Resources should be application/json+fhir

FHIR Spec (DSTU2) Section 2.1.0.6 () states the formal mime type for fhir resources is application/json+fhir.
The formal MIME-type for FHIR resources is application/xml+fhir or application/json+fhir. The correct mime type SHALL be used by clients and servers:
• XML: application/xml+fhir
• JSON: application/json+fhir

The intervention engine FHIR server returns application/json

Bundle composition and message search params do not work

The Bundle composition and message search parameters do not currently work in our server because the paths are defined with indexers (e.g., Bundle.entry.resource(0)). In addition, this is compounded by the issue that we don't support chaining into inlined resources.

Chained search does not work for inlined resources

Some resources contain other resources inlined rather than as references (e.g., bundle.entry.resource). The fhir server does not properly handle chained queries that chain into these inlined resources.

Inheritance of Resource, DomainResource, Element and BackboneElement

In the XML Schema Resource, DomainResource, Element and BackboneElement are parent types of most of the data and resource types. In particular, they include fields like Language and Extension. These seem to be absent from the various classes, or am I missing something?

Conformance Statement?

Any thoughts on how to include/generate a conformance statement for this server? (from implementer's check list)

Ideas could be - create a conformance model (Resource) and manually populate it, or find a way to introspect the go code to determine which models and parameters are implemented and then generate the conformance model?

Tests fail on git clone (mongo_indexes_test.go)

Perhaps I am doing it wrong, but I am getting a fail in the mongo index test. I have mongo installed and running, missing another prereq?

ok fhir/auth 0.024s
ok fhir/models 0.025s
ok fhir/search 1.904s
--- FAIL: TestMongoIndexes (0.00s)
panic: mkdir ./testdb: file exists [recovered]
panic: mkdir ./testdb: file exists

goroutine 6 [running]:
testing.tRunner.func1(0xc4202120f0)
/usr/local/go/src/testing/testing.go:711 +0x2d2
panic(0xf049e0, 0xc4201df080)
/usr/local/go/src/runtime/panic.go:491 +0x283
fhir/server.(*MongoIndexesTestSuite).SetupSuite(0xc42016ab40)
/home/plamar/go/src/fhir/server/mongo_indexes_test.go:54 +0x84f
github.com/stretchr/testify/suite.Run(0xc4202120f0, 0x178c4a0, 0xc42016ab40)
/home/plamar/go/src/github.com/stretchr/testify/suite/suite.go:64 +0x63b
fhir/server.TestMongoIndexes(0xc4202120f0)
/home/plamar/go/src/fhir/server/mongo_indexes_test.go:96 +0x51
testing.tRunner(0xc4202120f0, 0x10b3a88)
/usr/local/go/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:789 +0x2de
FAIL fhir/server 0.035s
ok fhir/upload 0.025s

When GETting a Bundle, the embedded resources don't appear to get unmarshalled as desired

POST a Bundle to the FHIR Server. Note the new Bundle identifier. Open a new browser window and request the bundle from the FHIR server.

The resource identifier for embedded resources will be _id.
Also, it appears the timestamp is cominb back in the BSON format rather than then FHIR format.

    "timestamp": {
      "precision": "timestamp",
      "time": "2016-09-07T12:14:51-04:00"
    }

RequestMessageReturnedFromFhirServer.txt
RequestMessageBeforePostingToServer.txt

A POSTed Bundle containing an Id is processed without error

The FHIR server accepts a Bundle containing an Id, changes the value of the Id, and returns success.

FHIR Spec Section 2.1.0.13 states: “If the client wishes to have control over the id of a newly submitted resource, it should use the update interaction instead.” In fact, if we’re accepting the post and re-assigning the ID, we’re in violation of the spec ourselves, as it further states: “If an ID element is provided, the server SHALL respond with a HTTP 400 error code, and SHOULD provide an operation outcome identifying the issue.” .

_include and _revinclude not working when included param references array

If the included param references a field that is an array, then the included results are not returned (for example, _include=Observation:performer). This is because MongoDB's left-join (a.k.a. $lookup) doesn't work with array fields. You need to unwind the arrays and then group them back together again.

See:

Installation Issues on Mac OS X

First I clone to github.com/intervention-engine\fhir. MongoDB 3+ is already running. The tests fail and the server startup fails although it does appear to connect to MongoDB.

Here is the test output:

$ go test ./...
# github.com/intervention-engine/fhir/models
models/bundle_test.go:8:2: cannot find package "github.com/bitly/go-simplejson" in any of:
/usr/local/go/src/github.com/bitly/go-simplejson (from $GOROOT)
/Users/alan/Documents/work/src/github.com/bitly/go-simplejson (from $GOPATH)
FAIL    github.com/intervention-engine/fhir/models [setup failed]
# github.com/intervention-engine/fhir/search
search/mongo_search_test.go:15:2: cannot find package "github.com/pebbe/util" in any of:
/usr/local/go/src/github.com/pebbe/util (from $GOROOT)
/Users/alan/Documents/work/src/github.com/pebbe/util (from $GOPATH)
FAIL    github.com/intervention-engine/fhir/search [setup failed]
# github.com/intervention-engine/fhir/server
search/mongo_search_test.go:15:2: cannot find package "github.com/pebbe/util" in any of:
/usr/local/go/src/github.com/pebbe/util (from $GOROOT)
/Users/alan/Documents/work/src/github.com/pebbe/util (from $GOPATH)
FAIL    github.com/intervention-engine/fhir/server [setup failed]
# github.com/intervention-engine/fhir/upload
search/mongo_search_test.go:15:2: cannot find package "github.com/pebbe/util" in any of:
/usr/local/go/src/github.com/pebbe/util (from $GOROOT)
/Users/alan/Documents/work/src/github.com/pebbe/util (from $GOPATH)
FAIL    github.com/intervention-engine/fhir/upload [setup failed]
?       github.com/intervention-engine/fhir [no test files]

Here is the output from the server start attempt:

$go run server.go
panic: no reachable servers

goroutine 1 [running]:
github.com/intervention-engine/fhir/server.(*FHIRServer).Run(0xc820101ee8)
/Users/alan/Documents/work/src/github.com/intervention-engine/fhir/server/server_setup.go:34 +0xa8
main.main()
/Users/alan/Documents/work/src/github.com/intervention-engine/fhir/server.go:13 +0x15f

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 20 [sleep]:
time.Sleep(0x1dcd6500)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoCluster).syncServersLoop(0xc8200bc200)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/cluster.go:386 +0x484
created by gopkg.in/mgo%2ev2.newCluster
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/cluster.go:78 +0x1d0

goroutine 55 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc82019e540, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 26 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc8201480e0, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 31 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc8201481c0, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 32 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc8201482a0, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 45 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc82015ac40, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 80 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc820148a80, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 61 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc82019eb60, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 70 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc820148700, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 75 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc8201488c0, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 82 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc82015ad20, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160

goroutine 102 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc82020a1c0, 0x1)
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:296 +0x1b0
created by gopkg.in/mgo%2ev2.newServer
/Users/alan/Documents/work/src/gopkg.in/mgo.v2/server.go:89 +0x160
exit status 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.