Stream: dotnet
Topic: Validation errors
Kenneth Myhra (Sep 24 2019 at 09:27):
I'm getting some strange errors when trying to validate the resource below against this package https://simplifier.net/validate?fhirVersion=R4&scope=hl7.fhir.no.basis-2.0.4
For example this, (identifier[0].value does indeed exist in the example):
Invalid : Instance count for 'Organization.identifier.value' is 0, which is not within the specified cardinality of 1..1 Organization.identifier[0]
and this:
Invalid : Value is not exactly equal to fixed value 'urn:oid:2.16.578.1.12.4.1.2.102' Organization.identifier[0].system[0]
--
It could be there is something wrong with the profile (https://simplifier.net/hl7norwayno-basis/nobasisorganization), but I cannot pinpoint what that should be.
<Organization> <meta> <profile value="http://hl7.no/fhir/StructureDefinition/no-basis-Organization" /> </meta> <identifier> <system value="urn:oid:2.16.578.1.12.4.1.2.101" /> <value value="915933149" /> </identifier> <name value="Direktoratet for e-Helse" /> <address> <extension url="http://hl7.no/fhir/StructureDefinition/no-basis-address-official"> <valueBoolean value="true" /> </extension> <type value="postal" /> <line value="Postboks 221 Skøyen" /> <city value="OSLO" /> <postalCode value="0213" /> </address> <address> <extension url="http://hl7.no/fhir/StructureDefinition/no-basis-address-official"> <valueBoolean value="true" /> </extension> <type value="physical" /> <line value="Verkstedveien 1" /> <city value="OSLO" /> <postalCode value="0277" /> </address> </Organization>
Ewout Kramer (Sep 24 2019 at 09:41):
Hi Kenneth, the profile seems to be wrong, since the discriminator on this field is (type.coding.system), but I don't see any constraints actually fixing this value. The new 1.4 version of the API (which I am working on right now), should be able to report about these issues more reliably.
Kenneth Myhra (Sep 24 2019 at 10:32):
Thanks Ewout, I'll investigate some more
Thomas Tveit Rosenlund (Sep 25 2019 at 08:04):
@Kenneth Myhra @Ewout Kramer
I have done some fixes to the no-basis profiles, and it seems to have fixed second validation error. The first one persists however. As far as I have understood, this is a known issue in the validation using the .NET API
Thomas Tveit Rosenlund (Sep 26 2019 at 11:18):
One thing i did notice is that this file validates correctly: https://simplifier.net/hl7norwayno-basis/organization-example
But when i validate against the current package which should be updated (I updated it myself), I do get an error:
https://simplifier.net/validate
Ward Weistra (Sep 26 2019 at 13:09):
@Thomas Tveit Rosenlund https://simplifier.net/validate has an issue where it removes the identifier.value on validation: https://app.birdeatsbug.com/sessions/igoCL8CRRSZYh2O-2XdQ9 (reproduced on STU3 here, since R4 /validate does not show XML output yet).
Apparently this is because of this known API bug: https://github.com/FirelyTeam/fhir-net-api/issues/1071. Which is being worked on right now an should be in the next release.
Thanks for reporting!
Ewout Kramer (Sep 30 2019 at 19:34):
We found the cause of the issue. Although we agree the error is very unclear, it does mean you did not put your xml elements in the http://hl7.org/fhir
namespace! We will fix this in the next update...
Kenneth Myhra (Oct 01 2019 at 10:11):
@Thomas Tveit Rosenlund
Thomas Tveit Rosenlund (Oct 03 2019 at 05:52):
We found the cause of the issue. Although we agree the error is very unclear, it does mean you did not put your xml elements in the
http://hl7.org/fhir
namespace! We will fix this in the next update...
I don't understand this @Ewout Kramer. Should all conformance resources from HL7 Norway be available on hl7.org?
Thomas Tveit Rosenlund (Oct 03 2019 at 06:32):
Like this maybe:
http://hl7.org/fhir/xml.html#2.6.1
Michel Rutten (Oct 03 2019 at 09:05):
Correct, FHIR xml format requires the FHIR namespace on the root element:
FHIR elements are always in the namespace http://hl7.org/fhir
FHIR serialized will reject documents with other or missing namespace.
Ewout Kramer (Oct 04 2019 at 12:14):
No, but the instance you are validating should be in the hl7.org/fhir XML namespace!
Ewout Kramer (Oct 04 2019 at 12:15):
Your organization example looks like this:
<Organization>
should have been:
<Organization xmlns='http://hl7.org/fhir' >
Thomas Tveit Rosenlund (Oct 04 2019 at 13:04):
I understood this finally :-)
Luckily my examples have the namespace defined in my XML editor, SIMPLIFIER does strip all namespace information from the XML when it displays the examples though. So when you try to copy and paste the code into the validator you get the error.
Ward Weistra (Oct 04 2019 at 13:24):
Aha, we simplify the XML display on https://simplifier.net/HL7Norwayno-basis/Organization-example/~xml, but we're leaving out in that display something that the validator checks for...
Luckily they are indeed included in the profile, eg when you export the profile as XML.
I need to think if we need to change that. It will rarely be useful in the XML display (since it's always there for each FHIR resource) but if it leads to a validation error when using only the displayed part...
Martijn Harthoorn (Oct 07 2019 at 09:34):
There is an option to copy xml/json under the download button.
To make things easier by adding add a copy button (small clipboard icon). next to the xml/json itself.
Last updated: Apr 12 2022 at 19:14 UTC