davekago / ember-fhir Goto Github PK
View Code? Open in Web Editor NEWEmber adapter for implementing hl7 fhir resources in Ember applications
License: MIT License
Ember adapter for implementing hl7 fhir resources in Ember applications
License: MIT License
I would like to see FHIR Reverse Resource Includes supported. The first hurdle is supporting multiple query parameters of the same name.
return this.store.queryRecord('patient', {
_id: params.patient_id,
_revinclude: ['Encounter:patient', 'Condition:patient']
});
/Patient?_id=1&_revinclude[]=Encounter:patient&_revinclude[]=Condition:patient
FHIR does not recognize the trailing []
that jQuery's param()
produces by default. Setting traditional
to true
addresses this but I haven't explored side affects
A second obstacle is serializing the multiple types of resources that will be returned in these sets. Something like this in normalizeResponse
could return a hash of resources.
// payload entries may have different resource types, hash them individually
for (var i = 0; i < resourceArray.length; i++) {
if (resourceArray[i]) {
var type = resourceArray[i].resourceType.dasherize().pluralize();
if (hash[type] === undefined) {
hash[type] = [];
}
hash[type].push(resourceArray[i]);
}
}
I'm happy to submit changes but these felt big enough that I wanted to get ideas and input first.
Empty .query
responses (below) generate an error because they are being interpreted as a single record instead of an array as .query
expects.
http://fhirtest.uhn.ca/baseDstu3/Encounter?patient=Patient%2F69459
{
"resourceType": "Bundle",
"id": "33468e3f-9e1e-481d-8286-7c356db0ae19",
"meta": {
"lastUpdated": "2017-06-13T11:13:13.008-04:00"
},
"type": "searchset",
"total": 0,
"link": [
{
"relation": "self",
"url": "http://fhirtest.uhn.ca/baseDstu3/Encounter?patient=Patient%2F69459"
}
]
}
Reproduction:
ember-fhir-example
branch, empty_query_response_example
.I had been working with a DSTU2
adapter & had the following solution for this problem. There is a good chance I'll submit a PR soon.
// This is a query where nothing was returned.
// Create an empty array in the hash so that subsequent parsing doesn't complain that there are 0 expected objects
if (payload.total === 0) {
hash[Ember.String.pluralize(primaryModelClass.modelName)] = [];
return this._super(store, primaryModelClass, hash, id, requestType);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.