GithubHelp home page GithubHelp logo

ember-fhir's People

Contributors

davekago avatar tylerneu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ember-fhir's Issues

Reverse Resource Includes

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 Response Not Interpreted as Array

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:

  1. Run ember-fhir-example branch, empty_query_response_example.
  2. Navigate to http://127.0.0.1:4200/patients/69459
  3. Notice "The response to store.query is expected to be an array but it was a single record." error in the brower's console.

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);
}

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.