Git Product home page Git Product logo

Comments (2)

jawalonoski avatar jawalonoski commented on June 7, 2024

The issue is that the FHIR:: module contains R4 resources only, and the FHIR::STU3:: module contains STU3 resources only, and the FHIR::DSTU2:: module contains DSTU2 resources only.

The client can parse different FHIR versions, but it does not monkey-patch any of the FHIR modules.

So, when you explicitly call FHIR::CommunicationRequest... you are explicitly saying "use R4 CommunicationRequest."

Apologies if this was not obvious or a point of confusion. We hope to improve the documentation and examples for this gem in the future. This should be a topic we cover.

from fhir_client.

rouaneta avatar rouaneta commented on June 7, 2024

Thanks @jawalonoski for the quick reply. The problem is that the behaviour is not the same for each client version. If we look more closely to the parse_reply method:

res = if(@fhir_version == :dstu2 || klass&.ancestors&.include?(FHIR::DSTU2::Model))
if(format.include?('xml'))
FHIR::DSTU2::Xml.from_xml(response.body)
else
FHIR::DSTU2::Json.from_json(response.body)
end
elsif(@fhir_version == :r4 || klass&.ancestors&.include?(FHIR::Model))
if(format.include?('xml'))
FHIR::Xml.from_xml(response.body)
else
FHIR::Json.from_json(response.body)
end
else
if(format.include?('xml'))
FHIR::STU3::Xml.from_xml(response.body)
else
FHIR::STU3::Json.from_json(response.body)
end
end

It appears that the behaviour is as follows (assuming that the format is xml - same behaviour for json):

  • case (i) if the client version is dstu2 I would go through FHIR::DSTU2::Xml.from_xml anyway
  • case (ii) if the client version is r4 I would go through FHIR::Xml.from_xml , except if I explicitly call FHIR::DSTU2::...Read, in which case I would go through FHIR::DSTU2::Xml.from_xml
  • case (iii) if the client version is stu3 it depends only on the module I call the read method on:
    FHIR::DSTU2::...Read -> FHIR::DSTU2::Xml.from_xml
    FHIR::...Read -> FHIR::Xml.from_xml
    FHIR::STU3::...Read -> FHIR::STU3::Xml.from_xml

In other words:

  • case (i) The client version takes precedence over the module called
  • case (ii) No clear priority between the client version and the module called
  • case (iii) The module takes precedence over the client version

from fhir_client.

Related Issues (20)

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.