FHIR Chat · Schematron validation error · implementers

Stream: implementers

Topic: Schematron validation error


view this post on Zulip Stephen Royce (Nov 11 2016 at 01:42):

Can anyone help me with this? I'm getting this error when I do schematron validation of my FHIR logical models (StructureDefinitions):

sdf-7: If the structure describes a base Resource or Type, the URL has to start with "http://hl7.org/fhir/StructureDefinition/" and the tail must match the id

I looked at the StructureDefinition documentation and under sdf-7 the expression includes "...or (kind = 'logical')..." so I would expect that I wouldn't get this error. However, I did notice that the XPath expression does not include a phrase equivalent to "...or (kind = 'logical')...". So, am I doing something wrong, or is there a bug in the sdf-7 constraint specification?

view this post on Zulip Grahame Grieve (Nov 11 2016 at 01:50):

does your url start with 'http://hl7.org/fhir/StructureDefinition/'

view this post on Zulip Stephen Royce (Nov 11 2016 at 01:54):

No. But these are logical models; it shouldn't have to should it?

view this post on Zulip Stephen Royce (Nov 11 2016 at 01:56):

The relevant parts of the XML look like this:

    <id value="lm-AdverseReaction"/>
...
    <url value="http://mct-cidbstg-01:8080/exist/apps/cimm/StructureDefinition/lm-AdverseReaction"/>
...
    <kind value="logical"/>
    <abstract value="false"/>
    <type value="AdverseReaction"/>
    <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DomainResource"/>
    <derivation value="specialization"/>

view this post on Zulip Stephen Royce (Nov 11 2016 at 02:04):

The constraint specification in the StructureDefinition resource looks like this:

      <constraint>
        <key value="sdf-7"/>
        <severity value="error"/>
        <human value="If the structure describes a base Resource or Type, the URL has to start with &quot;http://hl7.org/fhir/StructureDefinition/&quot; and the tail must match the id"/>
        <expression value="(derivation = 'constraint') or (kind = 'logical') or (url = 'http://hl7.org/fhir/StructureDefinition/'+id)"/>
        <xpath value="(f:derivation/@value = 'constraint') or f:url/@value=concat('http://hl7.org/fhir/StructureDefinition/', f:id/@value)"/>
      </constraint>

The logical statements in the expression and xpath (XML) elements are not equivalent (unless kind='logical' => derivation = 'constraint').

view this post on Zulip Grahame Grieve (Nov 11 2016 at 02:05):

yes the xpath is wrong.

view this post on Zulip Uday Chandrupatla (Jun 01 2017 at 00:55):

We have noticed when validating e.g. RelatedPerson.xml structureDefinition (profile) file against structureDefinition.sch, the following schematron rules do not seem to check what the error message conveys.

e.g.

<sch:assert test="count(*/f:element)=count(*/f:element/@id)">sdf-16: All element definitions must have unique ids (snapshot)</sch:assert> - 

The error message conveys that the snapshot element must have unique ids however, the test is performing that all the elements in the structureDefinition shall have id's and rather it is not testing the uniqueness of the element.id.
As a suggestion, we have come up with the following two rules which can effectively test both requirements.

<sch:assert test="count(f:snapshot/f:element)=count(f:snapshot/f:element/@id)">sdf-16: All element definitions must have ids (snapshot)</sch:assert>
<sch:assert test="count(f:snapshot/f:element)=count(distinct-values(f:snapshot/f:element/@id))">sdf-ABC: All element definitions must have unique ids (snapshot)</sch:assert>

Similar rules apply to sdf-17 schematron error as well.

view this post on Zulip Lloyd McKenzie (Jun 01 2017 at 00:58):

Hi Uday,

view this post on Zulip Lloyd McKenzie (Jun 01 2017 at 00:58):

Can you raise this as a change request?

view this post on Zulip Uday Chandrupatla (Jun 01 2017 at 01:00):

Thanks for the quick reply Lloyd, we will raise this in G Forge.

view this post on Zulip Uday Chandrupatla (Jun 04 2017 at 23:31):

Hi Lloyd, I have requested GForge to register me (uday_adha) to raise change request, but the request has not been approved yet. i will raise the ticket ones i get the access.

view this post on Zulip Lloyd McKenzie (Jun 04 2017 at 23:51):

@Uday Chandrupatla Sorry for the delay (and thanks for the poke). HQ normally monitors more actively. I've gone in and approved the request.

view this post on Zulip Uday Chandrupatla (Jun 04 2017 at 23:55):

Thanks Lloyd.


Last updated: Apr 12 2022 at 19:14 UTC