feat: Gracefully handle primitive extensions in a backwards-compatible way#1
feat: Gracefully handle primitive extensions in a backwards-compatible way#1viggyfresh wants to merge 4 commits intomainfrom
Conversation
|
Have we taken a look at the serialization/deserialization layer? It makes more sense to put the functionality to handle primitive extensions there rather than adding primitive extensions to every primitive field |
hmm as far as I can tell that code successfully stores primitives on the python object but doesn't serialize them (which is the |
i guess another option is to just override the serializer there, but that would involve even more hardcoding and checks I think (and break out of the validation we get for free here - if you try to pass an incompatible primitive extension it actually yells at you) |
|
So I think why this seems convoluted to me is this repo doesn't actually model out all the different primitive datatypes in fhir, they've began it with fhirdate, and some of the other date/time related datatypes but they don't have all of them like string, int, markdown, oid, uuid, canonical, etc. I think to get the serializer/deserializer to work we'd need to have a primitive abstract base class that inherits from an element abstract base class, and the primitive data classes will inherit the primitive ABC and then we can have changes to the serializer/deserializer to parse the fields correctly. |
yep - if you check out the issue discussion linked in the top, they actually suggest this as an approach. HOWEVER, the blast radius of such a change is basically a full rewrite of all of our codebase that touches fhir. we (like every other |
Derived from the issue thread here: smart-on-fhir#30
Specifically implements the "underscored shadow fields" suggested here: smart-on-fhir#30 (comment) with the implementation strategy espoused here: smart-on-fhir#30 (comment)
Consistent in implementation style to https://github.com/smart-on-fhir/Swift-FHIR, just takes the alternate approach to custom
FHIR*fields for primitives since we already heavily rely on the primitives directly (would be nasty to switch every usage offhir_resource.stringtofhir_resource.fhir_string.value).