Add validator support
This commit is contained in:
parent
3808f95f6a
commit
8d462f3cda
|
@ -0,0 +1,44 @@
|
|||
package example;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu.valueset.ContactSystemEnum;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.validation.ResourceValidator;
|
||||
import ca.uhn.fhir.validation.ValidationFailureException;
|
||||
|
||||
public class ValidatorExamples {
|
||||
|
||||
public static void main(String[] args) throws DataFormatException, IOException {
|
||||
|
||||
//START SNIPPET: basicValidation
|
||||
// As always, you need a context
|
||||
FhirContext ctx = new FhirContext();
|
||||
|
||||
// Create and populate a new patient object
|
||||
Patient p = new Patient();
|
||||
p.addName().addFamily("Smith").addGiven("John").addGiven("Q");
|
||||
p.addIdentifier("urn:foo:identifiers", "12345");
|
||||
p.addTelecom().setSystem(ContactSystemEnum.PHONE).setValue("416 123-4567");
|
||||
|
||||
// Request a validator and apply it
|
||||
ResourceValidator val = ctx.newValidator();
|
||||
try {
|
||||
|
||||
val.validate(p);
|
||||
System.out.println("Validation passed");
|
||||
|
||||
} catch (ValidationFailureException e) {
|
||||
// We failed validation!
|
||||
|
||||
System.out.println("Validation failed");
|
||||
|
||||
String results = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome());
|
||||
System.out.println(results);
|
||||
}
|
||||
//END SNIPPET: basicValidation
|
||||
}
|
||||
|
||||
}
|
|
@ -85,6 +85,23 @@
|
|||
-->
|
||||
</dependency>
|
||||
|
||||
<!-- Only required for Schematron Validator Support -->
|
||||
<dependency>
|
||||
<groupId>com.phloc</groupId>
|
||||
<artifactId>phloc-schematron</artifactId>
|
||||
<version>${phloc_schematron_version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- General -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
|
|
@ -44,18 +44,23 @@ import ca.uhn.fhir.rest.client.RestfulClientFactory;
|
|||
import ca.uhn.fhir.rest.client.api.IBasicClient;
|
||||
import ca.uhn.fhir.rest.client.api.IRestfulClient;
|
||||
import ca.uhn.fhir.util.FhirTerser;
|
||||
import ca.uhn.fhir.validation.ResourceValidator;
|
||||
|
||||
/**
|
||||
* The FHIR context is the central starting point for the use of the HAPI FHIR API. It should be created once, and then used as a factory for various other types of objects (parsers, clients, etc.).
|
||||
* The FHIR context is the central starting point for the use of the HAPI FHIR API. It should be created once, and then
|
||||
* used as a factory for various other types of objects (parsers, clients, etc.).
|
||||
*
|
||||
* <p>
|
||||
* Important usage notes:
|
||||
* <ul>
|
||||
* <li>Thread safety: <b>This class is thread safe</b> and may be shared between multiple processing threads.</li>
|
||||
* <li>
|
||||
* Performance: <b>This class is expensive</b> to create, as it scans every resource class it needs to parse or encode to build up an internal model of those classes. For that reason, you should try
|
||||
* to create one FhirContext instance which remains for the life of your application and reuse that instance. Note that it will not cause problems to create multiple instances (ie. resources
|
||||
* originating from one FhirContext may be passed to parsers originating from another) but you will incur a performance penalty if a new FhirContext is created for every message you parse/encode.</li>
|
||||
* Performance: <b>This class is expensive</b> to create, as it scans every resource class it needs to parse or encode
|
||||
* to build up an internal model of those classes. For that reason, you should try to create one FhirContext instance
|
||||
* which remains for the life of your application and reuse that instance. Note that it will not cause problems to
|
||||
* create multiple instances (ie. resources originating from one FhirContext may be passed to parsers originating from
|
||||
* another) but you will incur a performance penalty if a new FhirContext is created for every message you parse/encode.
|
||||
* </li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*/
|
||||
|
@ -88,7 +93,8 @@ public class FhirContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library.
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
|
||||
* for extending the core library.
|
||||
*/
|
||||
public BaseRuntimeElementDefinition<?> getElementDefinition(Class<? extends IElement> theElementType) {
|
||||
return myClassToElementDefinition.get(theElementType);
|
||||
|
@ -99,7 +105,8 @@ public class FhirContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library.
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
|
||||
* for extending the core library.
|
||||
*/
|
||||
public RuntimeResourceDefinition getResourceDefinition(Class<? extends IResource> theResourceType) {
|
||||
RuntimeResourceDefinition retVal = (RuntimeResourceDefinition) myClassToElementDefinition.get(theResourceType);
|
||||
|
@ -110,23 +117,24 @@ public class FhirContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library.
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
|
||||
* for extending the core library.
|
||||
*/
|
||||
public RuntimeResourceDefinition getResourceDefinition(IResource theResource) {
|
||||
return getResourceDefinition(theResource.getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library.
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
|
||||
* for extending the core library.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public RuntimeResourceDefinition getResourceDefinition(String theResourceName) {
|
||||
String resourceName = theResourceName;
|
||||
|
||||
/*
|
||||
* TODO: this is a bit of a hack, really we should have a translation table
|
||||
* based on a property file or something so that we can detect names like
|
||||
* diagnosticreport
|
||||
* TODO: this is a bit of a hack, really we should have a translation table based on a property file or
|
||||
* something so that we can detect names like diagnosticreport
|
||||
*/
|
||||
if (Character.isLowerCase(resourceName.charAt(0))) {
|
||||
resourceName = WordUtils.capitalize(resourceName);
|
||||
|
@ -152,14 +160,16 @@ public class FhirContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library.
|
||||
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
|
||||
* for extending the core library.
|
||||
*/
|
||||
public RuntimeResourceDefinition getResourceDefinitionById(String theId) {
|
||||
return myIdToResourceDefinition.get(theId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scanned runtime models. This is an advanced feature which is generally only needed for extending the core library.
|
||||
* Returns the scanned runtime models. This is an advanced feature which is generally only needed for extending the
|
||||
* core library.
|
||||
*/
|
||||
public Collection<RuntimeResourceDefinition> getResourceDefinitions() {
|
||||
return myIdToResourceDefinition.values();
|
||||
|
@ -180,7 +190,8 @@ public class FhirContext {
|
|||
* Create and return a new JSON parser.
|
||||
*
|
||||
* <p>
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every message being processed without incurring any performance penalty
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every message being processed
|
||||
* without incurring any performance penalty
|
||||
* </p>
|
||||
*/
|
||||
public IParser newJsonParser() {
|
||||
|
@ -188,12 +199,16 @@ public class FhirContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new client instance. This method requires an interface which is defined specifically for your use cases to contain methods for each of the RESTful operations you wish to
|
||||
* implement (e.g. "read ImagingStudy", "search Patient by identifier", etc.). This interface must extend {@link IRestfulClient} (or commonly its sub-interface {@link IBasicClient}). See the <a
|
||||
* href="http://hl7api.sourceforge.net/hapi-fhir/doc_rest_client.html">RESTful Client</a> documentation for more information on how to define this interface.
|
||||
* Instantiates a new client instance. This method requires an interface which is defined specifically for your use
|
||||
* cases to contain methods for each of the RESTful operations you wish to implement (e.g. "read ImagingStudy",
|
||||
* "search Patient by identifier", etc.). This interface must extend {@link IRestfulClient} (or commonly its
|
||||
* sub-interface {@link IBasicClient}). See the <a
|
||||
* href="http://hl7api.sourceforge.net/hapi-fhir/doc_rest_client.html">RESTful Client</a> documentation for more
|
||||
* information on how to define this interface.
|
||||
*
|
||||
* <p>
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every operation invocation without incurring any performance penalty
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every operation invocation
|
||||
* without incurring any performance penalty
|
||||
* </p>
|
||||
*
|
||||
* @param theClientType
|
||||
|
@ -209,11 +224,13 @@ public class FhirContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new generic client. A generic client is able to perform any of the FHIR RESTful operations against a compliant server, but does not have methods defining the specific
|
||||
* functionality required (as is the case with {@link #newRestfulClient(Class, String) non-generic clients}).
|
||||
* Instantiates a new generic client. A generic client is able to perform any of the FHIR RESTful operations against
|
||||
* a compliant server, but does not have methods defining the specific functionality required (as is the case with
|
||||
* {@link #newRestfulClient(Class, String) non-generic clients}).
|
||||
*
|
||||
* <p>
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every operation invocation without incurring any performance penalty
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every operation invocation
|
||||
* without incurring any performance penalty
|
||||
* </p>
|
||||
*
|
||||
* @param theServerBase
|
||||
|
@ -228,11 +245,20 @@ public class FhirContext {
|
|||
return new FhirTerser(this);
|
||||
}
|
||||
|
||||
public ResourceValidator newValidator() {
|
||||
return new ResourceValidator(this);
|
||||
}
|
||||
|
||||
public ViewGenerator newViewGenerator() {
|
||||
return new ViewGenerator(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return a new XML parser.
|
||||
*
|
||||
* <p>
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every message being processed without incurring any performance penalty
|
||||
* Performance Note: <b>This method is cheap</b> to call, and may be called once for every message being processed
|
||||
* without incurring any performance penalty
|
||||
* </p>
|
||||
*/
|
||||
public IParser newXmlParser() {
|
||||
|
@ -298,8 +324,4 @@ public class FhirContext {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public ViewGenerator newViewGenerator() {
|
||||
return new ViewGenerator(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,12 +53,13 @@ import ca.uhn.fhir.model.primitive.IdDt;
|
|||
public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefinition<IResource> {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RuntimeResourceDefinition.class);
|
||||
private RuntimeResourceDefinition myBaseDefinition;
|
||||
private Map<RuntimeChildDeclaredExtensionDefinition, String> myExtensionDefToCode = new HashMap<RuntimeChildDeclaredExtensionDefinition, String>();
|
||||
private String myId;
|
||||
private Map<String, RuntimeSearchParam> myNameToSearchParam = new LinkedHashMap<String, RuntimeSearchParam>();
|
||||
private Profile myProfileDef;
|
||||
private String myResourceProfile;
|
||||
private List<RuntimeSearchParam> mySearchParams;
|
||||
private String myId;
|
||||
|
||||
public RuntimeResourceDefinition(String theResourceName, Class<? extends IResource> theClass, ResourceDef theResourceAnnotation) {
|
||||
super(theResourceName, theClass);
|
||||
|
@ -70,6 +71,107 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
|||
myNameToSearchParam.put(theParam.getName(), theParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this definition refers to a class which extends another resource definition type, this
|
||||
* method will return the definition of the topmost resource. For example, if this definition
|
||||
* refers to MyPatient2, which extends MyPatient, which in turn extends Patient, this method
|
||||
* will return the resource definition for Patient.
|
||||
* <p>
|
||||
* If the definition has no parent, returns <code>this</code>
|
||||
* </p>
|
||||
*/
|
||||
public RuntimeResourceDefinition getBaseDefinition() {
|
||||
return myBaseDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||
return ChildTypeEnum.RESOURCE;
|
||||
}
|
||||
|
||||
public String getResourceProfile() {
|
||||
return myResourceProfile;
|
||||
}
|
||||
|
||||
public RuntimeSearchParam getSearchParam(String theName) {
|
||||
return myNameToSearchParam.get(theName);
|
||||
}
|
||||
|
||||
public List<RuntimeSearchParam> getSearchParams() {
|
||||
return mySearchParams;
|
||||
}
|
||||
|
||||
public boolean isStandardProfile() {
|
||||
return myResourceProfile.startsWith("http://hl7.org/fhir/profiles");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sealAndInitialize(Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
super.sealAndInitialize(theClassToElementDefinitions);
|
||||
|
||||
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
|
||||
|
||||
ArrayList<RuntimeSearchParam> searchParams = new ArrayList<RuntimeSearchParam>(myNameToSearchParam.values());
|
||||
Collections.sort(searchParams, new Comparator<RuntimeSearchParam>() {
|
||||
@Override
|
||||
public int compare(RuntimeSearchParam theArg0, RuntimeSearchParam theArg1) {
|
||||
return theArg0.getName().compareTo(theArg1.getName());
|
||||
}
|
||||
});
|
||||
mySearchParams = Collections.unmodifiableList(searchParams);
|
||||
|
||||
Class<?> target = getImplementingClass();
|
||||
myBaseDefinition = this;
|
||||
do {
|
||||
target = target.getSuperclass();
|
||||
if (IResource.class.isAssignableFrom(target) && target.getAnnotation(ResourceDef.class)!=null) {
|
||||
myBaseDefinition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(target);
|
||||
}
|
||||
} while (target.equals(Object.class)==false);
|
||||
}
|
||||
|
||||
public synchronized Profile toProfile() {
|
||||
if (myProfileDef != null) {
|
||||
return myProfileDef;
|
||||
}
|
||||
|
||||
Profile retVal = new Profile();
|
||||
|
||||
RuntimeResourceDefinition def = this;
|
||||
|
||||
if (StringUtils.isBlank(myId)) {
|
||||
myId = getName().toLowerCase();
|
||||
}
|
||||
|
||||
retVal.setId(new IdDt(myId));
|
||||
|
||||
// Scan for extensions
|
||||
scanForExtensions(retVal, def);
|
||||
Collections.sort(retVal.getExtensionDefn(), new Comparator<ExtensionDefn>() {
|
||||
@Override
|
||||
public int compare(ExtensionDefn theO1, ExtensionDefn theO2) {
|
||||
return theO1.getCode().compareTo(theO2.getCode());
|
||||
}
|
||||
});
|
||||
|
||||
// Scan for children
|
||||
retVal.setName(getName());
|
||||
Structure struct = retVal.addStructure();
|
||||
LinkedList<String> path = new LinkedList<String>();
|
||||
|
||||
StructureElement element = struct.addElement();
|
||||
element.getDefinition().setMin(1);
|
||||
element.getDefinition().setMax("1");
|
||||
|
||||
fillProfile(struct, element, def, path, null);
|
||||
|
||||
retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
|
||||
|
||||
myProfileDef = retVal;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private void fillBasics(StructureElement theElement, BaseRuntimeElementDefinition<?> def, LinkedList<String> path, BaseRuntimeDeclaredChildDefinition theChild) {
|
||||
if (path.isEmpty()) {
|
||||
path.add(def.getName());
|
||||
|
@ -234,23 +336,6 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
|||
path.pollLast();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||
return ChildTypeEnum.RESOURCE;
|
||||
}
|
||||
|
||||
public String getResourceProfile() {
|
||||
return myResourceProfile;
|
||||
}
|
||||
|
||||
public RuntimeSearchParam getSearchParam(String theName) {
|
||||
return myNameToSearchParam.get(theName);
|
||||
}
|
||||
|
||||
public List<RuntimeSearchParam> getSearchParams() {
|
||||
return mySearchParams;
|
||||
}
|
||||
|
||||
private void scanForExtensions(Profile theProfile, BaseRuntimeElementDefinition<?> def) {
|
||||
BaseRuntimeElementCompositeDefinition<?> cdef = ((BaseRuntimeElementCompositeDefinition<?>) def);
|
||||
|
||||
|
@ -294,66 +379,4 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sealAndInitialize(Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
super.sealAndInitialize(theClassToElementDefinitions);
|
||||
|
||||
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
|
||||
|
||||
ArrayList<RuntimeSearchParam> searchParams = new ArrayList<RuntimeSearchParam>(myNameToSearchParam.values());
|
||||
Collections.sort(searchParams, new Comparator<RuntimeSearchParam>() {
|
||||
@Override
|
||||
public int compare(RuntimeSearchParam theArg0, RuntimeSearchParam theArg1) {
|
||||
return theArg0.getName().compareTo(theArg1.getName());
|
||||
}
|
||||
});
|
||||
mySearchParams = Collections.unmodifiableList(searchParams);
|
||||
}
|
||||
|
||||
public synchronized Profile toProfile() {
|
||||
if (myProfileDef != null) {
|
||||
return myProfileDef;
|
||||
}
|
||||
|
||||
Profile retVal = new Profile();
|
||||
|
||||
RuntimeResourceDefinition def = this;
|
||||
|
||||
if (StringUtils.isBlank(myId)) {
|
||||
myId = getName().toLowerCase();
|
||||
}
|
||||
|
||||
retVal.setId(new IdDt(myId));
|
||||
|
||||
// Scan for extensions
|
||||
scanForExtensions(retVal, def);
|
||||
Collections.sort(retVal.getExtensionDefn(), new Comparator<ExtensionDefn>() {
|
||||
@Override
|
||||
public int compare(ExtensionDefn theO1, ExtensionDefn theO2) {
|
||||
return theO1.getCode().compareTo(theO2.getCode());
|
||||
}
|
||||
});
|
||||
|
||||
// Scan for children
|
||||
retVal.setName(getName());
|
||||
Structure struct = retVal.addStructure();
|
||||
LinkedList<String> path = new LinkedList<String>();
|
||||
|
||||
StructureElement element = struct.addElement();
|
||||
element.getDefinition().setMin(1);
|
||||
element.getDefinition().setMax("1");
|
||||
|
||||
fillProfile(struct, element, def, path, null);
|
||||
|
||||
retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
|
||||
|
||||
myProfileDef = retVal;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public boolean isStandardProfile() {
|
||||
return myResourceProfile.startsWith("http://hl7.org/fhir/profiles");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
|
||||
interface IValidator {
|
||||
|
||||
void validate(ValidationContext theCtx);
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
import org.w3c.dom.ls.LSInput;
|
||||
|
||||
class LSInputImpl implements LSInput {
|
||||
|
||||
private Reader myCharacterStream;
|
||||
private InputStream myByteStream;
|
||||
private String myStringData;
|
||||
private String mySystemId;
|
||||
private String myPublicId;
|
||||
private String myBaseURI;
|
||||
private String myEncoding;
|
||||
private boolean myCertifiedText;
|
||||
|
||||
@Override
|
||||
public Reader getCharacterStream() {
|
||||
return myCharacterStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterStream(Reader theCharacterStream) {
|
||||
myCharacterStream=theCharacterStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getByteStream() {
|
||||
return myByteStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setByteStream(InputStream theByteStream) {
|
||||
myByteStream=theByteStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringData() {
|
||||
return myStringData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStringData(String theStringData) {
|
||||
myStringData=theStringData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystemId() {
|
||||
return mySystemId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemId(String theSystemId) {
|
||||
mySystemId=theSystemId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPublicId() {
|
||||
return myPublicId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPublicId(String thePublicId) {
|
||||
myPublicId=thePublicId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return myBaseURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBaseURI(String theBaseURI) {
|
||||
myBaseURI=theBaseURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncoding() {
|
||||
return myEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncoding(String theEncoding) {
|
||||
myEncoding=theEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCertifiedText() {
|
||||
return myCertifiedText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCertifiedText(boolean theCertifiedText) {
|
||||
myCertifiedText=theCertifiedText;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
public class Problem {
|
||||
|
||||
private String myDescription;
|
||||
|
||||
public Problem(String theDescription) {
|
||||
myDescription=theDescription;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
||||
|
||||
/**
|
||||
* Resource validator, which checks resources for compliance against various
|
||||
* validation schemes (schemas, schematrons, etc.)
|
||||
*
|
||||
* <p>
|
||||
* To obtain a resource validator, call {@link FhirContext#newValidator()}
|
||||
* </p>
|
||||
*/
|
||||
public class ResourceValidator {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceValidator.class);
|
||||
|
||||
private FhirContext myContext;
|
||||
private List<IValidator> myValidators = new ArrayList<IValidator>();
|
||||
|
||||
/**
|
||||
* Constructor (this should not be called directly, but rather {@link FhirContext#newValidator()} should be called
|
||||
* to obtain an instance of {@link ResourceValidator})
|
||||
*/
|
||||
public ResourceValidator(FhirContext theFhirContext) {
|
||||
myContext = theFhirContext;
|
||||
setValidateBaseSchema(true);
|
||||
setValidateBaseSchematron(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the validator validate the resource against the base schema (the schema provided with the FHIR
|
||||
* distribution itself)
|
||||
*/
|
||||
public boolean isValidateBaseSchema() {
|
||||
return haveValidatorOfType(SchemaBaseValidator.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the validator validate the resource against the base schema (the schema provided with the FHIR
|
||||
* distribution itself)
|
||||
*/
|
||||
public void setValidateBaseSchema(boolean theValidateBaseSchema) {
|
||||
addOrRemoveValidator(theValidateBaseSchema, SchemaBaseValidator.class, new SchemaBaseValidator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the validator validate the resource against the base schema (the schema provided with the FHIR
|
||||
* distribution itself)
|
||||
*/
|
||||
public boolean isValidateBaseSchematron() {
|
||||
return haveValidatorOfType(SchematronBaseValidator.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the validator validate the resource against the base schematron (the schematron provided with the FHIR
|
||||
* distribution itself)
|
||||
*/
|
||||
public void setValidateBaseSchematron(boolean theValidateBaseSchematron) {
|
||||
addOrRemoveValidator(theValidateBaseSchematron, SchematronBaseValidator.class, new SchematronBaseValidator());
|
||||
}
|
||||
|
||||
|
||||
public void validate(IResource theResource) throws ValidationFailureException {
|
||||
Validate.notNull(theResource, "theResource must not be null");
|
||||
|
||||
ValidationContext ctx = new ValidationContext(myContext, theResource);
|
||||
|
||||
for (IValidator next : myValidators) {
|
||||
next.validate(ctx);
|
||||
}
|
||||
|
||||
OperationOutcome oo = ctx.getOperationOutcome();
|
||||
if (oo != null && oo.getIssue().size() > 0) {
|
||||
throw new ValidationFailureException(oo.getIssueFirstRep().getDetails().getValue(), oo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addOrRemoveValidator(boolean theValidateBaseSchema, Class<? extends IValidator> type, IValidator instance) {
|
||||
if (theValidateBaseSchema) {
|
||||
boolean found = haveValidatorOfType(type);
|
||||
if (!found) {
|
||||
myValidators.add(instance);
|
||||
}
|
||||
} else {
|
||||
for (Iterator<IValidator> iter = myValidators.iterator(); iter.hasNext();) {
|
||||
IValidator next = iter.next();
|
||||
if (next.getClass().equals(type)) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean haveValidatorOfType(Class<? extends IValidator> type) {
|
||||
boolean found = false;
|
||||
for (IValidator next : myValidators) {
|
||||
if (next.getClass().equals(type)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.w3c.dom.ls.LSInput;
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||
|
||||
class SchemaBaseValidator implements IValidator {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SchemaBaseValidator.class);
|
||||
|
||||
private Schema loadSchema(final IResource theResource, ValidationContext theValidationCtx) {
|
||||
Source baseSource = loadXml(theValidationCtx, theResource, null, "fhir-single.xsd");
|
||||
|
||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
schemaFactory.setResourceResolver(new LSResourceResolver() {
|
||||
@Override
|
||||
public LSInput resolveResource(String theType, String theNamespaceURI, String thePublicId, String theSystemId, String theBaseURI) {
|
||||
if ("xml.xsd".equals(theSystemId) || "xhtml1-strict.xsd".equals(theSystemId)) {
|
||||
LSInputImpl input = new LSInputImpl();
|
||||
input.setPublicId(thePublicId);
|
||||
input.setSystemId(theSystemId);
|
||||
input.setBaseURI(theBaseURI);
|
||||
String pathToBase = theResource.getClass().getPackage().getName().replace('.', '/') + '/' + theSystemId;
|
||||
InputStream baseIs = ResourceValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
||||
if (baseIs == null) {
|
||||
throw new ValidationFailureException("No FHIR-BASE schema found");
|
||||
}
|
||||
|
||||
ourLog.debug("Loading schema: {}", theSystemId);
|
||||
byte[] schema;
|
||||
try {
|
||||
schema = IOUtils.toByteArray(new InputStreamReader(baseIs, "UTF-8"));
|
||||
} catch (IOException e) {
|
||||
throw new ValidationFailureException("Failed to load schema " + theSystemId, e);
|
||||
}
|
||||
|
||||
// Account for BOM in UTF-8 text (this seems to choke Java 6's built in XML reader)
|
||||
int offset = 0;
|
||||
if (schema[0] == (byte) 0xEF && schema[1] == (byte) 0xBB && schema[2] == (byte) 0xBF) {
|
||||
offset = 3;
|
||||
}
|
||||
|
||||
try {
|
||||
input.setCharacterStream(new InputStreamReader(new ByteArrayInputStream(schema, offset, schema.length - offset), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new ValidationFailureException("Failed to load schema " + theSystemId, e);
|
||||
}
|
||||
|
||||
return input;
|
||||
|
||||
}
|
||||
|
||||
throw new ConfigurationException("Unknown schema: " + theBaseURI);
|
||||
}
|
||||
});
|
||||
|
||||
Schema schema;
|
||||
try {
|
||||
schema = schemaFactory.newSchema(new Source[] { baseSource });
|
||||
} catch (SAXException e) {
|
||||
throw new ConfigurationException("Could not load/parse schema file", e);
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
private Source loadXml(ValidationContext theCtx, IResource theResource, String theSystemId, String theSchemaName) {
|
||||
Class<? extends IResource> baseResourceClass = theCtx.getFhirContext().getResourceDefinition(theResource).getBaseDefinition().getImplementingClass();
|
||||
Package pack = baseResourceClass.getPackage();
|
||||
String pathToBase = pack.getName().replace('.', '/') + '/' + theSchemaName;
|
||||
InputStream baseIs = ResourceValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
||||
if (baseIs == null) {
|
||||
throw new ValidationFailureException("No FHIR-BASE schema found");
|
||||
}
|
||||
Source baseSource = new StreamSource(baseIs, theSystemId);
|
||||
return baseSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(ValidationContext theContext) {
|
||||
Schema schema = loadSchema(theContext.getOperationOutcome(), theContext);
|
||||
try {
|
||||
Validator validator = schema.newValidator();
|
||||
ErrorHandler handler = new ErrorHandler(theContext);
|
||||
validator.setErrorHandler(handler);
|
||||
validator.validate(new StreamSource(new StringReader(theContext.getXmlEncodedResource())));
|
||||
} catch (SAXException e) {
|
||||
throw new ConfigurationException("Could not apply schema file", e);
|
||||
} catch (IOException e) {
|
||||
// This shouldn't happen since we're using a string source
|
||||
throw new ConfigurationException("Could not load/parse schema file", e);
|
||||
}
|
||||
}
|
||||
|
||||
public class ErrorHandler implements org.xml.sax.ErrorHandler {
|
||||
|
||||
private ValidationContext myContext;
|
||||
|
||||
public ErrorHandler(ValidationContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(SAXParseException theException) throws SAXException {
|
||||
addIssue(theException, IssueSeverityEnum.ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatalError(SAXParseException theException) throws SAXException {
|
||||
addIssue(theException, IssueSeverityEnum.FATAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warning(SAXParseException theException) throws SAXException {
|
||||
addIssue(theException, IssueSeverityEnum.WARNING);
|
||||
}
|
||||
|
||||
private void addIssue(SAXParseException theException, IssueSeverityEnum severity) {
|
||||
Issue issue = myContext.getOperationOutcome().addIssue();
|
||||
issue.setSeverity(severity);
|
||||
issue.setDetails(theException.getLocalizedMessage());
|
||||
issue.addLocation().setValue("Line[" + theException.getLineNumber() + "] Col[" + theException.getColumnNumber() + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.oclc.purl.dsdl.svrl.SchematronOutputType;
|
||||
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||
|
||||
import com.phloc.commons.error.IResourceError;
|
||||
import com.phloc.commons.error.IResourceErrorGroup;
|
||||
import com.phloc.schematron.ISchematronResource;
|
||||
import com.phloc.schematron.SchematronHelper;
|
||||
import com.phloc.schematron.xslt.SchematronResourceSCH;
|
||||
|
||||
public class SchematronBaseValidator implements IValidator {
|
||||
|
||||
@Override
|
||||
public void validate(ValidationContext theCtx) {
|
||||
|
||||
IResource resource = theCtx.getResource();
|
||||
RuntimeResourceDefinition baseDef = theCtx.getFhirContext().getResourceDefinition(resource).getBaseDefinition();
|
||||
Class<? extends IResource> baseResourceClass = baseDef.getImplementingClass();
|
||||
Package pack = baseResourceClass.getPackage();
|
||||
|
||||
String pathToBase = pack.getName().replace('.', '/') + '/' + baseDef.getName().toLowerCase() + ".sch";
|
||||
InputStream baseIs = ResourceValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
||||
if (baseIs == null) {
|
||||
throw new ValidationFailureException("No schematron found for resource type: " + baseDef.getImplementingClass().getCanonicalName());
|
||||
}
|
||||
|
||||
ISchematronResource sch = SchematronResourceSCH.fromClassPath(pathToBase);
|
||||
StreamSource source = new StreamSource(new StringReader(theCtx.getXmlEncodedResource()));
|
||||
|
||||
SchematronOutputType results = SchematronHelper.applySchematron(sch, source);
|
||||
if (results == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IResourceErrorGroup errors = SchematronHelper.convertToResourceErrorGroup(results, baseDef.getName());
|
||||
|
||||
if (errors.getAllErrors().containsOnlySuccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (IResourceError next : errors.getAllErrors().getAllResourceErrors()) {
|
||||
Issue issue = theCtx.getOperationOutcome().addIssue();
|
||||
switch(next.getErrorLevel()) {
|
||||
case ERROR:
|
||||
issue.setSeverity(IssueSeverityEnum.ERROR);
|
||||
break;
|
||||
case FATAL_ERROR:
|
||||
issue.setSeverity(IssueSeverityEnum.FATAL);
|
||||
break;
|
||||
case WARN:
|
||||
issue.setSeverity(IssueSeverityEnum.WARNING);
|
||||
break;
|
||||
case INFO:
|
||||
case SUCCESS:
|
||||
continue;
|
||||
}
|
||||
|
||||
issue.getDetails().setValue(next.getAsString(Locale.getDefault()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
||||
|
||||
class ValidationContext {
|
||||
|
||||
private FhirContext myFhirContext;
|
||||
private OperationOutcome myOperationOutcome;
|
||||
private IResource myResource;
|
||||
private String myXmlEncodedResource;
|
||||
|
||||
public ValidationContext(FhirContext theContext, IResource theResource) {
|
||||
myFhirContext = theContext;
|
||||
myResource = theResource;
|
||||
}
|
||||
|
||||
public String getXmlEncodedResource() {
|
||||
if (myXmlEncodedResource == null) {
|
||||
myXmlEncodedResource = myFhirContext.newXmlParser().encodeResourceToString(myResource);
|
||||
}
|
||||
return myXmlEncodedResource;
|
||||
}
|
||||
|
||||
public OperationOutcome getOperationOutcome() {
|
||||
if (myOperationOutcome == null) {
|
||||
myOperationOutcome = new OperationOutcome();
|
||||
}
|
||||
return myOperationOutcome;
|
||||
}
|
||||
|
||||
public FhirContext getFhirContext() {
|
||||
return myFhirContext;
|
||||
}
|
||||
|
||||
public IResource getResource() {
|
||||
return myResource;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||
|
||||
public class ValidationFailureException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private OperationOutcome myOperationOutcome;
|
||||
|
||||
public ValidationFailureException(String theProblem) {
|
||||
this(theProblem, IssueSeverityEnum.FATAL, null);
|
||||
}
|
||||
|
||||
public ValidationFailureException(String theProblem, Exception theCause) {
|
||||
this(theProblem, IssueSeverityEnum.FATAL, theCause);
|
||||
}
|
||||
|
||||
public ValidationFailureException(String theProblem, IssueSeverityEnum theSeverity, Exception theCause) {
|
||||
super(theProblem, theCause);
|
||||
myOperationOutcome = new OperationOutcome();
|
||||
myOperationOutcome.addIssue().setSeverity(theSeverity).setDetails(theProblem);
|
||||
}
|
||||
|
||||
public ValidationFailureException(String theProblem, OperationOutcome theOperationOutcome) {
|
||||
super(theProblem);
|
||||
myOperationOutcome = theOperationOutcome;
|
||||
}
|
||||
|
||||
public OperationOutcome getOperationOutcome() {
|
||||
return myOperationOutcome;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>AdverseReaction</sch:title>
|
||||
<sch:rule context="/f:AdverseReaction/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:recorder">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:symptom/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:symptom/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:symptom/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AdverseReaction/f:exposure/f:substance">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Alert</sch:title>
|
||||
<sch:rule context="/f:Alert/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Alert/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Alert/f:category">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Alert/f:category/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Alert/f:category/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Alert/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Alert/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>AllergyIntolerance</sch:title>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:recorder">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:substance">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:reaction">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:AllergyIntolerance/f:sensitivityTest">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>CarePlan</sch:title>
|
||||
<sch:rule context="/f:CarePlan/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:concern">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:participant/f:role">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:participant/f:role/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:participant/f:role/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:participant/f:member">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:goal/f:concern">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:actionResulting">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:detail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple">
|
||||
<sch:assert test="not(exists(f:detail)) or not(exists(f:simple))">Inv-3: Only provide a detail reference, or a simple detail summary</sch:assert>
|
||||
<sch:assert test="(f:category/@value=('supply')) = exists(f:quantity)">Inv-2: Quantity can only be specified if activity category is supply</sch:assert>
|
||||
<sch:assert test="(f:category/@value=('drug','diet')) = exists(f:dailyAmount)">Inv-1: DailyDose can only be specified if activity category is drug or food</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:timingSchedule">
|
||||
<sch:assert test="not(exists(f:repeat)) or count(f:event) < 2">Inv-1: There can only be a repeat element if there is none or one event</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:timingSchedule/f:event">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:timingSchedule/f:repeat">
|
||||
<sch:assert test="not(exists(f:count) and exists(f:end))">Inv-3: At most, only one of count or end can be present</sch:assert>
|
||||
<sch:assert test="exists(f:frequency) != exists(f:when)">Inv-2: Either frequency or when SHALL be present, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:timingSchedule/f:repeat/f:duration">
|
||||
<sch:assert test="@value > 0 or not(@value)">Inv-4: duration SHALL be a positive value</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:timingPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:product">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:dailyAmount">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:CarePlan/f:activity/f:simple/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Composition</sch:title>
|
||||
<sch:rule context="/f:Composition/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:class">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:class/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:class/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:confidentiality">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:confidentiality/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:attester/f:party">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:custodian">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:event/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:event/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:event/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:event/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:event/f:detail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:section">
|
||||
<sch:assert test="exists(f:content) != exists(f:section)">Inv-2: A section SHALL have content or one or more sections, but not both.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:section/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:section/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:section/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:section/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Composition/f:section/f:content">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>ConceptMap</sch:title>
|
||||
<sch:rule context="/f:ConceptMap/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ConceptMap/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ConceptMap/f:source">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ConceptMap/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ConceptMap/f:concept/f:map">
|
||||
<sch:assert test="exists(f:system) or not(exists(f:code))">Inv-2: If a code is provided, a system SHALL be provided</sch:assert>
|
||||
<sch:assert test="exists(f:comments) or ((f:equivalence/@value != 'narrower') and (f:equivalence/@value != 'inexact'))">Inv-1: If the map is narrower, there SHALL be some comments</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Condition</sch:title>
|
||||
<sch:rule context="/f:Condition/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:asserter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:category">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:category/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:category/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:certainty">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:certainty/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:certainty/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:severity">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:severity/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:severity/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:onsetAge">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:abatementAge">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:stage">
|
||||
<sch:assert test="exists(f:summary) or exists(f:assessment)">Inv-1: Stage SHALL have summary or assessment</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:stage/f:summary">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:stage/f:summary/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:stage/f:summary/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:stage/f:assessment">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:evidence">
|
||||
<sch:assert test="exists(f:code) or exists(f:detail)">Inv-2: evidence SHALL have code or details</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:evidence/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:evidence/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:evidence/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:evidence/f:detail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:location">
|
||||
<sch:assert test="exists(f:code) or exists(f:detail)">Inv-3: location SHALL have code or details</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:location/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:location/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:location/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:relatedItem">
|
||||
<sch:assert test="exists(f:code) != exists(f:target)">Inv-4: Relationship SHALL have either a code or a target</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:relatedItem/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:relatedItem/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:relatedItem/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Condition/f:relatedItem/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Conformance</sch:title>
|
||||
<sch:rule context="/f:Conformance">
|
||||
<sch:assert test="count(f:software | f:implementation | f:description) > 0">Inv-2: A Conformance statement SHALL have at least one of description, software, or implementation</sch:assert>
|
||||
<sch:assert test="exists(f:rest) or exists(f:messaging) or exists(f:document)">Inv-1: A Conformance statement SHALL have at least one of rest, messaging or document</sch:assert>
|
||||
<sch:assert test="count(f:document[f:mode='producer'])=count(distinct-values(f:document[f:mode='producer']/f:profile/@value)) and count(f:document[f:mode='consumer'])=count(distinct-values(f:document[f:mode='consumer']/f:profile/@value))">Inv-7: The set of documents must be unique by the combination of profile & mode</sch:assert>
|
||||
<sch:assert test="count(f:messaging/f:endpoint)=count(distinct-values(f:messaging/f:endpoint/@value))">Inv-5: The set of end points listed for messaging must be unique</sch:assert>
|
||||
<sch:assert test="count(f:messaging)<=1 or not(f:messaging[not(f:endpoint)])">Inv-4: If there is more than one messaging element, endpoint must be specified for each one</sch:assert>
|
||||
<sch:assert test="count(f:rest)=count(distinct-values(f:rest/f:mode/@value))">Inv-8: There can only be one REST declaration per mode</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:profile">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest">
|
||||
<sch:assert test="count(f:query)=count(distinct-values(f:query/f:name/@value))">Inv-10: A given query can only be described once per RESTful mode</sch:assert>
|
||||
<sch:assert test="count(f:resource)=count(distinct-values(f:resource/f:type/@value))">Inv-9: A given resource can only be described once per RESTful mode</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest/f:security/f:service">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest/f:security/f:service/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest/f:security/f:service/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest/f:resource">
|
||||
<sch:assert test="count(f:operation)=count(distinct-values(f:operation/f:code/@value))">Inv-11: Operation codes must be unique in the context of a resource</sch:assert>
|
||||
<sch:assert test="count(f:searchParam)=count(distinct-values(f:searchParam/f:name/@value))">Inv-12: Search parameter names must be unique in the context of a resource</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest/f:resource/f:profile">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:rest/f:query">
|
||||
<sch:assert test="count(f:parameter)=count(distinct-values(f:parameter/f:name/@value))">Inv-13: Search parameter names must be unique in the context of a query</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging">
|
||||
<sch:assert test="exists(f:endpoint) = exists(parent::f:Conformance/f:implementation)">Inv-3: Messaging end point is required (and is only permitted) when statement is for an implementation</sch:assert>
|
||||
<sch:assert test="count(f:event[f:mode='sender'])=count(distinct-values(f:event[f:mode='sender']/f:code/@value)) and count(f:event[f:mode='receiver'])=count(distinct-values(f:event[f:mode='receiver']/f:code/@value))">Inv-6: The set of events per messaging endpoint must be unique by the combination of code & mode</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging/f:event/f:code">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging/f:event/f:code/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging/f:event/f:protocol">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging/f:event/f:protocol/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging/f:event/f:request">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:messaging/f:event/f:response">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Conformance/f:document/f:profile">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Device</sch:title>
|
||||
<sch:rule context="/f:Device/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:owner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:contact">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Device/f:contact/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>DeviceObservationReport</sch:title>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:source">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:channel/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:channel/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:channel/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DeviceObservationReport/f:virtualDevice/f:channel/f:metric/f:observation">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>DiagnosticOrder</sch:title>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:orderer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:event/f:description">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:event/f:description/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:event/f:description/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:event/f:actor">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:bodySite">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:bodySite/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticOrder/f:item/f:bodySite/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>DiagnosticReport</sch:title>
|
||||
<sch:rule context="/f:DiagnosticReport/f:name">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:name/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:name/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:requestDetail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:serviceCategory">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:serviceCategory/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:serviceCategory/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:diagnosticPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:result">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:imagingStudy">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:image/f:link">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:codedDiagnosis">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:codedDiagnosis/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DiagnosticReport/f:codedDiagnosis/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>DocumentManifest</sch:title>
|
||||
<sch:rule context="/f:DocumentManifest/f:masterIdentifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:masterIdentifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:recipient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:supercedes">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:confidentiality">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:confidentiality/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:confidentiality/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentManifest/f:content">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>DocumentReference</sch:title>
|
||||
<sch:rule context="/f:DocumentReference">
|
||||
<sch:assert test="exists(f:location) or exists(f:service)">Inv-1: A location or a service (or both) SHALL be provided</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:masterIdentifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:masterIdentifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:class">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:class/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:class/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:custodian">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:authenticator">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:docStatus">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:docStatus/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:docStatus/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:relatesTo/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:confidentiality">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:confidentiality/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:confidentiality/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:service/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:service/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:service/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:event">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:event/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:event/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:facilityType">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:facilityType/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:DocumentReference/f:context/f:facilityType/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,147 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Encounter</sch:title>
|
||||
<sch:rule context="/f:Encounter/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:participant/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:participant/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:participant/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:participant/f:individual">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:length">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:reason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:reason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:reason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:indication">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:priority">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:priority/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:priority/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:preAdmissionIdentifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:preAdmissionIdentifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:origin">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:admitSource">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:admitSource/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:admitSource/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:accomodation/f:bed">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:accomodation/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:diet">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:diet/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:diet/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:specialCourtesy">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:specialCourtesy/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:specialCourtesy/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:specialArrangement">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:specialArrangement/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:specialArrangement/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:destination">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:dischargeDisposition">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:dischargeDisposition/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:dischargeDisposition/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:hospitalization/f:dischargeDiagnosis">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:location/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:location/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:serviceProvider">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Encounter/f:partOf">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>FamilyHistory</sch:title>
|
||||
<sch:rule context="/f:FamilyHistory/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:relationship">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:relationship/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:relationship/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:bornPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:deceasedAge">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:deceasedRange">
|
||||
<sch:assert test="not(exists(f:low/f:comparator) or exists(f:high/f:comparator))">Inv-3: Quantity values cannot have a comparator when used in a Range</sch:assert>
|
||||
<sch:assert test="not(exists(f:low/f:value/@value)) or not(exists(f:high/f:value/@value)) or (number(f:low/f:value/@value) <= number(f:high/f:value/@value))">Inv-2: If present, low SHALL have a lower value than high</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:deceasedRange/f:low">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:deceasedRange/f:high">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:outcome">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:outcome/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:outcome/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:onsetAge">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:onsetRange">
|
||||
<sch:assert test="not(exists(f:low/f:comparator) or exists(f:high/f:comparator))">Inv-3: Quantity values cannot have a comparator when used in a Range</sch:assert>
|
||||
<sch:assert test="not(exists(f:low/f:value/@value)) or not(exists(f:high/f:value/@value)) or (number(f:low/f:value/@value) <= number(f:high/f:value/@value))">Inv-2: If present, low SHALL have a lower value than high</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:onsetRange/f:low">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:FamilyHistory/f:relation/f:condition/f:onsetRange/f:high">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2011-2012, HL7, Inc
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Generated on Mon, Feb 3, 2014 23:47+1100 for FHIR v0.80
|
||||
-->
|
||||
<xs:schema xmlns="http://hl7.org/fhir" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="0.80">
|
||||
<xs:include schemaLocation="adversereaction.xsd"/>
|
||||
<xs:include schemaLocation="alert.xsd"/>
|
||||
<xs:include schemaLocation="allergyintolerance.xsd"/>
|
||||
<xs:include schemaLocation="careplan.xsd"/>
|
||||
<xs:include schemaLocation="composition.xsd"/>
|
||||
<xs:include schemaLocation="conceptmap.xsd"/>
|
||||
<xs:include schemaLocation="condition.xsd"/>
|
||||
<xs:include schemaLocation="conformance.xsd"/>
|
||||
<xs:include schemaLocation="device.xsd"/>
|
||||
<xs:include schemaLocation="deviceobservationreport.xsd"/>
|
||||
<xs:include schemaLocation="diagnosticorder.xsd"/>
|
||||
<xs:include schemaLocation="diagnosticreport.xsd"/>
|
||||
<xs:include schemaLocation="documentmanifest.xsd"/>
|
||||
<xs:include schemaLocation="documentreference.xsd"/>
|
||||
<xs:include schemaLocation="encounter.xsd"/>
|
||||
<xs:include schemaLocation="familyhistory.xsd"/>
|
||||
<xs:include schemaLocation="group.xsd"/>
|
||||
<xs:include schemaLocation="imagingstudy.xsd"/>
|
||||
<xs:include schemaLocation="immunization.xsd"/>
|
||||
<xs:include schemaLocation="immunizationrecommendation.xsd"/>
|
||||
<xs:include schemaLocation="list.xsd"/>
|
||||
<xs:include schemaLocation="location.xsd"/>
|
||||
<xs:include schemaLocation="media.xsd"/>
|
||||
<xs:include schemaLocation="medication.xsd"/>
|
||||
<xs:include schemaLocation="medicationadministration.xsd"/>
|
||||
<xs:include schemaLocation="medicationdispense.xsd"/>
|
||||
<xs:include schemaLocation="medicationprescription.xsd"/>
|
||||
<xs:include schemaLocation="medicationstatement.xsd"/>
|
||||
<xs:include schemaLocation="messageheader.xsd"/>
|
||||
<xs:include schemaLocation="observation.xsd"/>
|
||||
<xs:include schemaLocation="operationoutcome.xsd"/>
|
||||
<xs:include schemaLocation="order.xsd"/>
|
||||
<xs:include schemaLocation="orderresponse.xsd"/>
|
||||
<xs:include schemaLocation="organization.xsd"/>
|
||||
<xs:include schemaLocation="other.xsd"/>
|
||||
<xs:include schemaLocation="patient.xsd"/>
|
||||
<xs:include schemaLocation="practitioner.xsd"/>
|
||||
<xs:include schemaLocation="procedure.xsd"/>
|
||||
<xs:include schemaLocation="profile.xsd"/>
|
||||
<xs:include schemaLocation="provenance.xsd"/>
|
||||
<xs:include schemaLocation="query.xsd"/>
|
||||
<xs:include schemaLocation="questionnaire.xsd"/>
|
||||
<xs:include schemaLocation="relatedperson.xsd"/>
|
||||
<xs:include schemaLocation="securityevent.xsd"/>
|
||||
<xs:include schemaLocation="specimen.xsd"/>
|
||||
<xs:include schemaLocation="substance.xsd"/>
|
||||
<xs:include schemaLocation="supply.xsd"/>
|
||||
<xs:include schemaLocation="valueset.xsd"/>
|
||||
|
||||
<xs:include schemaLocation="binary.xsd"/>
|
||||
</xs:schema>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Group</sch:title>
|
||||
<sch:rule context="/f:Group">
|
||||
<sch:assert test="f:actual/@value='true' or not(exists(f:member))">Inv-1: Can only have members if group is "actual"</sch:assert>
|
||||
<sch:assert test="not(f:quantity) or not(f:member) or not(f:quantity>count(f:member))">Inv-4: Can't have more members associated with the group than the value specified for "quantity"</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueRange">
|
||||
<sch:assert test="not(exists(f:low/f:comparator) or exists(f:high/f:comparator))">Inv-3: Quantity values cannot have a comparator when used in a Range</sch:assert>
|
||||
<sch:assert test="not(exists(f:low/f:value/@value)) or not(exists(f:high/f:value/@value)) or (number(f:low/f:value/@value) <= number(f:high/f:value/@value))">Inv-2: If present, low SHALL have a lower value than high</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueRange/f:low">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:characteristic/f:valueRange/f:high">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:member">
|
||||
<sch:assert test="lower-case(f:type/@value)=parent::f:Group/f:type/@value or (f:type/@value='Patient' and parent::f:Group/f:type/@value=('animal','person'))">Inv-3: Member resource types SHALL agree with group type</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Group/f:member">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>ImagingStudy</sch:title>
|
||||
<sch:rule context="/f:ImagingStudy/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:accessionNo/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:accessionNo/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:order">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:referrer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:procedure">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:procedure/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:interpreter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:series/f:bodySite">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:series/f:bodySite/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImagingStudy/f:series/f:instance/f:attachment">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Immunization</sch:title>
|
||||
<sch:rule context="/f:Immunization/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccineType">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccineType/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccineType/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:requester">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:manufacturer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:site">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:site/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:site/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:route">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:route/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:route/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:doseQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:explanation/f:reason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:explanation/f:reason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:explanation/f:reason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:explanation/f:refusalReason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:explanation/f:refusalReason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:explanation/f:refusalReason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:reaction/f:detail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:authority">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseTarget">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseTarget/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseTarget/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseStatus">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseStatus/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseStatus/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseStatusReason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseStatusReason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Immunization/f:vaccinationProtocol/f:doseStatusReason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>ImmunizationRecommendation</sch:title>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:vaccineType">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:vaccineType/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:vaccineType/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:forecastStatus">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:forecastStatus/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:forecastStatus/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:dateCriterion/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:dateCriterion/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:dateCriterion/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:protocol/f:authority">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:supportingImmunization">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ImmunizationRecommendation/f:recommendation/f:supportingPatientInformation">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>List</sch:title>
|
||||
<sch:rule context="/f:List">
|
||||
<sch:assert test="(f:mode/@value = 'changes') or not(exists(f:entry/f:item/f:deleted))">Inv-2: The deleted flag can only be used if the mode of the list is "changes"</sch:assert>
|
||||
<sch:assert test="not(exists(f:emptyReason) and exists(f:entry))">Inv-1: A list can only have an emptyReason if it is empty</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:source">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:entry/f:flag">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:entry/f:flag/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:entry/f:flag/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:entry/f:item">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:emptyReason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:emptyReason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:List/f:emptyReason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Location</sch:title>
|
||||
<sch:rule context="/f:Location/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:physicalType">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:physicalType/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:physicalType/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:managingOrganization">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Location/f:partOf">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Media</sch:title>
|
||||
<sch:rule context="/f:Media">
|
||||
<sch:assert test="(f:type/@value='photo') or not(f:frames)">Inv-3: Frames can only be used for a photo</sch:assert>
|
||||
<sch:assert test="not(f:type/@value='audio') or not(f:width)">Inv-2: Width can only be used for a photo or video</sch:assert>
|
||||
<sch:assert test="not(f:type/@value='audio') or not(f:height)">Inv-1: Height can only be used for a photo or video</sch:assert>
|
||||
<sch:assert test="not(f:type/@value='photo') or not(f:length)">Inv-4: Length can only be used for an audio or a video</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:subtype">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:subtype/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:subtype/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:operator">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:view">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:view/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Media/f:view/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Medication</sch:title>
|
||||
<sch:rule context="/f:Medication/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:manufacturer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:form">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:form/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:form/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:ingredient/f:item">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:ingredient/f:amount">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:ingredient/f:amount/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:product/f:ingredient/f:amount/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:package/f:container">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:package/f:container/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:package/f:container/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:package/f:content/f:item">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Medication/f:package/f:content/f:amount">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>MedicationAdministration</sch:title>
|
||||
<sch:rule context="/f:MedicationAdministration">
|
||||
<sch:assert test="not(exists(f:reasonNotGiven)) or f:wasNotGiven='true'">Inv-2: Reason not given is only permitted if wasNotGiven is true</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:practitioner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:prescription">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:reasonNotGiven">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:reasonNotGiven/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:reasonNotGiven/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:whenGiven">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:medication">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:device">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage">
|
||||
<sch:assert test="exists(f:quantity) or exists(f:rate)">Inv-1: SHALL have at least one of dosage.quantity and dosage.rate</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:timingPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:asNeededCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:asNeededCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:asNeededCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:site">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:site/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:site/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:route">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:route/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:route/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:method">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:method/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:method/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:rate">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:rate/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:rate/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:maxDosePerPeriod">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:maxDosePerPeriod/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationAdministration/f:dosage/f:maxDosePerPeriod/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,157 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>MedicationDispense</sch:title>
|
||||
<sch:rule context="/f:MedicationDispense/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispenser">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:authorizingPrescription">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense">
|
||||
<sch:assert test="not(exists(f:whenHandedOver/@value)) or not(exists(f:whenPrepared/@value)) or ( f:whenHandedOver/@value >= f:whenPrepared/@value)">Inv-1: whenHandedOver cannot be before whenPrepared</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:medication">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:destination">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:receiver">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:additionalInstructions">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:additionalInstructions/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:additionalInstructions/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:timingPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:timingSchedule">
|
||||
<sch:assert test="not(exists(f:repeat)) or count(f:event) < 2">Inv-1: There can only be a repeat element if there is none or one event</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:timingSchedule/f:event">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:timingSchedule/f:repeat">
|
||||
<sch:assert test="not(exists(f:count) and exists(f:end))">Inv-3: At most, only one of count or end can be present</sch:assert>
|
||||
<sch:assert test="exists(f:frequency) != exists(f:when)">Inv-2: Either frequency or when SHALL be present, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:timingSchedule/f:repeat/f:duration">
|
||||
<sch:assert test="@value > 0 or not(@value)">Inv-4: duration SHALL be a positive value</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:asNeededCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:asNeededCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:asNeededCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:site">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:site/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:site/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:route">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:route/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:route/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:method">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:method/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:method/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:rate">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:rate/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:rate/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:maxDosePerPeriod">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:maxDosePerPeriod/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:dispense/f:dosage/f:maxDosePerPeriod/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:reason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:reason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:reason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationDispense/f:substitution/f:responsibleParty">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>MedicationPrescription</sch:title>
|
||||
<sch:rule context="/f:MedicationPrescription/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:prescriber">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:reasonCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:reasonCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:reasonCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:reasonResource">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:medication">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:additionalInstructions">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:additionalInstructions/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:additionalInstructions/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:timingPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:timingSchedule">
|
||||
<sch:assert test="not(exists(f:repeat)) or count(f:event) < 2">Inv-1: There can only be a repeat element if there is none or one event</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:timingSchedule/f:event">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:timingSchedule/f:repeat">
|
||||
<sch:assert test="not(exists(f:count) and exists(f:end))">Inv-3: At most, only one of count or end can be present</sch:assert>
|
||||
<sch:assert test="exists(f:frequency) != exists(f:when)">Inv-2: Either frequency or when SHALL be present, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:timingSchedule/f:repeat/f:duration">
|
||||
<sch:assert test="@value > 0 or not(@value)">Inv-4: duration SHALL be a positive value</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:asNeededCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:asNeededCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:asNeededCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:site">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:site/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:site/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:route">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:route/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:route/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:method">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:method/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:method/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:doseQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:rate">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:rate/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:rate/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:maxDosePerPeriod">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:maxDosePerPeriod/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dosageInstruction/f:maxDosePerPeriod/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dispense/f:medication">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dispense/f:validityPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dispense/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:dispense/f:expectedSupplyDuration">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:substitution/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:substitution/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:substitution/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:substitution/f:reason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:substitution/f:reason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationPrescription/f:substitution/f:reason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>MedicationStatement</sch:title>
|
||||
<sch:rule context="/f:MedicationStatement">
|
||||
<sch:assert test="not(exists(f:reasonNotGiven)) or f:wasNotGiven='true'">Inv-1: Reason not given is only permitted if wasNotGiven is true</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:reasonNotGiven">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:reasonNotGiven/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:reasonNotGiven/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:whenGiven">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:medication">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:device">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:timing">
|
||||
<sch:assert test="not(exists(f:repeat)) or count(f:event) < 2">Inv-1: There can only be a repeat element if there is none or one event</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:timing/f:event">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:timing/f:repeat">
|
||||
<sch:assert test="not(exists(f:count) and exists(f:end))">Inv-3: At most, only one of count or end can be present</sch:assert>
|
||||
<sch:assert test="exists(f:frequency) != exists(f:when)">Inv-2: Either frequency or when SHALL be present, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:timing/f:repeat/f:duration">
|
||||
<sch:assert test="@value > 0 or not(@value)">Inv-4: duration SHALL be a positive value</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:asNeededCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:asNeededCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:asNeededCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:site">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:site/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:site/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:route">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:route/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:route/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:method">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:method/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:method/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:rate">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:rate/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:rate/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:maxDosePerPeriod">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:maxDosePerPeriod/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MedicationStatement/f:dosage/f:maxDosePerPeriod/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>MessageHeader</sch:title>
|
||||
<sch:rule context="/f:MessageHeader/f:event">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:event/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:response/f:details">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:source/f:contact">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:source/f:contact/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:destination/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:enterer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:receiver">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:responsible">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:reason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:reason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:reason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:MessageHeader/f:data">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Observation</sch:title>
|
||||
<sch:rule context="/f:Observation">
|
||||
<sch:assert test="exists(f:valueQuantity) or not(exists(f:normalRange))">Inv-2: Can only have normal range if value is a quantity</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:name">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:name/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:name/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueRatio">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueRatio/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueRatio/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valuePeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:valueSampledData/f:origin">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:interpretation">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:interpretation/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:interpretation/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:appliesPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:bodySite">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:bodySite/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:bodySite/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:method">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:method/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:method/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange">
|
||||
<sch:assert test="(exists(f:low) or exists(f:high)) and not(exists(f:low/f:comparator)) and not(exists(f:high/f:comparator))">Inv-3: Must have at least a low or a high (and no comparators)</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:low">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:high">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:meaning">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:meaning/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:meaning/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:age">
|
||||
<sch:assert test="not(exists(f:low/f:comparator) or exists(f:high/f:comparator))">Inv-3: Quantity values cannot have a comparator when used in a Range</sch:assert>
|
||||
<sch:assert test="not(exists(f:low/f:value/@value)) or not(exists(f:high/f:value/@value)) or (number(f:low/f:value/@value) <= number(f:high/f:value/@value))">Inv-2: If present, low SHALL have a lower value than high</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:age/f:low">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:referenceRange/f:age/f:high">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Observation/f:related/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:os="http://a9.com/-/spec/opensearch/1.1/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://a9.com/-/spec/opensearch/1.1/" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:element name="totalResults" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Used by a server to inform the client of the total number of search
|
||||
matches (not including including resources)</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:schema>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:os="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://a9.com/-/opensearch/extensions/relevance/1.0/" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:element name="score" type="xs:decimal">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Contains a string indicating a relative assessment of relevance for a particular search result with respect to the search query.
|
||||
|
||||
Decimal values less than 0 should be considered equal to 0.
|
||||
|
||||
Decimal values greater than 1 should be considered equal to 1.
|
||||
|
||||
Unparseable or empty values can be ignored by the client.
|
||||
|
||||
Restrictions: The value must contain a decimal representation of a real number between 0 and 1, inclusive.
|
||||
Requirements: This element may appear zero or one time.
|
||||
The score element is used to indicate a relative assessment of relevance for a particular search result with respect to the search query.
|
||||
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:schema>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>OperationOutcome</sch:title>
|
||||
<sch:rule context="/f:OperationOutcome/f:issue/f:type">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OperationOutcome/f:issue/f:type/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Order</sch:title>
|
||||
<sch:rule context="/f:Order/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:source">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:reasonCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:reasonCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:reasonCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:reasonResource">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:authority">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when">
|
||||
<sch:assert test="exists(f:code) != exists(f:schedule)">Inv-1: Provide a code or a schedule, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:schedule">
|
||||
<sch:assert test="not(exists(f:repeat)) or count(f:event) < 2">Inv-1: There can only be a repeat element if there is none or one event</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:schedule/f:event">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:schedule/f:repeat">
|
||||
<sch:assert test="not(exists(f:count) and exists(f:end))">Inv-3: At most, only one of count or end can be present</sch:assert>
|
||||
<sch:assert test="exists(f:frequency) != exists(f:when)">Inv-2: Either frequency or when SHALL be present, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:when/f:schedule/f:repeat/f:duration">
|
||||
<sch:assert test="@value > 0 or not(@value)">Inv-4: duration SHALL be a positive value</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Order/f:detail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>OrderResponse</sch:title>
|
||||
<sch:rule context="/f:OrderResponse/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:request">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:who">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:authorityCodeableConcept">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:authorityCodeableConcept/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:authorityCodeableConcept/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:authorityResource">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:OrderResponse/f:fulfillment">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Organization</sch:title>
|
||||
<sch:rule context="/f:Organization">
|
||||
<sch:assert test="count(f:identifier | f:name) > 0">Inv-1: The organization SHALL at least have a name or an id, and possibly more than one</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:telecom">
|
||||
<sch:assert test="count(f:use[@value='home']) = 0">Inv-3: The telecom of an organization can never be of use 'home'</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:address">
|
||||
<sch:assert test="count(f:use[@value='home']) = 0">Inv-2: An address of an organization can never be of use 'home'</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:partOf">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:purpose">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:purpose/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:purpose/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:name/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:gender">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:gender/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:contact/f:gender/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Organization/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Other</sch:title>
|
||||
<sch:rule context="/f:Other/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Other/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Other/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Other/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Other/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Other/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Other/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Patient</sch:title>
|
||||
<sch:rule context="/f:Patient/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:name/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:gender">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:gender/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:gender/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:maritalStatus">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:maritalStatus/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:maritalStatus/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact">
|
||||
<sch:assert test="f:name or f:telecom or f:address or f:organization">Inv-1: SHALL at least contain a contact's details or a reference to an organization</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:relationship">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:relationship/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:relationship/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:name/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:gender">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:gender/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:gender/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:contact/f:organization">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:species">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:species/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:species/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:breed">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:breed/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:breed/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:genderStatus">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:genderStatus/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:animal/f:genderStatus/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:communication">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:communication/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:communication/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:careProvider">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:managingOrganization">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Patient/f:link/f:other">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Practitioner</sch:title>
|
||||
<sch:rule context="/f:Practitioner/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:name/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:gender">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:gender/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:gender/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:organization">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:role">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:role/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:role/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:specialty">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:specialty/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:specialty/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:qualification/f:code">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:qualification/f:code/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:qualification/f:code/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:qualification/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:qualification/f:issuer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:communication">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:communication/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Practitioner/f:communication/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Procedure</sch:title>
|
||||
<sch:rule context="/f:Procedure/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:bodySite">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:bodySite/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:bodySite/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:indication">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:indication/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:indication/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:performer/f:person">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:performer/f:role">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:performer/f:role/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:performer/f:role/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:date">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:report">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:complication">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:complication/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:complication/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Procedure/f:relatedItem/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Profile</sch:title>
|
||||
<sch:rule context="/f:Profile">
|
||||
<sch:assert test="not(exists(for $structure in f:structure return $structure/preceding-sibling::f:structure[f:type/@value=$structure/f:type/@value and f:name/@value = $structure/f:name/@value]))">Inv-17: There can't be multiple structures with the same type and name</sch:assert>
|
||||
<sch:assert test="count(f:structure[not(f:name)]) = count(distinct-values(f:structure[not(f:name)]/f:type/@value))">Inv-15: Where multiple structures exist with the same type, they SHALL have names</sch:assert>
|
||||
<sch:assert test="exists(f:structure) or exists(f:extensionDefn)">Inv-8: SHALL define at least one structure constraint or extension definition</sch:assert>
|
||||
<sch:assert test="count(f:extensionDefn) = count(distinct-values(f:extensionDefn/f:code/@value))">Inv-16: Extension definition codes must be unique</sch:assert>
|
||||
<sch:assert test="count(distinct-values(f:structure/f:name/@value)) =count(f:structure/f:name)">Inv-27: Structure name must be unique</sch:assert>
|
||||
<sch:assert test="count(distinct-values(f:query/f:name/@value)) =count(f:query/f:name)">Inv-28: Query name must be unique</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:code">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:code/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:mapping">
|
||||
<sch:assert test="exists(f:uri) or exists(f:name)">Inv-26: Must have at a name or a uri (or both)</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure">
|
||||
<sch:assert test="count(f:element) >= count(distinct-values(f:element/f:path/@value))">Inv-18: Element paths must be unique - or not (LM)</sch:assert>
|
||||
<sch:assert test="count(distinct-values(f:searchParam/f:name/@value)) =count(f:searchParam/f:name)">Inv-29: Parameter names must be unique within structure</sch:assert>
|
||||
<sch:assert test="upper-case(substring(f:type,1,1))=substring(f:type,1,1)">Inv-12: Only complex types can be constrained, not primitive types such as string etc.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element">
|
||||
<sch:assert test="not(f:slicing) or (not(starts-with(preceding-sibling::f:element[1]/f:path/@value, current()/f:path/@value)) and following-sibling::f:element[1]/f:path/@value=current()/f:path/@value)">Inv-21: An element that's a slicing descriptor must not be preceded by an element that starts with the same path and must be followed by an element with exactly the same path.</sch:assert>
|
||||
<sch:assert test="exists(f:slicing)!=exists(f:definition)">Inv-20: An element must either be a definition or a slicing descriptor, never both.</sch:assert>
|
||||
<sch:assert test="exists(f:slicing) != exists(f:definition)">Inv-11: Must have either a slice or a definition, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element/f:definition">
|
||||
<sch:assert test="not(exists(f:nameReference) and exists(f:*[starts-with(local-name(.), 'value')]))">Inv-2: Either a namereference or a fixed value (but not both) is permitted</sch:assert>
|
||||
<sch:assert test="not(exists(f:*[starts-with(local-name(.), 'value')])) or (count(f:type)=1 and f:type/f:code[substring(@value,1,1)=lower-case(substring(@value,1,1))])">Inv-10: Value may only be specified if the type consists of a single repetition that has a type corresponding to one of the primitive data types.</sch:assert>
|
||||
<sch:assert test="not(exists(f:binding)) or f:type/f:code/@value=('code','Coding','CodeableConcept','Quantity')">Inv-7: Binding can only be present for coded elements</sch:assert>
|
||||
<sch:assert test="count(f:element[f:name]) = count(distinct-values(f:element/f:name/@value))">Inv-19: Element names must be unique</sch:assert>
|
||||
<sch:assert test="count(f:type[not(f:profile)]) = count(distinct-values(f:type[not(f:profile)]/f:code/@value))">Inv-22: If a definition has multiple types with the same code, each must specify a profile</sch:assert>
|
||||
<sch:assert test="not(exists(for $type in f:type return $type/preceding-sibling::f:type[f:code/@value=$type/f:code/@value and f:profile/@value = $type/f:profile/@value]))">Inv-23: Types must be unique by the combination of code and profile</sch:assert>
|
||||
<sch:assert test="count(f:constraint) = count(distinct-values(f:constraint/f:key/@value))">Inv-24: Constraints must be unique by key</sch:assert>
|
||||
<sch:assert test="count(f:constraint[f:name]) = count(distinct-values(f:constraint/f:name/@value))">Inv-25: Constraint names must be unique.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element/f:definition/f:max">
|
||||
<sch:assert test="@value='*' or (normalize-space(@value)!='' and normalize-space(translate(@value, '0123456789',''))='')">Inv-6: Max SHALL be a number or "*"</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element/f:definition/f:type">
|
||||
<sch:assert test="not(exists(f:aggregation)) or exists(f:code[starts-with(@value, 'Resource(')])">Inv-9: Aggregation may only be specified if one of the allowed types for the element is a resource</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element/f:definition/f:binding">
|
||||
<sch:assert test="(exists(f:referenceUri) or exists(f:referenceResource)) or exists(f:description)">Inv-3: provide either a reference or a description (or both)</sch:assert>
|
||||
<sch:assert test="not(f:Conformance/value='example' and f:isExtensible.value='false')">Inv-14: Example value sets are always extensible</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element/f:definition/f:binding/f:referenceUri">
|
||||
<sch:assert test="starts-with(@value, 'http:') or starts-with(@value, 'https:')">Inv-13: uri SHALL start with http:// or https://</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:structure/f:element/f:definition/f:binding/f:referenceResource">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Profile/f:extensionDefn/f:code">
|
||||
<sch:assert test="count(ancestor::f:Profile/f:extensionDefn/f:code[@value=current()/@value])=1">Inv-5: Codes SHALL be unique in the context of a profile</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Provenance</sch:title>
|
||||
<sch:rule context="/f:Provenance/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:reason">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:reason/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:reason/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:location">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:agent/f:role">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:agent/f:role/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:agent/f:type">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:agent/f:type/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:entity/f:type">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Provenance/f:entity/f:type/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Query</sch:title>
|
||||
<sch:rule context="/f:Query/f:response/f:reference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Questionnaire</sch:title>
|
||||
<sch:rule context="/f:Questionnaire/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:source">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:name">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:name/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:name/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group">
|
||||
<sch:assert test="not(exists(f:group) and exists(f:question))">Inv-3: Groups may either contain questions or groups but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:name">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:name/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:name/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question">
|
||||
<sch:assert test="count(f:name) + count(f:text) >= 1">Inv-2: Must supply a name, a question's text or both</sch:assert>
|
||||
<sch:assert test="count(f:data) + count(f:choice) + count(f:answer) <= 1">Inv-1: Must supply either a simple answer, a choice, data or nothing</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question/f:name">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question/f:name/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question/f:name/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question/f:choice">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question/f:choice/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Questionnaire/f:group/f:question/f:options">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>RelatedPerson</sch:title>
|
||||
<sch:rule context="/f:RelatedPerson/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:relationship">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:relationship/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:relationship/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:name/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:gender">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:gender/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:gender/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:RelatedPerson/f:address/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>SecurityEvent</sch:title>
|
||||
<sch:rule context="/f:SecurityEvent/f:event/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:event/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:event/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:event/f:subtype">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:event/f:subtype/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:event/f:subtype/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant">
|
||||
<sch:assert test="exists(f:userId) != exists(f:reference)">Inv-3: Either a userId or a reference, but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant/f:role">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant/f:role/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant/f:role/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant/f:reference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant/f:media">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:participant/f:media/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:source/f:type">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:source/f:type/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object">
|
||||
<sch:assert test="exists(f:identifier) != exists(f:reference)">Inv-2: Either an identifier or a reference, but not both</sch:assert>
|
||||
<sch:assert test="not(exists(f:name)) or not(exists(f:query))">Inv-1: Either a name or a query (or both)</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object/f:reference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object/f:sensitivity">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object/f:sensitivity/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:SecurityEvent/f:object/f:sensitivity/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Specimen</sch:title>
|
||||
<sch:rule context="/f:Specimen/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:source/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:accessionIdentifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:accessionIdentifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:collector">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:collectedPeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:method">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:method/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:method/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:sourceSite">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:sourceSite/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:collection/f:sourceSite/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:treatment/f:procedure">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:treatment/f:procedure/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:treatment/f:procedure/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:treatment/f:additive">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:capacity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:specimenQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Specimen/f:container/f:additive">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Substance</sch:title>
|
||||
<sch:rule context="/f:Substance/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:instance/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:instance/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:instance/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:ingredient/f:quantity">
|
||||
<sch:assert test="count(f:numerator) = count(f:denominator)">Inv-1: numerator and denominator SHALL both be present, or both be absent</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:ingredient/f:quantity/f:numerator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:ingredient/f:quantity/f:denominator">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Substance/f:ingredient/f:substance">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>Supply</sch:title>
|
||||
<sch:rule context="/f:Supply/f:kind">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:kind/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:kind/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:orderedItem">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:patient">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:type">
|
||||
<sch:assert test="count(f:coding[f:primary/@value='true'])<1">Inv-2: Only one coding in a set can be chosen directly by the user</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:type/f:coding">
|
||||
<sch:assert test="not (exists(f:valueSet) and exists(f:code)) or exists(f:system)">Inv-1: If a valueSet is provided, a system URI Is required</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:type/f:coding/f:valueSet">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">Inv-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:suppliedItem">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:supplier">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:whenPrepared">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:whenHandedOver">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:destination">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:Supply/f:dispense/f:receiver">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema targetNamespace="http://purl.org/atompub/tombstones/1.0" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:at="http://purl.org/atompub/tombstones/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="deleted-entry">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="link" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="rel" fixed="self"/>
|
||||
<xs:attribute name="href" type="xs:anyURI" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="ref" type="xs:anyURI" use="required"/>
|
||||
<xs:attribute name="when" type="xs:dateTime" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
||||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="a" uri="http://www.w3.org/2005/Atom"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<sch:pattern>
|
||||
<sch:title>ValueSet</sch:title>
|
||||
<sch:rule context="/f:ValueSet">
|
||||
<sch:assert test="not(exists(f:compose)) or (count(f:compose/f:import)!=1 or exists(f:compose/f:include) or exists(f:compose/f:exclude) or exists(f:define))">Inv-2: A value set with only one import SHALL also have an include and/or an exclude unless the value set defines its own codes</sch:assert>
|
||||
<sch:assert test="not(exists(f:define)) or (f:define/f:system/@value != f:identifier/@value)">Inv-7: A defined code system (if present) SHALL have a different identifier to the value set itself</sch:assert>
|
||||
<sch:assert test="exists(f:define) or exists(f:compose) or exists(f:expansion)">Inv-5: Value set SHALL contain either a define, a compose, or an expansion element</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">Inv-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:define">
|
||||
<sch:assert test="count(distinct-values(descendant::f:concept/f:code/@value))=count(descendant::f:concept)">Inv-3: Within a code system definition, all the codes SHALL be unique</sch:assert>
|
||||
<sch:assert test="count(descendant::f:concept)=count(distinct-values(descendant::f:concept/f:code/@value))">Inv-8: Codes must be unique</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:compose">
|
||||
<sch:assert test="exists(f:include) or exists(f:import)">Inv-1: A value set composition SHALL have an include or an import</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:expansion/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:expansion/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])">Inv-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="/f:ValueSet/f:expansion/f:contains">
|
||||
<sch:assert test="exists(f:code) or exists(f:display)">Inv-6: SHALL have a code or a display</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,272 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" targetNamespace="http://www.w3.org/XML/1998/namespace" xml:lang="en">
|
||||
<!-- Note: When using this schema with some tools, it may also be necessary to declare xmlns:xml="http://www.w3.org/XML/1998/namespace", however this causes performance issues with other tools and thus is not in the base schemas. -->
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div>
|
||||
<h1>About the XML namespace</h1>
|
||||
<div class="bodytext">
|
||||
<p>
|
||||
This schema document describes the XML namespace, in a form
|
||||
suitable for import by other schema documents.
|
||||
</p>
|
||||
<p>
|
||||
See <a href="http://www.w3.org/XML/1998/namespace.html">
|
||||
http://www.w3.org/XML/1998/namespace.html</a> and
|
||||
<a href="http://www.w3.org/TR/REC-xml">
|
||||
http://www.w3.org/TR/REC-xml</a> for information
|
||||
about this namespace.
|
||||
</p>
|
||||
<p>
|
||||
Note that local names in this namespace are intended to be
|
||||
defined only by the World Wide Web Consortium or its subgroups.
|
||||
The names currently defined in this namespace are listed below.
|
||||
They should not be used with conflicting semantics by any Working
|
||||
Group, specification, or document instance.
|
||||
</p>
|
||||
<p>
|
||||
See further below in this document for more information about <a href="#usage">how to refer to this schema document from your own
|
||||
XSD schema documents</a> and about <a href="#nsversioning">the
|
||||
namespace-versioning policy governing this schema document</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:attribute name="lang">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div>
|
||||
<h3>lang (as an attribute name)</h3>
|
||||
<p>
|
||||
denotes an attribute whose value
|
||||
is a language code for the natural language of the content of
|
||||
any element; its value is inherited. This name is reserved
|
||||
by virtue of its definition in the XML specification.</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Notes</h4>
|
||||
<p>
|
||||
Attempting to install the relevant ISO 2- and 3-letter
|
||||
codes as the enumerated possible values is probably never
|
||||
going to be a realistic possibility.
|
||||
</p>
|
||||
<p>
|
||||
See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
|
||||
http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
|
||||
and the IANA language subtag registry at
|
||||
<a href="http://www.iana.org/assignments/language-subtag-registry">
|
||||
http://www.iana.org/assignments/language-subtag-registry</a>
|
||||
for further information.
|
||||
</p>
|
||||
<p>
|
||||
The union allows for the 'un-declaration' of xml:lang with
|
||||
the empty string.
|
||||
</p>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:union memberTypes="xs:language">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value=""/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:union>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="space">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div>
|
||||
<h3>space (as an attribute name)</h3>
|
||||
<p>
|
||||
denotes an attribute whose
|
||||
value is a keyword indicating what whitespace processing
|
||||
discipline is intended for the content of the element; its
|
||||
value is inherited. This name is reserved by virtue of its
|
||||
definition in the XML specification.</p>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:NCName">
|
||||
<xs:enumeration value="default"/>
|
||||
<xs:enumeration value="preserve"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="base" type="xs:anyURI">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div>
|
||||
<h3>base (as an attribute name)</h3>
|
||||
<p>
|
||||
denotes an attribute whose value
|
||||
provides a URI to be used as the base for interpreting any
|
||||
relative URIs in the scope of the element on which it
|
||||
appears; its value is inherited. This name is reserved
|
||||
by virtue of its definition in the XML Base specification.</p>
|
||||
<p>
|
||||
See <a href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
|
||||
for information about this attribute.
|
||||
</p>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="id" type="xs:ID">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div>
|
||||
<h3>id (as an attribute name)</h3>
|
||||
<p>
|
||||
denotes an attribute whose value
|
||||
should be interpreted as if declared to be of type ID.
|
||||
This name is reserved by virtue of its definition in the
|
||||
xml:id specification.</p>
|
||||
<p>
|
||||
See <a href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
|
||||
for information about this attribute.
|
||||
</p>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attributeGroup name="specialAttrs">
|
||||
<xs:attribute ref="xml:base"/>
|
||||
<xs:attribute ref="xml:lang"/>
|
||||
<xs:attribute ref="xml:space"/>
|
||||
<xs:attribute ref="xml:id"/>
|
||||
</xs:attributeGroup>
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div>
|
||||
<h3>Father (in any context at all)</h3>
|
||||
<div class="bodytext">
|
||||
<p>
|
||||
denotes Jon Bosak, the chair of
|
||||
the original XML Working Group. This name is reserved by
|
||||
the following decision of the W3C XML Plenary and
|
||||
XML Coordination groups:
|
||||
</p>
|
||||
<blockquote>
|
||||
<p>
|
||||
In appreciation for his vision, leadership and
|
||||
dedication the W3C XML Plenary on this 10th day of
|
||||
February, 2000, reserves for Jon Bosak in perpetuity
|
||||
the XML name "xml:Father".
|
||||
</p>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div xml:id="usage" id="usage">
|
||||
<h2>
|
||||
<a name="usage">About this schema document</a>
|
||||
</h2>
|
||||
<div class="bodytext">
|
||||
<p>
|
||||
This schema defines attributes and an attribute group suitable
|
||||
for use by schemas wishing to allow <code>xml:base</code>,
|
||||
<code>xml:lang</code>, <code>xml:space</code> or
|
||||
<code>xml:id</code> attributes on elements they define.
|
||||
</p>
|
||||
<p>
|
||||
To enable this, such a schema must import this schema for
|
||||
the XML namespace, e.g. as follows:
|
||||
</p>
|
||||
<pre>
|
||||
<schema . . .>
|
||||
. . .
|
||||
<import namespace="http://www.w3.org/XML/1998/namespace"
|
||||
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
|
||||
</pre>
|
||||
<p>
|
||||
or
|
||||
</p>
|
||||
<pre>
|
||||
<import namespace="http://www.w3.org/XML/1998/namespace"
|
||||
schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
|
||||
</pre>
|
||||
<p>
|
||||
Subsequently, qualified reference to any of the attributes or the
|
||||
group defined below will have the desired effect, e.g.
|
||||
</p>
|
||||
<pre>
|
||||
<type . . .>
|
||||
. . .
|
||||
<attributeGroup ref="xml:specialAttrs"/>
|
||||
</pre>
|
||||
<p>
|
||||
will define a type which will schema-validate an instance element
|
||||
with any of those attributes.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<div id="nsversioning" xml:id="nsversioning">
|
||||
<h2>
|
||||
<a name="nsversioning">Versioning policy for this schema document</a>
|
||||
</h2>
|
||||
<div class="bodytext">
|
||||
<p>
|
||||
In keeping with the XML Schema WG's standard versioning
|
||||
policy, this schema document will persist at
|
||||
<a href="http://www.w3.org/2009/01/xml.xsd">
|
||||
http://www.w3.org/2009/01/xml.xsd</a>.
|
||||
</p>
|
||||
<p>
|
||||
At the date of issue it can also be found at
|
||||
<a href="http://www.w3.org/2001/xml.xsd">
|
||||
http://www.w3.org/2001/xml.xsd</a>.
|
||||
</p>
|
||||
<p>
|
||||
The schema document at that URI may however change in the future,
|
||||
in order to remain compatible with the latest version of XML
|
||||
Schema itself, or with the XML namespace itself. In other words,
|
||||
if the XML Schema or XML namespaces change, the version of this
|
||||
document at <a href="http://www.w3.org/2001/xml.xsd">
|
||||
http://www.w3.org/2001/xml.xsd
|
||||
</a>
|
||||
will change accordingly; the version at
|
||||
<a href="http://www.w3.org/2009/01/xml.xsd">
|
||||
http://www.w3.org/2009/01/xml.xsd
|
||||
</a>
|
||||
will not change.
|
||||
</p>
|
||||
<p>
|
||||
Previous dated (and unchanging) versions of this schema
|
||||
document are at:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://www.w3.org/2009/01/xml.xsd">
|
||||
http://www.w3.org/2009/01/xml.xsd</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.w3.org/2007/08/xml.xsd">
|
||||
http://www.w3.org/2007/08/xml.xsd</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.w3.org/2004/10/xml.xsd">
|
||||
http://www.w3.org/2004/10/xml.xsd</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.w3.org/2001/03/xml.xsd">
|
||||
http://www.w3.org/2001/03/xml.xsd</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:schema>
|
|
@ -0,0 +1,254 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Schema for XML Signatures
|
||||
http://www.w3.org/2000/09/xmldsig#
|
||||
$Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
|
||||
|
||||
Copyright 2001 The Internet Society and W3C (Massachusetts Institute
|
||||
of Technology, Institut National de Recherche en Informatique et en
|
||||
Automatique, Keio University). All Rights Reserved.
|
||||
http://www.w3.org/Consortium/Legal/
|
||||
|
||||
This document is governed by the W3C Software License [1] as described
|
||||
in the FAQ [2].
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
|
||||
[2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
|
||||
-->
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.w3.org/2000/09/xmldsig#" elementFormDefault="qualified" version="0.1">
|
||||
<!-- Basic Types Defined for Signatures -->
|
||||
<simpleType name="CryptoBinary">
|
||||
<restriction base="base64Binary"/>
|
||||
</simpleType>
|
||||
<!-- Start Signature -->
|
||||
<element name="Signature" type="ds:SignatureType"/>
|
||||
<complexType name="SignatureType">
|
||||
<sequence>
|
||||
<element ref="ds:SignedInfo"/>
|
||||
<element ref="ds:SignatureValue"/>
|
||||
<element ref="ds:KeyInfo" minOccurs="0"/>
|
||||
<element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</complexType>
|
||||
<element name="SignatureValue" type="ds:SignatureValueType"/>
|
||||
<complexType name="SignatureValueType">
|
||||
<simpleContent>
|
||||
<extension base="base64Binary">
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
<!-- Start SignedInfo -->
|
||||
<element name="SignedInfo" type="ds:SignedInfoType"/>
|
||||
<complexType name="SignedInfoType">
|
||||
<sequence>
|
||||
<element ref="ds:CanonicalizationMethod"/>
|
||||
<element ref="ds:SignatureMethod"/>
|
||||
<element ref="ds:Reference" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</complexType>
|
||||
<element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
|
||||
<complexType name="CanonicalizationMethodType" mixed="true">
|
||||
<sequence>
|
||||
<any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- (0,unbounded) elements from (1,1) namespace -->
|
||||
</sequence>
|
||||
<attribute name="Algorithm" type="anyURI" use="required"/>
|
||||
</complexType>
|
||||
<element name="SignatureMethod" type="ds:SignatureMethodType"/>
|
||||
<complexType name="SignatureMethodType" mixed="true">
|
||||
<sequence>
|
||||
<element name="HMACOutputLength" type="ds:HMACOutputLengthType" minOccurs="0"/>
|
||||
<any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- (0,unbounded) elements from (1,1) external namespace -->
|
||||
</sequence>
|
||||
<attribute name="Algorithm" type="anyURI" use="required"/>
|
||||
</complexType>
|
||||
<!-- Start Reference -->
|
||||
<element name="Reference" type="ds:ReferenceType"/>
|
||||
<complexType name="ReferenceType">
|
||||
<sequence>
|
||||
<element ref="ds:Transforms" minOccurs="0"/>
|
||||
<element ref="ds:DigestMethod"/>
|
||||
<element ref="ds:DigestValue"/>
|
||||
</sequence>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
<attribute name="URI" type="anyURI" use="optional"/>
|
||||
<attribute name="Type" type="anyURI" use="optional"/>
|
||||
</complexType>
|
||||
<element name="Transforms" type="ds:TransformsType"/>
|
||||
<complexType name="TransformsType">
|
||||
<sequence>
|
||||
<element ref="ds:Transform" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<element name="Transform" type="ds:TransformType"/>
|
||||
<complexType name="TransformType" mixed="true">
|
||||
<choice minOccurs="0" maxOccurs="unbounded">
|
||||
<any namespace="##other" processContents="lax"/>
|
||||
<!-- (1,1) elements from (0,unbounded) namespaces -->
|
||||
<element name="XPath" type="string"/>
|
||||
</choice>
|
||||
<attribute name="Algorithm" type="anyURI" use="required"/>
|
||||
</complexType>
|
||||
<!-- End Reference -->
|
||||
<element name="DigestMethod" type="ds:DigestMethodType"/>
|
||||
<complexType name="DigestMethodType" mixed="true">
|
||||
<sequence>
|
||||
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="Algorithm" type="anyURI" use="required"/>
|
||||
</complexType>
|
||||
<element name="DigestValue" type="ds:DigestValueType"/>
|
||||
<simpleType name="DigestValueType">
|
||||
<restriction base="base64Binary"/>
|
||||
</simpleType>
|
||||
<!-- End SignedInfo -->
|
||||
<!-- Start KeyInfo -->
|
||||
<element name="KeyInfo" type="ds:KeyInfoType"/>
|
||||
<complexType name="KeyInfoType" mixed="true">
|
||||
<choice maxOccurs="unbounded">
|
||||
<element ref="ds:KeyName"/>
|
||||
<element ref="ds:KeyValue"/>
|
||||
<element ref="ds:RetrievalMethod"/>
|
||||
<element ref="ds:X509Data"/>
|
||||
<element ref="ds:PGPData"/>
|
||||
<element ref="ds:SPKIData"/>
|
||||
<element ref="ds:MgmtData"/>
|
||||
<any namespace="##other" processContents="lax"/>
|
||||
<!-- (1,1) elements from (0,unbounded) namespaces -->
|
||||
</choice>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</complexType>
|
||||
<element name="KeyName" type="string"/>
|
||||
<element name="MgmtData" type="string"/>
|
||||
<element name="KeyValue" type="ds:KeyValueType"/>
|
||||
<complexType name="KeyValueType" mixed="true">
|
||||
<choice>
|
||||
<element ref="ds:DSAKeyValue"/>
|
||||
<element ref="ds:RSAKeyValue"/>
|
||||
<any namespace="##other" processContents="lax"/>
|
||||
</choice>
|
||||
</complexType>
|
||||
<element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
|
||||
<complexType name="RetrievalMethodType">
|
||||
<sequence>
|
||||
<element ref="ds:Transforms" minOccurs="0"/>
|
||||
</sequence>
|
||||
<attribute name="URI" type="anyURI"/>
|
||||
<attribute name="Type" type="anyURI" use="optional"/>
|
||||
</complexType>
|
||||
<!-- Start X509Data -->
|
||||
<element name="X509Data" type="ds:X509DataType"/>
|
||||
<complexType name="X509DataType">
|
||||
<sequence maxOccurs="unbounded">
|
||||
<choice>
|
||||
<element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
|
||||
<element name="X509SKI" type="base64Binary"/>
|
||||
<element name="X509SubjectName" type="string"/>
|
||||
<element name="X509Certificate" type="base64Binary"/>
|
||||
<element name="X509CRL" type="base64Binary"/>
|
||||
<any namespace="##other" processContents="lax"/>
|
||||
</choice>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<complexType name="X509IssuerSerialType">
|
||||
<sequence>
|
||||
<element name="X509IssuerName" type="string"/>
|
||||
<element name="X509SerialNumber" type="integer"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<!-- End X509Data -->
|
||||
<!-- Begin PGPData -->
|
||||
<element name="PGPData" type="ds:PGPDataType"/>
|
||||
<complexType name="PGPDataType">
|
||||
<choice>
|
||||
<sequence>
|
||||
<element name="PGPKeyID" type="base64Binary"/>
|
||||
<element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
|
||||
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<sequence>
|
||||
<element name="PGPKeyPacket" type="base64Binary"/>
|
||||
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</choice>
|
||||
</complexType>
|
||||
<!-- End PGPData -->
|
||||
<!-- Begin SPKIData -->
|
||||
<element name="SPKIData" type="ds:SPKIDataType"/>
|
||||
<complexType name="SPKIDataType">
|
||||
<sequence maxOccurs="unbounded">
|
||||
<element name="SPKISexp" type="base64Binary"/>
|
||||
<any namespace="##other" processContents="lax" minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<!-- End SPKIData -->
|
||||
<!-- End KeyInfo -->
|
||||
<!-- Start Object (Manifest, SignatureProperty) -->
|
||||
<element name="Object" type="ds:ObjectType"/>
|
||||
<complexType name="ObjectType" mixed="true">
|
||||
<sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<any namespace="##any" processContents="lax"/>
|
||||
</sequence>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
<attribute name="MimeType" type="string" use="optional"/>
|
||||
<attribute name="Encoding" type="anyURI" use="optional"/>
|
||||
<!-- add a grep facet -->
|
||||
</complexType>
|
||||
<element name="Manifest" type="ds:ManifestType"/>
|
||||
<complexType name="ManifestType">
|
||||
<sequence>
|
||||
<element ref="ds:Reference" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</complexType>
|
||||
<element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
|
||||
<complexType name="SignaturePropertiesType">
|
||||
<sequence>
|
||||
<element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</complexType>
|
||||
<element name="SignatureProperty" type="ds:SignaturePropertyType"/>
|
||||
<complexType name="SignaturePropertyType" mixed="true">
|
||||
<choice maxOccurs="unbounded">
|
||||
<any namespace="##other" processContents="lax"/>
|
||||
<!-- (1,1) elements from (1,unbounded) namespaces -->
|
||||
</choice>
|
||||
<attribute name="Target" type="anyURI" use="required"/>
|
||||
<attribute name="Id" type="ID" use="optional"/>
|
||||
</complexType>
|
||||
<!-- End Object (Manifest, SignatureProperty) -->
|
||||
<!-- Start Algorithm Parameters -->
|
||||
<simpleType name="HMACOutputLengthType">
|
||||
<restriction base="integer"/>
|
||||
</simpleType>
|
||||
<!-- Start KeyValue Element-types -->
|
||||
<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
|
||||
<complexType name="DSAKeyValueType">
|
||||
<sequence>
|
||||
<sequence minOccurs="0">
|
||||
<element name="P" type="ds:CryptoBinary"/>
|
||||
<element name="Q" type="ds:CryptoBinary"/>
|
||||
</sequence>
|
||||
<element name="G" type="ds:CryptoBinary" minOccurs="0"/>
|
||||
<element name="Y" type="ds:CryptoBinary"/>
|
||||
<element name="J" type="ds:CryptoBinary" minOccurs="0"/>
|
||||
<sequence minOccurs="0">
|
||||
<element name="Seed" type="ds:CryptoBinary"/>
|
||||
<element name="PgenCounter" type="ds:CryptoBinary"/>
|
||||
</sequence>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
|
||||
<complexType name="RSAKeyValueType">
|
||||
<sequence>
|
||||
<element name="Modulus" type="ds:CryptoBinary"/>
|
||||
<element name="Exponent" type="ds:CryptoBinary"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<!-- End KeyValue Element-types -->
|
||||
<!-- End Signature -->
|
||||
</schema>
|
|
@ -62,6 +62,7 @@
|
|||
<item name="Extensions" href="./doc_extensions.html" />
|
||||
<item name="Resource References" href="./doc_resource_references.html" />
|
||||
<item name="Tags" href="./doc_tags.html" />
|
||||
<item name="Validation" href="./doc_validation.html" />
|
||||
</item>
|
||||
<item name="RESTful Client" href="./doc_rest_client.html" />
|
||||
<item name="RESTful Server" href="./doc_rest_server.html" >
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||
|
||||
<properties>
|
||||
<title>Validation - HAPI FHIR</title>
|
||||
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- The body of the document contains a number of sections -->
|
||||
<section name="Resource Validation">
|
||||
|
||||
<macro name="toc">
|
||||
</macro>
|
||||
|
||||
<p>
|
||||
HAPI provides a built-in and configurable mechanism for validating resources.
|
||||
This mechanism is called the <i>Resource Validator</i>.
|
||||
</p>
|
||||
|
||||
<subsection name="Background">
|
||||
|
||||
<p>
|
||||
FHIR resource definitions are distributed with a set of XML schema files (XDS)
|
||||
as well as a set of XML Schematron (SCH) files. These two sets of files are
|
||||
complimentary to each other, meaning that in order to claim compliance to the
|
||||
FHIR specification, your resources must validate against both sets.
|
||||
</p>
|
||||
<p>
|
||||
The two sets of files are included with HAPI, and it uses them to perform
|
||||
validation.
|
||||
</p>
|
||||
|
||||
</subsection>
|
||||
|
||||
<subsection name="Preparation">
|
||||
|
||||
<p>
|
||||
In order to use HAPI's Schematron support, a libaray called
|
||||
<a href="https://code.google.com/p/phloc-schematron/">Phloc-Schematron</a>
|
||||
is used, so this library must be added to your classpath (or Maven pom file).
|
||||
See <a href="./download.html">Downloads</a> for more information.
|
||||
</p>
|
||||
|
||||
</subsection>
|
||||
|
||||
<subsection name="Validating a Resource">
|
||||
|
||||
<p>
|
||||
To validate a resource instance, a new validator instance is requested
|
||||
from the FHIR Context. This validator is then applied against
|
||||
a specific resource instance, as shown in the example below.
|
||||
</p>
|
||||
<macro name="snippet">
|
||||
<param name="id" value="basicValidation" />
|
||||
<param name="file" value="examples/src/main/java/example/ValidatorExamples.java" />
|
||||
</macro>
|
||||
|
||||
</subsection>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
|
||||
</document>
|
|
@ -21,10 +21,13 @@ public class ModelScannerTest {
|
|||
public void testExtendedClass() {
|
||||
FhirContext ctx = new FhirContext();
|
||||
ctx.getResourceDefinition(MyPatient.class);
|
||||
ctx.getResourceDefinition(Patient.class);
|
||||
|
||||
RuntimeResourceDefinition patient = ctx.getResourceDefinition("Patient");
|
||||
assertEquals(Patient.class, patient.getImplementingClass());
|
||||
|
||||
RuntimeResourceDefinition def = ctx.getResourceDefinition(MyPatient.class);
|
||||
RuntimeResourceDefinition baseDef = def.getBaseDefinition();
|
||||
assertEquals(Patient.class,baseDef.getImplementingClass());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu.valueset.ContactSystemEnum;
|
||||
|
||||
public class ResourceValidatorTest {
|
||||
|
||||
private static FhirContext ourCtx = new FhirContext();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceValidatorTest.class);
|
||||
|
||||
@Test
|
||||
public void testSchemaValidator() throws IOException {
|
||||
String res = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("patient-example-dicom.xml"));
|
||||
Patient p = ourCtx.newXmlParser().parseResource(Patient.class, res);
|
||||
|
||||
ResourceValidator val = ourCtx.newValidator();
|
||||
val.setValidateBaseSchema(true);
|
||||
val.setValidateBaseSchematron(false);
|
||||
|
||||
val.validate(p);
|
||||
|
||||
p.getAnimal().getBreed().setText("The Breed");
|
||||
try {
|
||||
val.validate(p);
|
||||
fail();
|
||||
} catch (ValidationFailureException e) {
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
|
||||
assertEquals(1, e.getOperationOutcome().getIssue().size());
|
||||
assertThat(e.getOperationOutcome().getIssueFirstRep().getDetails().getValue(), containsString("Invalid content was found starting with element 'breed'"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSchematronValidator() throws IOException {
|
||||
// System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl ");
|
||||
// System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
|
||||
|
||||
String res = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("patient-example-dicom.xml"));
|
||||
Patient p = ourCtx.newXmlParser().parseResource(Patient.class, res);
|
||||
|
||||
ResourceValidator val = ourCtx.newValidator();
|
||||
val.setValidateBaseSchema(false);
|
||||
val.setValidateBaseSchematron(true);
|
||||
|
||||
val.validate(p);
|
||||
|
||||
p.getTelecomFirstRep().setValue("123-4567");
|
||||
try {
|
||||
val.validate(p);
|
||||
fail();
|
||||
} catch (ValidationFailureException e) {
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
|
||||
assertEquals(1, e.getOperationOutcome().getIssue().size());
|
||||
assertThat(e.getOperationOutcome().getIssueFirstRep().getDetails().getValue(), containsString("Inv-2: A system is required if a value is provided."));
|
||||
}
|
||||
|
||||
p.getTelecomFirstRep().setSystem(ContactSystemEnum.EMAIL);
|
||||
val.validate(p);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,7 +12,7 @@
|
|||
<dependent-module archiveName="hapi-fhir-base-0.6-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.6-SNAPSHOT/hapi-fhir-testpage-overlay-0.6-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
<dependency-type>consumes</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -83,6 +83,7 @@
|
|||
<maven_site_plugin_version>3.4</maven_site_plugin_version>
|
||||
<mitreid-connect-version>1.1.8</mitreid-connect-version>
|
||||
<mockito_version>1.9.5</mockito_version>
|
||||
<phloc_schematron_version>2.7.1</phloc_schematron_version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<slf4j_version>1.7.7</slf4j_version>
|
||||
<spring_version>4.0.1.RELEASE</spring_version>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<dependent-module archiveName="hapi-fhir-base-0.6-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.6-SNAPSHOT/hapi-fhir-testpage-overlay-0.6-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
<dependency-type>consumes</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
|
|
Loading…
Reference in New Issue