Stream: implementers
Topic: DSTU2
Jose Holguin (Sep 10 2019 at 02:07):
Hello,
I'm trying to implement DSTU2 and I've been unable to add resources to my Patient obj. I found the instructions for STU3 and they work fine, but I'm unable to identify which changes are necessary in order for DSTU2 to work.
DSTU2.Patient Patientobj = new DSTU2.Patient();
DSTU2.Identifier IDobj = new DSTU2.Identifier("http://hl7.org/fhir/sid/us-ssn", "1234567890");
Patientobj.Identifier.Add(IDobj);
The error I get from visual studio is: The best overloaded method match for 'System.Collections.Generic.List<Hl7.Fhir.Model.Identifier>.Add(Hl7.Fhir.Model.Identifier)' has some invalid arguments. Does anyone have any suggestions on why the arguments are invalid and what changes are necessary?
Michele Mottini (Sep 10 2019 at 02:11):
Which library are you using? I'd say the identifier should not be DSTU2 but generic: new Identifier( . . . )
Michele Mottini (Sep 10 2019 at 02:12):
(note that in the error message the argument of add is Hl7.Fhir.Model.Identifier, not Hl7.Fhir.Model.DSTU2.Identifier)
Jose Holguin (Sep 10 2019 at 02:27):
So.. I need to use both STU3 and DSTU2, so I'm using extern aliases to support both. I think that may be part of the problem and maybe I made a mistake somewhere.
extern alias FHIRDSTU2;
extern alias FHIRSTU3;
using DSTU2 = FHIRDSTU2::Hl7.Fhir.Model;
using STU3 = FHIRSTU3::Hl7.Fhir.Model;
and then the properties of each library is named appropriately to match.
Michele Mottini (Sep 10 2019 at 02:31):
Oh I see - I thought you were using the multi-version library... no idea about aliases like that, never tried (I wrote and use the multi-version library)
Jose Holguin (Sep 10 2019 at 02:33):
which multi version library? Im very early in implementation, i dont mind switching
Jose Holguin (Sep 10 2019 at 02:34):
this is the library set I'm currently using, and it has a different library for each version: http://docs.simplifier.net/fhirnetapi/start.html
Michele Mottini (Sep 10 2019 at 03:08):
https://www.nuget.org/packages/CareEvolution.Fhir.Core/
Michele Mottini (Sep 10 2019 at 03:09):
It is one library with three Model.DSTU2, Model.STU3 and Model.R4 namespaces for the version-specific stuff and the Model namespace for the shared stuff
Jose Holguin (Sep 10 2019 at 03:12):
thanks! ill take a look
Michel Rutten (Sep 10 2019 at 08:58):
Hi Jose, make sure you reference the correct packages, i.e. select the DSTU2 release. Releases for different FHIR versions are incompatible. We're slowly moving parts of the library towards a new DSTU-agnostic model (e.g. ITypedElement
), but the classis PoCo based logic is a bit easier to learn and implement. So I suggest you try to implement the DSTU2 PoCo libraries, unless you need more flexibility.
Brian Postlethwaite (Sep 11 2019 at 09:48):
That looks like the right code, it's how I do it with the fhirpath tester, which is on github.
Moshe Gabay (Nov 10 2021 at 14:09):
hi guys . I am looking for DSTU2 typescript templates. Any ideas where i can find a reliable library?
Chris Moesel (Nov 10 2021 at 14:32):
Hi @Moshe Gabay. You might want to check out the #javascript stream, and more specifically, the typescript support thread. @types/fhir has R2 types.
Moshe Gabay (Nov 11 2021 at 09:53):
@Chris Moesel , thanks !! I ll check it out now.
Last updated: Apr 12 2022 at 19:14 UTC