FHIR Chat · Working with CodeableConcepts · dotnet

Stream: dotnet

Topic: Working with CodeableConcepts


view this post on Zulip Joe Mundi (Jan 14 2021 at 15:32):

Hi, I'm using the HL7.Fhir.R4.Core SDK trying to extract information from a MedicationStatement. My understanding is that a MedicationStatement resource can contain either a Medication resource reference or a CodeableConcept in the medication[x] attribute. In the SDK, the MedicationStatement.Medication property is polymorphic. When it's a CodeableConcept, I'm having trouble getting the Code object from the Medication property on the MedicationStatement object. Is there a pattern or idiom you're supposed to use? When debugging, I can see the Code object as a member, but I can seem to get to it. Any code samples to help?

view this post on Zulip Michele Mottini (Jan 14 2021 at 15:35):

if ( medicationStatement.Medication is CodeableConcept medicationCodeableConcept ) { /// medicationCodeableConcept.Coding contains the list of codes here }

view this post on Zulip Joe Mundi (Jan 14 2021 at 15:38):

Thank you very much, Michele. I'll try that. (I didn't know the C# is operator. Guess I better become familiar with the latest language features!) :upside_down:


Last updated: Apr 12 2022 at 19:14 UTC