Stream: implementers
Topic: Profile Validation
Stephen Lloyd (Nov 22 2016 at 15:44):
Does anyone happen to have a very simple example of a profile & a resource please? I am trying to get the validation to work but constantly get non-informative messages "Unexpected failure while validating resource". I just want to make sure that the random profiles we have created are/are not the problem (and not a problem with HAPI et al.).
Stephen Lloyd (Nov 22 2016 at 15:47):
Also, Have tried to use the validator jar both from the command line & in java with both our profiles(custom StructureDefinition) & some random ones from various public servers but to no avail. .. validate (xml) null ptr exception
Jason Walonoski (Nov 22 2016 at 15:49):
Is your XML valid? My guess is you have a problem there. Try validating against the schema before using any StructureDefinition specific validators...
Stephen Lloyd (Nov 22 2016 at 15:58):
Can I ask what you tend to use for XML validation please? I have used the NotePad++ XMLTools plugin and they state there is a problem with the StructureDefinion.xsd file. Element '<w3 url>' complexType: ExtensionContext does already exist. The Visual Studio one was also displaying some problems with the xsd file when I test it yesterday (can find out what they were again if required).
Eric Haas (Nov 22 2016 at 16:06):
FWIW I use XMLSpy to schema check. (I have used the notepad ++ which worked great for a while but now errors and I can't debug.) I also routinely run the jar from the command line without issues. Another way is to upload (POST) a resource to a reference server they validate and will error with a message. I'm most comfortable using the healthintersection server and something like Fiddler or Postman for doing this.
Stephen Lloyd (Nov 22 2016 at 16:21):
Thanks Gents, I'll give XMLSpy a try and see what comes up. The problem with healthintersection et. al. that I'm seeing is that all I get back is "Unexpected failure while validating resource" which doesn't really help.
Stephen Lloyd (Nov 22 2016 at 16:55):
XMLSpy did in fact identify some issues with our profile when compared to the scheme, however we're still getting the same error so will have to try finding a simple example to see what we've missed in our ignorance. Cheers.
Oliver Egger (Nov 22 2016 at 20:06):
Another way is to use eclipse with the Web Tools Platform http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.wst.xmleditor.doc.user%2Ftopics%2Ftwxvalid.html. You have to adjust the path to the schema (.xsd) in the xml file like:
<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://hl7.org/fhir ../../schemas/fhir-all.xsd">
If that gives no errors the next step is to apply the schematrons to the xml, I personally prefer to use then the validator directly. If you don't mind posting your StructureDefinition and version your running it against (DSTU2 or current build) I can redo the check here.
Grahame Grieve (Nov 23 2016 at 05:32):
my apologies that validation isn't working well at the moment. The spec is rolling over so quickly as the milestone approaches that I can't always keep everything working
Anand Mohan Tumuluri (Apr 25 2017 at 18:03):
Just started trying out the profile validation in HAPI (using HL7OrgDSTU2) and noticed a couple of issues
1. Even though I provide a complete expansion of a valueset (using IValidationSupport.expandValueSet), the default ValueSetExpanderFactory implementation limits to 500 codes. This returns a ETooCostly with a ValueSetChecker which triggers the costly expansion again. Using HAPI's FHIRContext based validator, there is no way to explicitly set a different ValueSetExpanderFactory (its possible using the RI's InstanceValidator class)
The IValidationSupport interface should ideally provide both options of expanding a valueset(ValueSet/$expand) and validating a code against a valueset (ValueSet/$validate-code). Users can choose which interface they want to implement
2. The default ValueSetExpanderSimple does not handle multiple filters for compose.include or compose.exclude. Quoting the comment "// need to and them, and this isn't done yet. But this shouldn't arise in non loinc and snomed value sets"
However, Encounter-reason is an example with multiple include filters and there may be others as well.
3. RI's InstanceValidator routinely gives messages such as "Binding for path /f:Encounter/f:reason/f:coding has no source, so can't be checked". In this case, its trying the validate the Coding field within the CodeableConcept. The CodeableConcept has a valueset binding but the Coding does not. I dont really think that it makes sense to validate the Coding within CodeableConcept and should just be validating the CodeableConcept as a whole (which it seems to do anyway).
Grahame Grieve (Apr 25 2017 at 21:09):
1. @James Agnew I don't know why it's using expand? I don't think it's from my code?
2. Encounter Reason has multiple includes, not multiple filters on a single include. Are you actually having a problem with this?
3. I'll haev to fix that
Anand Mohan Tumuluri (Apr 26 2017 at 04:16):
More issues with DSTU2 profile validation and this one is with RI's Validator itself.
I had created a Patient resource claiming to conform to DAF but with a wrong code for us-core-race according to its valueset binding. (system: http://hl7.org/fhir/v3/Race, code: 1010-8 is not part of the required valueset binding for us-core-race (http://hl7.org/fhir/dstu2/daf/valueset-daf-race.html)
I assumed the valueset validation to fail given the wrong code in use but nothing of that sort happened. The output is identical whether using HAPI or RI and the RI output is given below.
java -jar org.hl7.fhir.validator.jar daf1.json -defn validation-min.xml.zip -profile http://hl7.org/fhir/StructureDefinition/daf-patient .. load definitions from validation-min.xml.zip .. connect to terminology server http://fhir2.healthintersections.com.au/open .. load profile http://hl7.org/fhir/StructureDefinition/daf-patient .. load daf1.json .. validate (json) Validating daf1.json: 2 messages ERROR @ Element '.identifier': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ Element '.identifier': minimum required = 1, but only found 0 (src = InstanceValidator) ...failure
Anand Mohan Tumuluri (Apr 26 2017 at 04:17):
The wrong resource in question
{ "resourceType": "Patient", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/daf-patient" ] }, "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/us-core-race", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/v3/Race", "code": "1010-8" } ] } } ], "name": [ { "family": [ "Chiguren" ], "given": [ "John" ] } ] }
Anand Mohan Tumuluri (Apr 26 2017 at 04:19):
The validator.zip and the validation-min.xml.zip are both from DSTU2
http://hl7.org/fhir/dstu2/validation-min.xml.zip
http://hl7.org/fhir/dstu2/validator.zip
Anand Mohan Tumuluri (Apr 26 2017 at 04:24):
I am sure that I am missing something as I dont believe that such a basic use case fails in the RI. Any help is really appreciated.
Anand Mohan Tumuluri (Apr 26 2017 at 18:00):
Never mind, I got my answer. There is no implementation to check the validity of the extension content in DSTU2. (InstanceValidator.java:389, no code after the helpful comment :-) )
Its there in STU3 and now I have to maintain my own copy of DSTU2's InstanceValidator with this and other changes.
Lloyd McKenzie (Apr 26 2017 at 23:44):
You can (and should) use the most recent CI build validator whether you're validating STU 2, STU 3 or "current" resources.
Anand Mohan Tumuluri (Apr 27 2017 at 03:30):
May be I misunderstood you, but even the latest DSTU2 validator at https://github.com/hl7-fhir/fhir-svn/blob/master/implementations/java/org.hl7.fhir.validation/src/org/hl7/fhir/dstu2/validation/InstanceValidator.java#L620 doesnt have the validation of extension content. Should I check some other place instead? Thanks
Lloyd McKenzie (Apr 27 2017 at 03:58):
The current validator jar is at build.fhir.org. The current code is at http://gforge.hl7.org/svn/fhir/trunk/build. Not sure what's hosted at github . . .
Grahame Grieve (May 01 2017 at 03:35):
the code you are referring to is orphaned and on the way out. The current validator can validate R2 resources and you should use that
Anand Mohan Tumuluri (May 01 2017 at 21:03):
I had downloaded the validator from http://build.fhir.org but that only seems to support validation from FHIR 1.4.0. I am looking to validate DSTU2 resources conforming to 1.0.2
Eric Haas (May 01 2017 at 23:00):
I tried it as well and was not able to validate dstu2 instance using the latest validator. ( the DSTU2 validator works though) here is my error:...
Eric Haas (May 01 2017 at 23:01):
Erics-Air-2:Argo-DSTU2 ehaas$ bash validate2.sh
=========================================================================
======= Validate Argo-DQ(DSTU2) IG! Mon May 1 22:58:55 UTC 2017 =========
=========================================================================
Type the file name of the resource that you want to check:
23.xml
validating /Users/ehaas/Documents/FHIR/Argo-DSTU2/examples/23.xml...
.. load FHIR from /Users/ehaas/Downloads/validation.xml.zip
.. connect to tx server @ http://fhir2.healthintersections.com.au
Exception in thread "main" org.hl7.fhir.exceptions.FHIRFormatError: Error parsing extension-definitions.xml:Unknown Content display @ START_TAG seen ...t was discovered"/>\n <display value="discovery date time"/>... @16:47
at org.hl7.fhir.r4.context.SimpleWorkerContext.loadFromFile(SimpleWorkerContext.java:176)
at org.hl7.fhir.r4.context.SimpleWorkerContext.loadDefinitionItem(SimpleWorkerContext.java:149)
at org.hl7.fhir.r4.context.SimpleWorkerContext.fromDefinitions(SimpleWorkerContext.java:142)
at org.hl7.fhir.r4.validation.ValidationEngine.loadDefinitions(ValidationEngine.java:176)
at org.hl7.fhir.r4.validation.ValidationEngine.<init>(ValidationEngine.java:170)
at org.hl7.fhir.r4.validation.Validator.main(Validator.java:232)
Caused by: org.hl7.fhir.exceptions.FHIRFormatError: Unknown Content display @ START_TAG seen ...t was discovered"/>\n <display value="discovery date ti
Anand Mohan Tumuluri (May 01 2017 at 23:08):
I got this error when I was using DSTU2 definitions with the latest validator. I had been trying numerous combinations of DSTU2/STU3/Current definitions and different versions of Terminology services (http://tx.fhir.org/r2 or http://tx.fhir.org/r3) and nothing works for validating DSTU2 resources
Jens Villadsen (May 04 2017 at 15:21):
Where's the source code for the 'official' validator found at https://www.hl7.org/fhir/downloads.html?
Jens Villadsen (May 04 2017 at 15:22):
is it publicly available or do I have to decompile it?
Grahame Grieve (May 04 2017 at 15:26):
it's in the fhir svn
Grahame Grieve (May 04 2017 at 15:26):
use the current build
Jens Villadsen (May 04 2017 at 15:29):
svn ... dat shit's ol'skool ;)
Jens Villadsen (May 04 2017 at 16:10):
found it. thx
Anand Mohan Tumuluri (May 15 2017 at 16:53):
The recent commit (on May 1) into RI from Grahame Grieve fixes many of the issues with validating DSTU2 resources. Thanks a lot.
@James Agnew will these changes make it into HAPI soon?
Anand Mohan Tumuluri (May 16 2017 at 06:02):
@Grahame Grieve Even with the latest validator, invariant checking is not working for DSTU2 resources. For example, the below resource should have failed the constraint on Patient.contact but it doesnt report any errors.
<?xml version="1.0" encoding="UTF-8"?> <Patient xmlns="http://hl7.org/fhir"> <identifier> <system value="http://acme.org/mrns"/> <value value="3274832784"/> </identifier> <name> <family value="Cousin"/> <given value="Peter"/> </name> <contact> <relationship> <coding> <system value="http://hl7.org/fhir/patient-contact-relationship"/> <code value="friend"/> </coding> </relationship> </contact> </Patient>
Pranitha Sruthi (Aug 23 2017 at 10:40):
Hi @Grahame Grieve when I am trying to validate a profile on http://test.fhir.org/r3, some errors are getting displayed as in the screenshot below.validation-error.PNG How can I fix the errors? Thank you
Grahame Grieve (Aug 23 2017 at 13:28):
hmm. slice errors - probably my server is the problem; it's a bit behind the java validator which is the gold standard
Mounika (Aug 24 2017 at 05:34):
Hi all, I am creating a new profile based on my requirements. So how do we know newly created profile is valid or not. Can anyone tell me. Thank you.
Grahame Grieve (Aug 24 2017 at 06:43):
if the IG publisher doesn't give you any errors, then you don't have any errors we know how to detect
Jayashree Surnar (Aug 24 2017 at 07:11):
(deleted)
Mounika (Aug 24 2017 at 10:15):
https://www.hl7.org/fhir/validation.html In this documation given how to validate the examples But not given How to validate the profiles. Can't we validate the profile before ig publishing?
Josh Mandel (Aug 24 2017 at 10:28):
(deleted)
Haseeb (Aug 24 2017 at 11:30):
Hi,
I have created a profile MyPatient and have created an extension in MyPatient called clinicalTrial. This is one of the Extensions that come with the Patient profile. When I try to validate MyPaitent Profile using Simplifier I get following errors:
1. Element must not be empty
Location: StructureDefinition.meta[0]
2. Instance failed constraint sdf-20 "No slicing on the root element"
Location: StructureDefinition.differential[0]
3. Instance failed constraint sdf-14 "All element definitions must have an id"
Location: StructureDefinition
Can someone please point me to a solution for this. Thanks for your help.
Michel Rutten (Aug 24 2017 at 11:37):
Hi @Haseeb, these warnings are caused by separate issues:
1) Unclear; does the profile specify any constraints on the .meta element?
2) sdf-20 - the fhirpath expression in the core spec is incorrect, I've recently submitted a tracker issue to gForge about this.
3) Forge forgets to generate an element id for the extension slicing entry. This will be fixed in the next release.
Haseeb (Aug 24 2017 at 11:49):
Hi @Michel Thanks for your quick response.
For the first error message, from looking at the Profile, Location meta[0] is 'extension'. I did not change anything except adding the extension in the base Patient resource. I did not explicitly change the metadata.
For second and third error message, what would you suggest for the workaround. I did notice that no element id is generated but the field is not editable in Forge.
Thanks for your help.
Michel Rutten (Aug 24 2017 at 12:00):
Hi @Haseeb, you can safely ignore warning (2), as this needs to be fixed in the spec.
You currently cannot fix the missing element id from within Forge (but you could fix it manually). I've already fixed the issue in the internal development branch, the fix will be included in the next release.
Michel Rutten (Aug 24 2017 at 12:00):
Not sure about the first warning, but it is probably related to the other ones.
Eric Haas (Aug 24 2017 at 18:14):
for validating profiles validate against StructureDefinition.... Is that what you are asking? you can do that prior to ig publishing. a profile is the same as an example - an instance of a resource. in this case StructureDefinition
Haseeb (Aug 25 2017 at 09:14):
Hi @Michel Thanks for looking into these issues. I fixed the element id manually and then validated the profile using the Java validator i.e. org.hl7.fhir.validator.jar I got only one error which is the slicing issue and which you said I can safely ignore:
FAILURE validating C:\Users\haseeb\Documents\StructureDefinitions\MyPatient.structuredefinition.xml: error:1 warn:0 info:0
Error @ StructureDefinition.differential (line 17, col17) : No slicing on the root element [element.first().slicing.empty()]
Now that when I publish my profile on Simplifier and also to my vonk FHIR server on my machine and try to POST a patient json including the extension in it I get 400 Bad Request error:
"issue": [
{
"severity": "fatal",
"code": "exception",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
"code": "5003"
}
],
"text": "Resource to create could not be parsed."
}
},
{
"code": "not-supported",
"details": {
"coding": [
{
"code": "not handled"
}
],
"text": "/Patient"
},
"diagnostics": ""
}
I did also publish the profile on https://sb-fhir-stu3.smarthealthit.org/smartstu3/open and POSTed a patient json including the clinicalTrial extension, the Patient gets created but the server conveniently ignore the extension. I have spent some time investigating why its not accepting the updated Patient but I have no way of confirming whether my approach is wrong or there is issue with the created profile.
Thanks for your help.
Haseeb
Mirjam Baltus (Aug 25 2017 at 10:46):
You can get rid of the error in your profile with this workaround in Forge:
- in the options menu, select the "show common resource elements"
- in your profile, edit the 'id' element by adding a space to the description
- save the profile, it will now validate correctly
The issue you're having with posting a patient to the server seems to be with wrong data. Can you check if your syntax is correct and you're sending a valid Patient?
Haseeb (Aug 25 2017 at 11:04):
Thanks @Mirjam Baltus I am going to make the changes and let you know how I get on.
Michel Rutten (Aug 25 2017 at 11:51):
Hi @Haseeb, the incorrect invariant sdf-20 currently complains if the first element in the differential has a sliceName. I've already submitted a tracker issue to gForge about this.
As a workaround for the current FHIR release, to prevent the validation message, make sure that the first actual constraint in your profile is on an element without a sliceName. For example, add a dummy comment to the root element. This should prevent sdf-20 from being triggered.
Haseeb (Aug 25 2017 at 15:17):
Hi @Mirjam and @Michel, Thanks for your help. I have been able to get my profile with Extension validated and then created a patient using this profile in my vonk instance. I'll be creating a good few profiles to map our workflow in coming days but its a big relief to be able to get it working. Thanks again :)
Michel Rutten (Aug 25 2017 at 15:23):
Hi @Haseeb, you're welcome! I'm happy to see that you're up and running.
Pranitha Sruthi (Aug 28 2017 at 04:51):
@Grahame Grieve then how can I validate a profile?
Lloyd McKenzie (Aug 28 2017 at 15:15):
First, read through this whole thread. If you have further questions, ask them about specifics already discussed here.
Anand Mohan Tumuluri (Sep 19 2017 at 19:07):
Stupid Question: Are there any xpath to fhirpath expression conversions available? We are currently using the R4 validator to validate DSTU2 resources and its working fine except for the invariant validation. We would like to get validation of invariants working.
Grahame Grieve (Sep 19 2017 at 20:51):
the validator should evaluate the xpaths in that circumstance
Anand Mohan Tumuluri (Sep 21 2017 at 19:49):
It doesn't seem to do that, there is a check to see if the constraint has expression and only validates if it has an expression in InstanceValidator#checkInvariants
Jens Villadsen (Oct 06 2017 at 13:17):
any chance that the validator tool could be hosted on github and not just as a mirror ... - it would make it easier to make contributions that way and report bugs
Grahame Grieve (Oct 06 2017 at 18:06):
"not just as a mirror"?
Jens Villadsen (Oct 09 2017 at 07:38):
@Grahame Grieve are you saying that you'll look into pr's done on github? If that's the case, that is awesome
Michel Rutten (Oct 09 2017 at 09:02):
@Jens Villadsen Ewout also publishes a stand-alone .NET profile validation tool on github:
https://github.com/ewoutkramer/Furore.Fhir.ValidationDemo
Jens Villadsen (Oct 09 2017 at 09:03):
@Michel Rutten - is it still maintained?
Michel Rutten (Oct 09 2017 at 09:04):
Sure! Just make sure to fetch the latest .NET API library packages from NuGet.
Jens Villadsen (Oct 09 2017 at 09:05):
+1
Michel Rutten (Oct 09 2017 at 09:05):
And of course, Ewout actively maintains the .NET validator.
Jens Villadsen (Oct 09 2017 at 09:21):
https://github.com/ewoutkramer/Furore.Fhir.ValidationDemo seems like there are couple of missing imports
Michel Rutten (Oct 09 2017 at 09:24):
Which branch? I think you should try develop-stu3.
Jens Villadsen (Oct 09 2017 at 09:24):
my bad ... I did the master
Grahame Grieve (Oct 09 2017 at 09:25):
@Jens Villadsen I didn't say anything yet - I was just asking what you meant
Jens Villadsen (Oct 09 2017 at 09:30):
@Grahame Grieve I was asking if the svn repo on git is mainly for reading and writing, or only for reading.
Grahame Grieve (Oct 09 2017 at 09:50):
it's only to support git based tooling. so read only
Jens Villadsen (Oct 09 2017 at 11:36):
FYI - trying out 3 different resource validators yields 3 different results. Example can be found at https://simplifier.net/eSundhed2017Hackatho/Observation-example/~json#json
Using the validator hosted on Simplifier validates against the uploaded profiles (which is nice) hosted at simplfier and reports: no issues
Using the official fhir validator (http://build.fhir.org/validator.zip) yields two warnings: (Unable to find definition for discriminator code.coding.code) and two info's (due to lack of slicing validation)
Using the HAPI validator yields one error: (obs-7: If code is the same as a component code then the value element associated with the code SHALL NOT be present)
- no one said writing validators is an easy task
Michel Rutten (Oct 09 2017 at 12:18):
Hi @Jens Villadsen, did you analyze the different outputs to determine which of the conflicting warning messages are (in)correct?
Richard Kavanagh (Oct 09 2017 at 13:03):
The .NET tool here here ( http://clarotech.co.uk/Products/TinderBox ) might be of use - this validates Bundles. There is a another tool that will be added to the site later this week that validates standalone resources. Both of these tools get their validation processes from the .NET Validator
Jens Villadsen (Oct 09 2017 at 13:58):
@Richard Kavanagh not really possible to try it out. Seems like the link is dead http://clarotech.co.uk/apps/TinderBoxSTU3/publish.htm
Jens Villadsen (Oct 09 2017 at 14:00):
@Richard Kavanagh pasted image
Richard Kavanagh (Oct 09 2017 at 14:01):
Apologies - looks like the latest version has not been posted to the server. Will get that fixed shortly.
Jens Villadsen (Oct 09 2017 at 14:45):
@James Agnew - 2 questions regarding the logic of the validator that ships with hapi:
1) The errorcode when validating this example
Message=obs-7: If code is the same as a component code then the value element associated with the code SHALL NOT be present
I can't see that the code is the same as the component code. How come they are interpreted as the same?
2) This is probably more targeted at the standard, but then the value element associated with the code - which code does it relate to? The Observation.code or the Observation.component.code?
Michel Rutten (Oct 09 2017 at 14:48):
2) good question! I assumed that obs-7 is targeting Observation.code, but I agree that the description could be improved.
Richard Kavanagh (Oct 09 2017 at 21:38):
For info the download at http://clarotech.co.uk/apps/TinderBoxSTU3 should now be working
Jens Villadsen (Oct 09 2017 at 21:38):
It doesn't
Richard Kavanagh (Oct 09 2017 at 21:40):
I'll get there in the end. Follow the download link from here... http://clarotech.co.uk/Products/TinderBox
Jens Villadsen (Oct 09 2017 at 21:42):
This link works: http://clarotech.co.uk/apps/TinderBox%20v2.1.2%20STU3.zip
Jens Villadsen (Oct 09 2017 at 21:43):
But curl never lies:
curl http://clarotech.co.uk/apps/TinderBoxSTU3 | grep "Error"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1024 0 1024 0 0 2293 0 --:--:-- --:--:-- --:--:-- 2290 <title>ClaroTech - Error</title>
100 8252 0 8252 0 0 13353 0 --:--:-- --:--:-- --:--:-- 13352
Jens Villadsen (Oct 09 2017 at 21:46):
@Richard Kavanagh hate to say it but Tinderbox seems to contain some bugs
Richard Kavanagh (Oct 09 2017 at 21:47):
That's clearly possible - what did you find?
Jens Villadsen (Oct 09 2017 at 21:48):
it crashed
Jens Villadsen (Oct 09 2017 at 21:48):
twice
Richard Kavanagh (Oct 09 2017 at 21:49):
Ouch! - Can you share the file you were attempting to open?
Jens Villadsen (Oct 09 2017 at 21:49):
Didn't get that far
Jens Villadsen (Oct 09 2017 at 21:50):
go to settings, press browse and then press cancel
Richard Kavanagh (Oct 09 2017 at 21:52):
Yep _ I can recreate that...
Jens Villadsen (Oct 09 2017 at 21:54):
@James Agnew - 2 questions regarding the logic of the validator that ships with hapi:
1) The errorcode when validating this example
Message=obs-7: If code is the same as a component code then the value element associated with the code SHALL NOT be present
I can't see that the code is the same as the component code. How come they are interpreted as the same?2) This is probably more targeted at the standard, but then the value element associated with the code - which code does it relate to? The Observation.code or the Observation.component.code?
@Grahame Grieve Would you agree that the sentence in 2) could/should be less ambiguous stated
Jens Villadsen (Oct 09 2017 at 22:22):
Hi @Jens Villadsen, did you analyze the different outputs to determine which of the conflicting warning messages are (in)correct?
https://github.com/jamesagnew/hapi-fhir/issues/654 - meaning that HAPI has a known issue
Jens Villadsen (Oct 09 2017 at 22:23):
@Michel Rutten
Jens Villadsen (Oct 09 2017 at 22:31):
and @Michel Rutten , the simplifier validator does not catch obs-7. If you state the same code in Observation.code as in Observation.component.code, where same means that both codes have the same coding (including coding.system and coding.code) - I guess that is what is meant by same
Michel Rutten (Oct 10 2017 at 08:13):
Hi @Jens Villadsen, thank you for reporting, I've submitted the issue to Ewout'sFHIR API repository on github:
https://github.com/ewoutkramer/fhir-net-api/issues/435
Grahame Grieve (Oct 10 2017 at 11:07):
sure
Ewout Kramer (Oct 16 2017 at 07:59):
Obs-7 uses "!=", where equivalence in the Fhirpath spec is defined to be "For complex types, equality requires all child properties to be equal, recursively." So, you are in fact comparing Obs.code to everything in the combined collection of Obs.component.code (since component may repeat) - making Obs.code != Obs.component.code almost a tautology - and obs-7 will probably almost always be true.
Eric Haas (Oct 16 2017 at 18:25):
What is the fix - the intent is to not have identical code-value pairs in the root and in component.
Ewout Kramer (Oct 16 2017 at 18:44):
I think we need to use the "in" operation. Something like Obs.code.in(Obs.component.code).not(). The reason I am cautious to say this is "the" solution, is that the "in" operation uses "equality" semantics - which means the Codeableconcepts needs to be exactly the same in both, which is probably not what we want. Rather ANY of the codes in Obs.code, so maybe even:
Obs.code.coding.any($this in Obs.component.code.coding).not()
Bryn Rhodes (Oct 16 2017 at 22:20):
In CQL, membership operators use "equivalent" (~
) semantics, rather than "equality" semantics. And we also just relaxed "equivalent" for Codes to compare only code and version, and equivalent for Concept is defined as the intersection of codes is not empty.
Bryn Rhodes (Oct 16 2017 at 22:22):
So that would be Obs.component.code.where($this ~ Obs.code).empty()
Grahame Grieve (Oct 16 2017 at 23:01):
I hope you mean code and system
venkateswarlu (Oct 16 2017 at 23:03):
just implemeting rest full webservices
Ewout Kramer (Oct 17 2017 at 07:34):
In CQL, membership operators use "equivalent" (
~
) semantics, rather than "equality" semantics. And we also just relaxed "equivalent" for Codes to compare only code and version, and equivalent for Concept is defined as the intersection of codes is not empty.
So, the language-dependent appendices of the FHIRPath spec should start talking about what equivalence and equality means for specific types?
For the short term - obs-7 would already benefit from what you have done above I guess, which still means even display needs to correspond for this rule to fire...but it's better than what we have now...
Eric Haas (Oct 17 2017 at 15:11):
Since none of the above seem to work as intended what about this:
Observation.component.code.where( (coding.code = Observation.code.coding.code) and (coding.system = Observation.code.coding.system)).empty()
code = A
c.code = A
empty = false
code = A
c.code = B
empty = true
code = A
c.code = empty
empty = true
Eric Haas (Oct 17 2017 at 17:18):
I just updated the xpath for this invariant as well:
not(exists(f:*[starts-with(local-name(.), 'value')]) and exists(for $coding in f:code/f:coding return f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value]))
Eric Haas (Oct 17 2017 at 17:20):
@Alexander Henket and @Sarah Gaunt you both posted Gforges on it so take look at it when you get a chance.
Alexander Henket (Oct 18 2017 at 07:48):
Checked it and all seems in order to me. Taste wise I'd probably stay away from too many and/or and put the final X and Y bit in separate predicates but if it works it works. Thanks!
Alexander Henket (Oct 18 2017 at 07:51):
O and that's a general thing for most invariants in FHIR: the exists() function is not required for testing presence of node(). When you say not(node()) it is exactly the same as not(exists(node())). You just use more characters to say it.
Eric Haas (Oct 18 2017 at 17:05):
OK thanks for the tips: updated to...
not(f:*[starts-with(local-name(.), 'value')] and (for $coding in f:code/f:coding return f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value] [f:system/@value=$coding/f:system/@value]))
Bryn Rhodes (Oct 18 2017 at 17:32):
So, the language-dependent appendices of the FHIRPath spec should start talking about what equivalence and equality means for specific types?
I would prefer to see consistent semantics at the base level (FHIRPath), but I understand if that can't be completely aligned. I would suggest that equivalent in FHIRPath for Coding and CodeableConcept be similarly relaxed.
Bryn Rhodes (Oct 18 2017 at 17:33):
And yes, I meant code, system, and version for code equivalence.
Bryn Rhodes (Oct 18 2017 at 17:34):
We relaxed it to just code and system, so that the same code would compare equivalent across versions.
Ewout Kramer (Oct 19 2017 at 08:07):
@Bryn Rhodes, I agree - just double checking ;-)
Ewout Kramer (Oct 19 2017 at 08:08):
Checked it and all seems in order to me. Taste wise I'd probably stay away from too many and/or and put the final X and Y bit in separate predicates but if it works it works. Thanks!
If I understand it correctly, there is now a tracker item to follow up on this?
Eric Haas (Oct 19 2017 at 17:01):
that tracker for the xpath was applied. need one for the fhirpath - but am waiting for the correct or updated expression. do we wait for the new fhirpath equivlence or create a fhirpath using the existing syntax
Bryn Rhodes (Oct 19 2017 at 19:18):
I've added a tracker for this: GF#14065.
Bryn Rhodes (Oct 19 2017 at 19:22):
Until that FHIRPath change is applied, the expression you provided above @Eric Haas should work.
Grahame Grieve (Oct 22 2017 at 20:21):
agree it should not be version dependent. That would be consistent with vocab guidance about use of version
Eric Haas (Oct 22 2017 at 23:49):
I tried to apply the fhirpath above only to discover I can't use component.code.where( (coding.code = Observation.code.coding.code)
realized the context node is component and I can't traverse up the tree in fhirpath. So am stuck GF#14073
Ewout Kramer (Oct 30 2017 at 16:31):
You can with %resource...
Eric Haas (Oct 30 2017 at 17:17):
ty ....johnny-carson.jpg
Brian Postlethwaite (Nov 10 2017 at 08:35):
%resource goes to the top of the component passed in right?
How does this work when its a bundle with it inside?
Pranitha Sruthi (Dec 02 2017 at 07:26):
Hi all, please help me fix an exception while validating a profile on command prompt. forgeexception.PNG Thank you
Lloyd McKenzie (Dec 02 2017 at 14:46):
Seems like a firewall issue or some other network difficulty. The file it's complaining about definitely exists at that URL address
Pranitha Sruthi (Dec 04 2017 at 05:03):
@Lloyd McKenzie How can I fix it?
Lloyd McKenzie (Dec 04 2017 at 05:15):
Try running it from a different network environment? Try browsing to the file it's complaining it can't access within the same network environment just using a browser
Pranitha Sruthi (Dec 04 2017 at 06:05):
@Lloyd McKenzie I did not understand. Can you elaborate?
Clarissa Fernandes (Dec 04 2017 at 10:22):
Hi I was trying to implement custom structure definition but it is always return true.
Posted the Question https://groups.google.com/forum/#!topic/hapi-fhir/P-iTqA69mMw
Can anyone help?
Lloyd McKenzie (Dec 04 2017 at 14:11):
@Pranitha Sruthi What happens when you type "http://build.fhir.org/validator.pack" into your browser?
Lloyd McKenzie (Dec 04 2017 at 14:15):
@Clarissa Fernandes First, patternString doesn't do regex pattern matching. I'm not actually sure it'll do anything at all right now - pattern is usually used with complex structures. How does the validator know that your profile applies to your instance?
Clarissa Fernandes (Dec 04 2017 at 16:30):
@Clarissa Fernandes First, patternString doesn't do regex pattern matching. I'm not actually sure it'll do anything at all right now - pattern is usually used with complex structures. How does the validator know that your profile applies to your instance?
@Lloyd McKenzie I was trying to use the examples in the hapi-fhir. But there does not seems to be any sample data and profiles.
Could you let me know how i could do custom validation?
Lloyd McKenzie (Dec 04 2017 at 17:15):
HAPI questions are probably best raised on the HAPI thread. I'm not sure how you make the HAPI validator aware of a new profile or assert that the profile should be enforced. You could try declaring the profile in the instance.
Pranitha Sruthi (Dec 05 2017 at 05:32):
@Lloyd McKenzie The validator.pack is getting downloaded. I have downloaded it again and tried to validate a profile but facing the same problem.
Lloyd McKenzie (Dec 05 2017 at 06:15):
Are you using the most recent validator from build.fhir.org
Pranitha Sruthi (Dec 05 2017 at 08:52):
I have used the validator from the new version of build.fhir.org and got it fixed. Thank you
Last updated: Apr 12 2022 at 19:14 UTC