FHIR Chat · Validating Extensions · implementers

Stream: implementers

Topic: Validating Extensions


view this post on Zulip Stephen Lloyd (Dec 07 2016 at 15:37):

Hi, just wondering if something's wrong with my extension use as I seem to get validation successful message when not supplying what's actually defined in an extension. I have the following in my data that I'm validating
<extension url="http://hl7.org/fhir/StructureDefinition/patient-birthTime">
<valueBoolean value="false"/>
</extension>

As valueBoolean should be valueDateTime I'm trying to work out why it validates correctly, is there an error in what I'm trying to do somewhere or is this level of validation not actually processed (any value for a required extension is a good value)?

Thanks

view this post on Zulip Lloyd McKenzie (Dec 07 2016 at 15:52):

The only thing I can think of is that the validator isn't finding your extension definition - though if that were the case I'd expect an "Information" message letting you know that.

view this post on Zulip Lloyd McKenzie (Dec 07 2016 at 15:52):

Or the validator has a bug - which can happen.

view this post on Zulip Stephen Lloyd (Dec 07 2016 at 15:59):

Thanks Lloyd, should the (what I believe is a core item and resolvable externally) "http://hl7.org/fhir/StructureDefinition/patient-birthTime extension be located in the validation bundle when using command line jar or do you happen to know if it resolves the extension via url?
I have seen the not found error if I don't upload the definition of "http://hl7.org/fhir/StructureDefinition/patient-birthTime to our vanilla HAPI server (so it appears as if it's trying to resolve the extension locally when I try that).

view this post on Zulip Lloyd McKenzie (Dec 07 2016 at 16:00):

The standard extensions *should* be in the validator pack

view this post on Zulip Stephen Lloyd (Dec 07 2016 at 16:06):

Found it in the validation pack so that's why it doesn't complain from the command line. Hopefully I've just missed a critical piece of data in my profile somewhere as a bug in the validator will more difficult to track down.

view this post on Zulip Grahame Grieve (Dec 07 2016 at 19:08):

how are you invoking the validator?

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 10:05):

java -jar org.hl7.fhir.validator.jar data\simpleBasic.xml -defn validation.xml.zip -profile profiles\SimpleBasic.xml

view this post on Zulip Grahame Grieve (Dec 08 2016 at 11:45):

can you send me your example and your profile?

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 12:42):

Sent to your PM Grahame, thanks

view this post on Zulip Grahame Grieve (Dec 08 2016 at 19:29):

so when I run this, I get:

view this post on Zulip Grahame Grieve (Dec 08 2016 at 19:29):

Error @ Basic.extension (line 15, col78) : Profile http://hl7.org/fhir/StructureDefinition/patient-birthTime, Element 'Basic.extension.valueDateTime': minimum required = 1, but only found 0

view this post on Zulip Grahame Grieve (Dec 08 2016 at 20:01):

improved the validator so that now you also get:

view this post on Zulip Grahame Grieve (Dec 08 2016 at 20:01):

Error @ Basic.extension[url='http://hl7.org/fhir/StructureDefinition/patient-birthTime'] (line 15, col78) : The Extension 'http://hl7.org/fhir/StructureDefinition/patient-birthTime' definition allows for the types [dateTime] but found type integer

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 20:15):

That makes it even worse, I get 0 errors. I was hoping for a missing tag in my example or something :S
The only other thing I can think of is that I'm testing it from the command line on a Windows development machine, I'll try it on a Linux VM to see if there is any difference (it will be running on linux eventually anyway).
Thanks for taking the time to give it a test, much appreciated.

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 21:35):

Testing on ubuntu following the online instructions here - https://www.hl7.org/fhir/validation.html#jar - with the files I sent give the same "All Ok" or "success" messages. Something's not right somewhere as I get the same success message on linux & windows and it doesn't complain about the integer data type as it does for you.

view this post on Zulip Grahame Grieve (Dec 08 2016 at 21:36):

it can't have made it worse because I haven't committed it yet

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 21:38):

Sorry, I assumed the first section of your response was as it stands currently. Which seems to suggest it does complain for you.

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 21:40):

Did you get the Error @ Basic.extension (line 15, col78) : Profile http://hl7.org/fhir/StructureDefinition/patient-birthTime, Element 'Basic.extension.valueDateTime': minimum required = 1, but only found 0 - before your new changes?

view this post on Zulip Grahame Grieve (Dec 08 2016 at 21:40):

can you try with this batch file then:

view this post on Zulip Grahame Grieve (Dec 08 2016 at 21:41):

@ECHO OFF

 ECHO get the validator and unzip it 
 REM c:\tools\wget\bin\wget http://build.fhir.org/validator.zip
 REM "C:\Program Files\7-Zip\7z.exe" x validator.zip

 ECHO Get the validation source file (dictionary)
 REM c:\tools\wget\bin\wget http://build.fhir.org/igpack.zip

 java -jar org.hl7.fhir.validator.jar simpleBasicData.xml -defn igpack.zip 

 ECHO Press Any Key to Close
 pause

view this post on Zulip Grahame Grieve (Dec 08 2016 at 21:42):

you'll have to replace the paths with your paths, and/or use other similar tools for wget and 7z

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 21:43):

I'm trying to log back into my work's computer, will try if it ever lets me back in sorry.

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 21:43):

remote back in rather

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 22:53):

That's worked Grahame thanks, can I use this as before with specified custom profiles or do I need to wait for an official validator update?

Error returned:
*FAILURE* validating simpleBasicData.xml: error:1 warn:0 info:1
Error @ Basic.extension (line 14, col78) : Profile http://hl7.org/fhir/StructureDefinition/patient-birthTime, Element 'Basic.extension.valueDateTime': minimum required = 1, but only found 0
Information @ Basic.extension.valueInteger (line 15, col31) : Could not verify slice for profile http://hl7.org/fhir/StructureDefinition/patient-birthTime

All I need at the moment is the ability to identify errors such as this whilst we are converting data sets to FHIR even if our vanilla HAPI server doesn't raise it as an issue at the moment.

Thanks.

view this post on Zulip Stephen Lloyd (Dec 08 2016 at 22:56):

With custom extensions too actually.

view this post on Zulip Stephen Lloyd (Dec 09 2016 at 09:31):

@Grahame Grieve Just noticed this "That makes it even worse, I get 0 errors" what I meant was "That makes the situation worse as I currently get 0 errors whilst you get one in the validator's current state". Sorry for not explaining myself properly :)


Last updated: Apr 12 2022 at 19:14 UTC