Syn RI - Build still failing :(

This commit is contained in:
James Agnew 2016-05-28 12:53:59 -04:00
parent eae96983e8
commit eb3b656a5f
209 changed files with 718315 additions and 104073 deletions

View File

@ -39,6 +39,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ThreadFactory;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
@ -356,7 +357,29 @@ class ModelScanner {
} while (current != null); } while (current != null);
for (Class<? extends IBase> next : classes) { for (Class<? extends IBase> next : classes) {
scanCompositeElementForChildren(next, elementNames, orderToElementDef, orderToExtensionDef, forcedOrder); scanCompositeElementForChildren(next, elementNames, orderToElementDef, orderToExtensionDef);
}
if (forcedOrder != null) {
/*
* Find out how many elements don't match any entry in the list
* for forced order. Those elements come first.
*/
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> newOrderToExtensionDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>();
int unknownCount = 0;
for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) {
if (!forcedOrder.containsKey(nextEntry.getElementName())) {
newOrderToExtensionDef.put(unknownCount, nextEntry);
unknownCount++;
}
}
for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) {
if (forcedOrder.containsKey(nextEntry.getElementName())) {
Integer newOrder = forcedOrder.get(nextEntry.getElementName());
newOrderToExtensionDef.put(newOrder + unknownCount, nextEntry);
}
}
orderToElementDef = newOrderToExtensionDef;
} }
// while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < // while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() <
@ -390,7 +413,7 @@ class ModelScanner {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void scanCompositeElementForChildren(Class<? extends IBase> theClass, Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef, private void scanCompositeElementForChildren(Class<? extends IBase> theClass, Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef,
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef, Map<String, Integer> theForcedOrder) { TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) {
int baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1; int baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1;
for (Field next : theClass.getDeclaredFields()) { for (Field next : theClass.getDeclaredFields()) {
@ -466,16 +489,12 @@ class ModelScanner {
} }
if (theForcedOrder != null) {
order = theForcedOrder.get(elementName);
} else {
if (order < 0 && order != Child.ORDER_UNKNOWN) { if (order < 0 && order != Child.ORDER_UNKNOWN) {
throw new ConfigurationException("Invalid order '" + order + "' on @Child for field '" + next.getName() + "' on target type: " + theClass); throw new ConfigurationException("Invalid order '" + order + "' on @Child for field '" + next.getName() + "' on target type: " + theClass);
} }
if (order != Child.ORDER_UNKNOWN) { if (order != Child.ORDER_UNKNOWN) {
order = order + baseElementOrder; order = order + baseElementOrder;
} }
}
// int min = childAnnotation.min(); // int min = childAnnotation.min();
// int max = childAnnotation.max(); // int max = childAnnotation.max();
@ -495,7 +514,7 @@ class ModelScanner {
} }
if (orderMap.containsKey(order)) { if (orderMap.containsKey(order)) {
throw new ConfigurationException("Detected duplicate field order '" + childAnnotation.order() + "' for element named '" + elementName + "' in type '" + theClass.getCanonicalName() + "'"); throw new ConfigurationException("Detected duplicate field order '" + childAnnotation.order() + "' for element named '" + elementName + "' in type '" + theClass.getCanonicalName() + "' - Already had: " + orderMap.get(order).getElementName());
} }
if (elementNames.contains(elementName)) { if (elementNames.contains(elementName)) {

View File

@ -673,32 +673,35 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless(); IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless();
//@formatter:on //@formatter:on
// Was Observation.SP_COMPONENT_CODE_VALUE_QUANTITY
String param = Observation.SP_CODE_VALUE_QUANTITY;
{ {
TokenParam v0 = new TokenParam("http://foo", "code1"); TokenParam v0 = new TokenParam("http://foo", "code1");
QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 150, "http://bar", "code1"); QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 150, "http://bar", "code1");
CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1); CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1);
IBundleProvider result = myObservationDao.search(Observation.SP_COMPONENT_CODE_VALUE_QUANTITY, val); IBundleProvider result = myObservationDao.search(param, val);
assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id2.getValue())); assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id2.getValue()));
} }
{ {
TokenParam v0 = new TokenParam("http://foo", "code1"); TokenParam v0 = new TokenParam("http://foo", "code1");
QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code1"); QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code1");
CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1); CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1);
IBundleProvider result = myObservationDao.search(Observation.SP_COMPONENT_CODE_VALUE_QUANTITY, val); IBundleProvider result = myObservationDao.search(param, val);
assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue(), id2.getValue())); assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue(), id2.getValue()));
} }
{ {
TokenParam v0 = new TokenParam("http://foo", "code4"); TokenParam v0 = new TokenParam("http://foo", "code4");
QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code1"); QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code1");
CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1); CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1);
IBundleProvider result = myObservationDao.search(Observation.SP_COMPONENT_CODE_VALUE_QUANTITY, val); IBundleProvider result = myObservationDao.search(param, val);
assertThat(toUnqualifiedVersionlessIdValues(result), empty()); assertThat(toUnqualifiedVersionlessIdValues(result), empty());
} }
{ {
TokenParam v0 = new TokenParam("http://foo", "code1"); TokenParam v0 = new TokenParam("http://foo", "code1");
QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code4"); QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code4");
CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1); CompositeParam<TokenParam, QuantityParam> val = new CompositeParam<TokenParam, QuantityParam>(v0, v1);
IBundleProvider result = myObservationDao.search(Observation.SP_COMPONENT_CODE_VALUE_QUANTITY, val); IBundleProvider result = myObservationDao.search(param, val);
assertThat(toUnqualifiedVersionlessIdValues(result), empty()); assertThat(toUnqualifiedVersionlessIdValues(result), empty());
} }
} }

View File

@ -87,8 +87,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Bundle response = mySystemDao.transaction(mySrd, bundle); Bundle response = mySystemDao.transaction(mySrd, bundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response)); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
assertEquals("201 Created", response.getEntryFirstRep().getResponse().getStatus()); assertEquals("201 Created", response.getEntry().get(0).getResponse().getStatus());
assertThat(response.getEntryFirstRep().getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1")); assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
/* /*
* Now a second time * Now a second time
@ -98,8 +98,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
response = mySystemDao.transaction(mySrd, bundle); response = mySystemDao.transaction(mySrd, bundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response)); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
assertEquals("200 OK", response.getEntryFirstRep().getResponse().getStatus()); assertEquals("200 OK", response.getEntry().get(0).getResponse().getStatus());
assertThat(response.getEntryFirstRep().getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1")); assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
} }

View File

@ -35,7 +35,7 @@ public class SearchParamExtractorDstu3Test {
@Test @Test
public void testParamWithOrInPath() { public void testParamWithOrInPath() {
Observation obs = new Observation(); Observation obs = new Observation();
obs.getCategory().addCoding().setSystem("SYSTEM").setCode("CODE"); obs.addCategory().addCoding().setSystem("SYSTEM").setCode("CODE");
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(ourCtx, ourValidationSupport); SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(ourCtx, ourValidationSupport);
Set<BaseResourceIndexedSearchParam> tokens = extractor.extractSearchParamTokens(new ResourceTable(), obs); Set<BaseResourceIndexedSearchParam> tokens = extractor.extractSearchParamTokens(new ResourceTable(), obs);

View File

@ -245,8 +245,8 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals("http://localhost:" + ourPort + "/fhir/context/Patient?_count=5&_pretty=true&name=Jernel%C3%B6v", b.getLink("self").getUrl()); assertEquals("http://localhost:" + ourPort + "/fhir/context/Patient?_count=5&_pretty=true&name=Jernel%C3%B6v", b.getLink("self").getUrl());
Patient p = (Patient) b.getEntryFirstRep().getResource(); Patient p = (Patient) b.getEntry().get(0).getResource();
assertEquals("Jernelöv", p.getNameFirstRep().getFamilyFirstRep().getValue()); assertEquals("Jernelöv", p.getName().get(0).getFamily().get(0).getValue());
} finally { } finally {
IOUtils.closeQuietly(resp.getEntity().getContent()); IOUtils.closeQuietly(resp.getEntity().getContent());

View File

@ -35,4 +35,6 @@ public interface JsonCreator {
void finish() throws IOException; void finish() throws IOException;
// only used by an creator that actually produces xhtml
void link(String href);
} }

View File

@ -223,5 +223,10 @@ public class JsonCreatorCanonical implements JsonCreator {
gson.endArray(); gson.endArray();
} }
@Override
public void link(String href) {
// not used
}
} }

View File

@ -75,4 +75,9 @@ public class JsonCreatorGson implements JsonCreator {
} }
@Override
public void link(String href) {
// not used
}
} }

View File

@ -0,0 +1,212 @@
package org.hl7.fhir.dstu3.formats;
/*
Copyright (c) 2011+, 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.
*/
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.hl7.fhir.dstu3.exceptions.FHIRFormatError;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.model.Type;
import org.hl7.fhir.utilities.Utilities;
public abstract class ParserBase extends FormatUtilities implements IParser {
// -- implementation of variant type methods from the interface --------------------------------
public Resource parse(String input) throws FHIRFormatError, IOException {
return parse(input.getBytes("UTF-8"));
}
public Resource parse(byte[] bytes) throws FHIRFormatError, IOException {
ByteArrayInputStream bi = new ByteArrayInputStream(bytes);
return parse(bi);
}
public Type parseType(String input, String typeName) throws FHIRFormatError, IOException {
return parseType(input.getBytes("UTF-8"), typeName);
}
public Type parseType(byte[] bytes, String typeName) throws FHIRFormatError, IOException {
ByteArrayInputStream bi = new ByteArrayInputStream(bytes);
return parseType(bi, typeName);
}
public String composeString(Resource resource) throws IOException {
return new String(composeBytes(resource));
}
public byte[] composeBytes(Resource resource) throws IOException {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
compose(bytes, resource);
bytes.close();
return bytes.toByteArray();
}
public String composeString(Type type, String typeName) throws IOException {
return new String(composeBytes(type, typeName));
}
public byte[] composeBytes(Type type, String typeName) throws IOException {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
compose(bytes, type, typeName);
bytes.close();
return bytes.toByteArray();
}
// -- Parser Configuration --------------------------------
protected String xhtmlMessage;
@Override
public IParser setSuppressXhtml(String message) {
xhtmlMessage = message;
return this;
}
protected boolean handleComments = false;
public boolean getHandleComments() {
return handleComments;
}
public IParser setHandleComments(boolean value) {
this.handleComments = value;
return this;
}
/**
* Whether to throw an exception if unknown content is found (or just skip it)
*/
protected boolean allowUnknownContent;
/**
* @return Whether to throw an exception if unknown content is found (or just skip it)
*/
public boolean isAllowUnknownContent() {
return allowUnknownContent;
}
/**
* @param allowUnknownContent Whether to throw an exception if unknown content is found (or just skip it)
*/
public IParser setAllowUnknownContent(boolean allowUnknownContent) {
this.allowUnknownContent = allowUnknownContent;
return this;
}
protected OutputStyle style = OutputStyle.NORMAL;
public OutputStyle getOutputStyle() {
return style;
}
public IParser setOutputStyle(OutputStyle style) {
this.style = style;
return this;
}
// -- Parser Utilities --------------------------------
protected Map<String, Object> idMap = new HashMap<String, Object>();
protected int parseIntegerPrimitive(String value) {
if (value.startsWith("+") && Utilities.isInteger(value.substring(1)))
value = value.substring(1);
return java.lang.Integer.parseInt(value);
}
protected int parseIntegerPrimitive(java.lang.Long value) {
if (value < java.lang.Integer.MIN_VALUE || value > java.lang.Integer.MAX_VALUE) {
throw new IllegalArgumentException
(value + " cannot be cast to int without changing its value.");
}
return value.intValue();
}
protected String parseCodePrimitive(String value) {
return value;
}
protected String parseTimePrimitive(String value) throws ParseException {
return value;
}
protected BigDecimal parseDecimalPrimitive(BigDecimal value) {
return value;
}
protected BigDecimal parseDecimalPrimitive(String value) {
return new BigDecimal(value);
}
protected String parseUriPrimitive(String value) {
return value;
}
protected byte[] parseBase64BinaryPrimitive(String value) {
return Base64.decodeBase64(value.getBytes());
}
protected String parseOidPrimitive(String value) {
return value;
}
protected Boolean parseBooleanPrimitive(String value) {
return java.lang.Boolean.valueOf(value);
}
protected Boolean parseBooleanPrimitive(Boolean value) {
return java.lang.Boolean.valueOf(value);
}
protected String parseIdPrimitive(String value) {
return value;
}
protected String parseStringPrimitive(String value) {
return value;
}
protected String parseUuidPrimitive(String value) {
return value;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,389 @@
package org.hl7.fhir.dstu3.formats;
/*
Copyright (c) 2011+, 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.
*/
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.dstu3.exceptions.FHIRFormatError;
import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.DomainResource;
import org.hl7.fhir.dstu3.model.Element;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.Type;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.NodeType;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
import org.hl7.fhir.utilities.xml.IXMLWriter;
import org.hl7.fhir.utilities.xml.XMLWriter;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* General parser for XML content. You instantiate an XmlParser of these, but you
* actually use parse or parseGeneral defined on this class
*
* The two classes are separated to keep generated and manually maintained code apart.
*/
public abstract class XmlParserBase extends ParserBase implements IParser {
@Override
public ParserType getType() {
return ParserType.XML;
}
// -- in descendent generated code --------------------------------------
abstract protected Resource parseResource(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError ;
abstract protected Type parseType(XmlPullParser xml, String type) throws XmlPullParserException, IOException, FHIRFormatError ;
abstract protected void composeType(String prefix, Type type) throws IOException ;
/* -- entry points --------------------------------------------------- */
/**
* Parse content that is known to be a resource
* @
*/
@Override
public Resource parse(InputStream input) throws IOException, FHIRFormatError {
try {
XmlPullParser xpp = loadXml(input);
return parse(xpp);
} catch (XmlPullParserException e) {
throw new FHIRFormatError(e.getMessage(), e);
}
}
/**
* parse xml that is known to be a resource, and that is already being read by an XML Pull Parser
* This is if a resource is in a bigger piece of XML.
* @
*/
public Resource parse(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException {
if (xpp.getNamespace() == null)
throw new FHIRFormatError("This does not appear to be a FHIR resource (no namespace '"+xpp.getNamespace()+"') (@ /) "+Integer.toString(xpp.getEventType()));
if (!xpp.getNamespace().equals(FHIR_NS))
throw new FHIRFormatError("This does not appear to be a FHIR resource (wrong namespace '"+xpp.getNamespace()+"') (@ /)");
return parseResource(xpp);
}
@Override
public Type parseType(InputStream input, String knownType) throws IOException, FHIRFormatError {
try {
XmlPullParser xml = loadXml(input);
return parseType(xml, knownType);
} catch (XmlPullParserException e) {
throw new FHIRFormatError(e.getMessage(), e);
}
}
/**
* Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
* @
*/
@Override
public void compose(OutputStream stream, Resource resource) throws IOException {
XMLWriter writer = new XMLWriter(stream, "UTF-8");
writer.setPretty(style == OutputStyle.PRETTY);
writer.start();
compose(writer, resource, writer.isPretty());
writer.end();
}
/**
* Compose a resource to a stream, possibly using pretty presentation for a human reader, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production)
* @
*/
public void compose(OutputStream stream, Resource resource, boolean htmlPretty) throws IOException {
XMLWriter writer = new XMLWriter(stream, "UTF-8");
writer.setPretty(style == OutputStyle.PRETTY);
writer.start();
compose(writer, resource, htmlPretty);
writer.end();
}
/**
* Compose a type to a stream (used in the spec, for example, but not normally in production)
* @
*/
public void compose(OutputStream stream, String rootName, Type type) throws IOException {
xml = new XMLWriter(stream, "UTF-8");
xml.setPretty(style == OutputStyle.PRETTY);
xml.start();
xml.setDefaultNamespace(FHIR_NS);
composeType(Utilities.noString(rootName) ? "value" : rootName, type);
xml.end();
}
@Override
public void compose(OutputStream stream, Type type, String rootName) throws IOException {
xml = new XMLWriter(stream, "UTF-8");
xml.setPretty(style == OutputStyle.PRETTY);
xml.start();
xml.setDefaultNamespace(FHIR_NS);
composeType(Utilities.noString(rootName) ? "value" : rootName, type);
xml.end();
}
/* -- xml routines --------------------------------------------------- */
protected XmlPullParser loadXml(String source) throws UnsupportedEncodingException, XmlPullParserException, IOException {
return loadXml(new ByteArrayInputStream(source.getBytes("UTF-8")));
}
protected XmlPullParser loadXml(InputStream stream) throws XmlPullParserException, IOException {
BufferedInputStream input = new BufferedInputStream(stream);
// XmlPullParserFactory factory = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
// factory.setNamespaceAware(true);
// factory.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, false);
// XmlPullParser xpp = factory.newPullParser();
// xpp.setInput(input, "UTF-8");
// next(xpp);
// nextNoWhitespace(xpp);
//
// return xpp;
throw new UnsupportedOperationException();
}
protected int next(XmlPullParser xpp) throws XmlPullParserException, IOException {
if (handleComments)
return xpp.nextToken();
else
return xpp.next();
}
protected List<String> comments = new ArrayList<String>();
protected int nextNoWhitespace(XmlPullParser xpp) throws XmlPullParserException, IOException {
int eventType = xpp.getEventType();
while ((eventType == XmlPullParser.TEXT && xpp.isWhitespace()) || (eventType == XmlPullParser.COMMENT)
|| (eventType == XmlPullParser.CDSECT) || (eventType == XmlPullParser.IGNORABLE_WHITESPACE)
|| (eventType == XmlPullParser.PROCESSING_INSTRUCTION) || (eventType == XmlPullParser.DOCDECL)) {
if (eventType == XmlPullParser.COMMENT) {
comments.add(xpp.getText());
} else if (eventType == XmlPullParser.DOCDECL) {
throw new XmlPullParserException("DTD declarations are not allowed");
}
eventType = next(xpp);
}
return eventType;
}
protected void skipElementWithContent(XmlPullParser xpp) throws XmlPullParserException, IOException {
// when this is called, we are pointing an element that may have content
while (xpp.getEventType() != XmlPullParser.END_TAG) {
next(xpp);
if (xpp.getEventType() == XmlPullParser.START_TAG)
skipElementWithContent(xpp);
}
next(xpp);
}
protected void skipEmptyElement(XmlPullParser xpp) throws XmlPullParserException, IOException {
while (xpp.getEventType() != XmlPullParser.END_TAG)
next(xpp);
next(xpp);
}
protected IXMLWriter xml;
protected boolean htmlPretty;
/* -- worker routines --------------------------------------------------- */
protected void parseTypeAttributes(XmlPullParser xpp, Type t) {
parseElementAttributes(xpp, t);
}
protected void parseElementAttributes(XmlPullParser xpp, Element e) {
if (xpp.getAttributeValue(null, "id") != null) {
e.setId(xpp.getAttributeValue(null, "id"));
idMap.put(e.getId(), e);
}
if (!comments.isEmpty()) {
e.getFormatCommentsPre().addAll(comments);
comments.clear();
}
}
protected void parseElementClose(Base e) {
if (!comments.isEmpty()) {
e.getFormatCommentsPost().addAll(comments);
comments.clear();
}
}
protected void parseBackboneAttributes(XmlPullParser xpp, Element e) {
parseElementAttributes(xpp, e);
}
private String pathForLocation(XmlPullParser xpp) {
return xpp.getPositionDescription();
}
protected void unknownContent(XmlPullParser xpp) throws FHIRFormatError {
if (!isAllowUnknownContent())
throw new FHIRFormatError("Unknown Content "+xpp.getName()+" @ "+pathForLocation(xpp));
}
protected XhtmlNode parseXhtml(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
XhtmlParser prsr = new XhtmlParser();
try {
return prsr.parseHtmlNode(xpp);
} catch (org.hl7.fhir.exceptions.FHIRFormatError e) {
throw new FHIRFormatError(e.getMessage(), e);
}
}
private String parseString(XmlPullParser xpp) throws XmlPullParserException, FHIRFormatError, IOException {
StringBuilder res = new StringBuilder();
next(xpp);
while (xpp.getEventType() == XmlPullParser.TEXT || xpp.getEventType() == XmlPullParser.IGNORABLE_WHITESPACE || xpp.getEventType() == XmlPullParser.ENTITY_REF) {
res.append(xpp.getText());
next(xpp);
}
if (xpp.getEventType() != XmlPullParser.END_TAG)
throw new FHIRFormatError("Bad String Structure - parsed "+res.toString()+" now found "+Integer.toString(xpp.getEventType()));
next(xpp);
return res.length() == 0 ? null : res.toString();
}
private int parseInt(XmlPullParser xpp) throws FHIRFormatError, XmlPullParserException, IOException {
int res = -1;
String textNode = parseString(xpp);
res = java.lang.Integer.parseInt(textNode);
return res;
}
protected DomainResource parseDomainResourceContained(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException {
next(xpp);
int eventType = nextNoWhitespace(xpp);
if (eventType == XmlPullParser.START_TAG) {
DomainResource dr = (DomainResource) parseResource(xpp);
nextNoWhitespace(xpp);
next(xpp);
return dr;
} else {
unknownContent(xpp);
return null;
}
}
protected Resource parseResourceContained(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException {
next(xpp);
int eventType = nextNoWhitespace(xpp);
if (eventType == XmlPullParser.START_TAG) {
Resource r = (Resource) parseResource(xpp);
nextNoWhitespace(xpp);
next(xpp);
return r;
} else {
unknownContent(xpp);
return null;
}
}
public void compose(IXMLWriter writer, Resource resource, boolean htmlPretty) throws IOException {
this.htmlPretty = htmlPretty;
xml = writer;
xml.setDefaultNamespace(FHIR_NS);
composeResource(resource);
}
protected abstract void composeResource(Resource resource) throws IOException ;
protected void composeElementAttributes(Element element) throws IOException {
if (style != OutputStyle.CANONICAL)
for (String comment : element.getFormatCommentsPre())
xml.comment(comment, getOutputStyle() == OutputStyle.PRETTY);
if (element.getId() != null)
xml.attribute("id", element.getId());
}
protected void composeElementClose(Base base) throws IOException {
if (style != OutputStyle.CANONICAL)
for (String comment : base.getFormatCommentsPost())
xml.comment(comment, getOutputStyle() == OutputStyle.PRETTY);
}
protected void composeTypeAttributes(Type type) throws IOException {
composeElementAttributes(type);
}
protected void composeXhtml(String name, XhtmlNode html) throws IOException {
if (!Utilities.noString(xhtmlMessage)) {
xml.enter(XhtmlComposer.XHTML_NS, name);
xml.comment(xhtmlMessage, false);
xml.exit(XhtmlComposer.XHTML_NS, name);
} else {
XhtmlComposer comp = new XhtmlComposer();
// name is also found in the html and should the same
// ? check that
boolean oldPretty = xml.isPretty();
xml.setPretty(htmlPretty);
comp.setXmlOnly(true);
if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)
xml.namespace(XhtmlComposer.XHTML_NS, null);
comp.compose(xml, html);
xml.setPretty(oldPretty);
}
}
abstract protected void composeString(String name, StringType value) throws IOException ;
protected void composeString(String name, IIdType value) throws IOException {
composeString(name, new StringType(value.getValue()));
}
protected void composeDomainResource(String name, DomainResource res) throws IOException {
xml.enter(FHIR_NS, name);
composeResource(res.getResourceType().toString(), res);
xml.exit(FHIR_NS, name);
}
protected abstract void composeResource(String name, Resource res) throws IOException ;
}

View File

@ -16,7 +16,7 @@ import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
/** /**
* This class represents the reference model of FHIR * This class represents the underlying reference model of FHIR
* *
* A resource is nothing but a set of elements, where every element has a * A resource is nothing but a set of elements, where every element has a
* name, maybe a stated type, maybe an id, and either a value or child elements * name, maybe a stated type, maybe an id, and either a value or child elements
@ -229,9 +229,10 @@ public class Element extends Base {
@Override @Override
public boolean isPrimitive() { public boolean isPrimitive() {
return type != null ? ParserBase.isPrimitive(type) : property.isPrimitive(name); return type != null ? property.isPrimitive(type) : property.isPrimitive(property.getType(name));
} }
@Override @Override
public boolean hasPrimitiveValue() { public boolean hasPrimitiveValue() {
return property.isPrimitive(name) || property.IsLogicalAndHasPrimitiveValue(name); return property.isPrimitive(name) || property.IsLogicalAndHasPrimitiveValue(name);

View File

@ -118,7 +118,7 @@ public class JsonParser extends ParserBase {
private void parseChildren(String path, JsonObject object, Element context, boolean hasResourceType) throws DefinitionException, FHIRFormatError { private void parseChildren(String path, JsonObject object, Element context, boolean hasResourceType) throws DefinitionException, FHIRFormatError {
reapComments(object, context); reapComments(object, context);
List<Property> properties = getChildProperties(context.getProperty(), context.getName(), null); List<Property> properties = context.getProperty().getChildProperties(context.getName(), null);
Set<String> processed = new HashSet<String>(); Set<String> processed = new HashSet<String>();
if (hasResourceType) if (hasResourceType)
processed.add("resourceType"); processed.add("resourceType");
@ -130,15 +130,15 @@ public class JsonParser extends ParserBase {
if (property.isChoice()) { if (property.isChoice()) {
for (TypeRefComponent type : property.getDefinition().getType()) { for (TypeRefComponent type : property.getDefinition().getType()) {
String eName = property.getName().substring(0, property.getName().length()-3) + Utilities.capitalize(type.getCode()); String eName = property.getName().substring(0, property.getName().length()-3) + Utilities.capitalize(type.getCode());
if (!ParserBase.isPrimitive(type.getCode()) && object.has(eName)) { if (!isPrimitive(type.getCode()) && object.has(eName)) {
parseChildComplex(path, object, context, processed, property, eName); parseChildComplex(path, object, context, processed, property, eName);
break; break;
} else if (ParserBase.isPrimitive(type.getCode()) && (object.has(eName) || object.has("_"+eName))) { } else if (isPrimitive(type.getCode()) && (object.has(eName) || object.has("_"+eName))) {
parseChildPrimitive(object, context, processed, property, path, eName); parseChildPrimitive(object, context, processed, property, path, eName);
break; break;
} }
} }
} else if (property.isPrimitive(null)) { } else if (property.isPrimitive(property.getType(null))) {
parseChildPrimitive(object, context, processed, property, path, property.getName()); parseChildPrimitive(object, context, processed, property, path, property.getName());
} else if (object.has(property.getName())) { } else if (object.has(property.getName())) {
parseChildComplex(path, object, context, processed, property, property.getName()); parseChildComplex(path, object, context, processed, property, property.getName());
@ -290,13 +290,15 @@ public class JsonParser extends ParserBase {
} }
protected void prop(String name, String value) throws IOException { protected void prop(String name, String value, String link) throws IOException {
json.link(link);
if (name != null) if (name != null)
json.name(name); json.name(name);
json.value(value); json.value(value);
} }
protected void open(String name) throws IOException { protected void open(String name, String link) throws IOException {
json.link(link);
if (name != null) if (name != null)
json.name(name); json.name(name);
json.beginObject(); json.beginObject();
@ -306,7 +308,8 @@ public class JsonParser extends ParserBase {
json.endObject(); json.endObject();
} }
protected void openArray(String name) throws IOException { protected void openArray(String name, String link) throws IOException {
json.link(link);
if (name != null) if (name != null)
json.name(name); json.name(name);
json.beginArray(); json.beginArray();
@ -326,7 +329,7 @@ public class JsonParser extends ParserBase {
json = new JsonCreatorGson(osw); json = new JsonCreatorGson(osw);
json.setIndent(style == OutputStyle.PRETTY ? " " : ""); json.setIndent(style == OutputStyle.PRETTY ? " " : "");
json.beginObject(); json.beginObject();
prop("resourceType", e.getType()); prop("resourceType", e.getType(), null);
Set<String> done = new HashSet<String>(); Set<String> done = new HashSet<String>();
for (Element child : e.getChildren()) { for (Element child : e.getChildren()) {
compose(e.getName(), e, done, child); compose(e.getName(), e, done, child);
@ -336,6 +339,19 @@ public class JsonParser extends ParserBase {
osw.flush(); osw.flush();
} }
public void compose(Element e, JsonCreator json) throws Exception {
this.json = json;
json.beginObject();
prop("resourceType", e.getType(), linkResolver == null ? null : linkResolver.resolveType(e.getType()));
Set<String> done = new HashSet<String>();
for (Element child : e.getChildren()) {
compose(e.getName(), e, done, child);
}
json.endObject();
json.finish();
}
private void compose(String path, Element e, Set<String> done, Element child) throws IOException { private void compose(String path, Element e, Set<String> done, Element child) throws IOException {
if (child.getSpecial() == SpecialElement.BUNDLE_ENTRY || !child.getProperty().isList()) {// for specials, ignore the cardinality of the stated type if (child.getSpecial() == SpecialElement.BUNDLE_ENTRY || !child.getProperty().isList()) {// for specials, ignore the cardinality of the stated type
compose(path, child); compose(path, child);
@ -360,7 +376,7 @@ public class JsonParser extends ParserBase {
complex = true; complex = true;
} }
if (prim) { if (prim) {
openArray(name); openArray(name, linkResolver == null ? null : linkResolver.resolveProperty(list.get(0).getProperty()));
for (Element item : list) { for (Element item : list) {
if (item.hasValue()) if (item.hasValue())
primitiveValue(null, item); primitiveValue(null, item);
@ -372,12 +388,12 @@ public class JsonParser extends ParserBase {
name = "_"+name; name = "_"+name;
} }
if (complex) { if (complex) {
openArray(name); openArray(name, linkResolver == null ? null : linkResolver.resolveProperty(list.get(0).getProperty()));
for (Element item : list) { for (Element item : list) {
if (item.hasChildren()) { if (item.hasChildren()) {
open(null); open(null,null);
if (item.getProperty().isResource()) { if (item.getProperty().isResource()) {
prop("resourceType", item.getType()); prop("resourceType", item.getType(), linkResolver == null ? null : linkResolver.resolveType(item.getType()));
} }
Set<String> done = new HashSet<String>(); Set<String> done = new HashSet<String>();
for (Element child : item.getChildren()) { for (Element child : item.getChildren()) {
@ -392,11 +408,14 @@ public class JsonParser extends ParserBase {
} }
private void primitiveValue(String name, Element item) throws IOException { private void primitiveValue(String name, Element item) throws IOException {
if (name != null) if (name != null) {
if (linkResolver != null)
json.link(linkResolver.resolveProperty(item.getProperty()));
json.name(name); json.name(name);
}
String type = item.getType(); String type = item.getType();
if (Utilities.existsInList(type, "boolean")) if (Utilities.existsInList(type, "boolean"))
json.value(item.getValue().equals("true") ? new Boolean(true) : new Boolean(false)); json.value(item.getValue().trim().equals("true") ? new Boolean(true) : new Boolean(false));
else if (Utilities.existsInList(type, "integer", "unsignedInt", "positiveInt")) else if (Utilities.existsInList(type, "integer", "unsignedInt", "positiveInt"))
json.value(new Integer(item.getValue())); json.value(new Integer(item.getValue()));
else if (Utilities.existsInList(type, "decimal")) else if (Utilities.existsInList(type, "decimal"))
@ -407,15 +426,15 @@ public class JsonParser extends ParserBase {
private void compose(String path, Element element) throws IOException { private void compose(String path, Element element) throws IOException {
String name = element.getName(); String name = element.getName();
if (element.isPrimitive() || ParserBase.isPrimitive(element.getType())) { if (element.isPrimitive() || isPrimitive(element.getType())) {
if (element.hasValue()) if (element.hasValue())
primitiveValue(name, element); primitiveValue(name, element);
name = "_"+name; name = "_"+name;
} }
if (element.hasChildren()) { if (element.hasChildren()) {
open(name); open(name, linkResolver == null ? null : linkResolver.resolveProperty(element.getProperty()));
if (element.getProperty().isResource()) { if (element.getProperty().isResource()) {
prop("resourceType", element.getType()); prop("resourceType", element.getType(), linkResolver == null ? null : linkResolver.resolveType(element.getType()));
} }
Set<String> done = new HashSet<String>(); Set<String> done = new HashSet<String>();
for (Element child : element.getChildren()) { for (Element child : element.getChildren()) {

View File

@ -16,6 +16,7 @@ import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity; import org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.dstu3.model.OperationOutcome.IssueType; import org.hl7.fhir.dstu3.model.OperationOutcome.IssueType;
import org.hl7.fhir.dstu3.model.StructureDefinition; import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.dstu3.utils.IWorkerContext; import org.hl7.fhir.dstu3.utils.IWorkerContext;
import org.hl7.fhir.dstu3.utils.ProfileUtilities; import org.hl7.fhir.dstu3.utils.ProfileUtilities;
import org.hl7.fhir.dstu3.utils.ToolingExtensions; import org.hl7.fhir.dstu3.utils.ToolingExtensions;
@ -25,20 +26,23 @@ import org.hl7.fhir.utilities.Utilities;
public abstract class ParserBase { public abstract class ParserBase {
interface IErrorNotifier { public interface ILinkResolver {
String resolveType(String type);
String resolveProperty(Property property);
String resolvePage(String string);
} }
public enum ValidationPolicy { NONE, QUICK, EVERYTHING } public enum ValidationPolicy { NONE, QUICK, EVERYTHING }
public static boolean isPrimitive(String code) { public boolean isPrimitive(String code) {
return Utilities.existsInList(code, StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
"xhtml", "boolean", "integer", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
"time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml", "base64Binary");
} }
protected IWorkerContext context; protected IWorkerContext context;
protected ValidationPolicy policy; protected ValidationPolicy policy;
protected List<ValidationMessage> errors; protected List<ValidationMessage> errors;
protected ILinkResolver linkResolver;
public ParserBase(IWorkerContext context) { public ParserBase(IWorkerContext context) {
super(); super();
@ -101,67 +105,16 @@ public abstract class ParserBase {
return null; return null;
} }
public ILinkResolver getLinkResolver() {
protected List<Property> getChildProperties(Property property, String elementName, String statedType) throws DefinitionException { return linkResolver;
ElementDefinition ed = property.getDefinition();
StructureDefinition sd = property.getStructure();
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty()) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found");
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
if (ed.hasRepresentation(PropertyRepresentation.TYPEATTR)) {
t = statedType;
if (t == null && ToolingExtensions.hasExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaultype"))
t = ToolingExtensions.readStringExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaultype");
boolean ok = false;
for (TypeRefComponent tr : ed.getType())
if (tr.getCode().equals(t))
ok = true;
if (!ok)
throw new DefinitionException("Type '"+t+"' is not an acceptable type for '"+elementName+"' on property "+property.getDefinition().getPath());
} else {
t = elementName.substring(tail(ed.getPath()).length() - 3);
if (isPrimitive(lowFirst(t)))
t = lowFirst(t);
}
}
}
if (!"xhtml".equals(t)) {
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t);
if (sd == null)
throw new DefinitionException("Unable to find class '"+t+"' for name '"+elementName+"' on property "+property.getDefinition().getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
} }
private String lowFirst(String t) { public ParserBase setLinkResolver(ILinkResolver linkResolver) {
return t.substring(0, 1).toLowerCase()+t.substring(1); this.linkResolver = linkResolver;
return this;
} }
private String tail(String path) {
return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
}
} }

View File

@ -1,11 +1,17 @@
package org.hl7.fhir.dstu3.metamodel; package org.hl7.fhir.dstu3.metamodel;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.dstu3.exceptions.DefinitionException;
import org.hl7.fhir.dstu3.formats.FormatUtilities; import org.hl7.fhir.dstu3.formats.FormatUtilities;
import org.hl7.fhir.dstu3.model.ElementDefinition; import org.hl7.fhir.dstu3.model.ElementDefinition;
import org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.dstu3.model.StructureDefinition; import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.utils.IWorkerContext; import org.hl7.fhir.dstu3.utils.IWorkerContext;
import org.hl7.fhir.dstu3.utils.ProfileUtilities;
import org.hl7.fhir.dstu3.utils.ToolingExtensions; import org.hl7.fhir.dstu3.utils.ToolingExtensions;
public class Property { public class Property {
@ -58,7 +64,7 @@ public class Property {
String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1); String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName != null && elementName.startsWith(tail.substring(0, tail.length()-3))) { if (tail.endsWith("[x]") && elementName != null && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3); String name = elementName.substring(tail.length()-3);
return ParserBase.isPrimitive(lowFirst(name)) ? lowFirst(name) : name; return isPrimitive(lowFirst(name)) ? lowFirst(name) : name;
} else } else
throw new Error("logic error, gettype when types > 1, name mismatch for "+elementName+" on at "+definition.getPath()); throw new Error("logic error, gettype when types > 1, name mismatch for "+elementName+" on at "+definition.getPath());
} else if (definition.getType().get(0).getCode() == null) { } else if (definition.getType().get(0).getCode() == null) {
@ -94,7 +100,9 @@ public class Property {
} }
public boolean isPrimitive(String name) { public boolean isPrimitive(String name) {
return ParserBase.isPrimitive(getType(name)); String code = name;
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
} }
private String lowFirst(String t) { private String lowFirst(String t) {
@ -134,7 +142,7 @@ public class Property {
if (sd == null || sd.getKind() != StructureDefinitionKind.LOGICAL) if (sd == null || sd.getKind() != StructureDefinitionKind.LOGICAL)
return false; return false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) { for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && ParserBase.isPrimitive(ed.getType().get(0).getCode())) { if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && isPrimitive(ed.getType().get(0).getCode())) {
canBePrimitive = true; canBePrimitive = true;
return true; return true;
} }
@ -153,5 +161,73 @@ public class Property {
} }
protected List<Property> getChildProperties(String elementName, String statedType) throws DefinitionException {
ElementDefinition ed = definition;
StructureDefinition sd = structure;
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty()) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found");
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
if (ed.hasRepresentation(PropertyRepresentation.TYPEATTR)) {
t = statedType;
if (t == null && ToolingExtensions.hasExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype"))
t = ToolingExtensions.readStringExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype");
boolean ok = false;
for (TypeRefComponent tr : ed.getType())
if (tr.getCode().equals(t))
ok = true;
if (!ok)
throw new DefinitionException("Type '"+t+"' is not an acceptable type for '"+elementName+"' on property "+definition.getPath());
} else {
t = elementName.substring(tail(ed.getPath()).length() - 3);
if (isPrimitive(lowFirst(t)))
t = lowFirst(t);
}
}
}
if (!"xhtml".equals(t)) {
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t);
if (sd == null)
throw new DefinitionException("Unable to find class '"+t+"' for name '"+elementName+"' on property "+definition.getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
}
private String tail(String path) {
return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
}
public Property getChild(String elementName, String childName) throws DefinitionException {
List<Property> children = getChildProperties(elementName, null);
for (Property p : children) {
if (p.getName().equals(childName)) {
return p;
}
}
return null;
}
} }

View File

@ -37,6 +37,7 @@ import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer; import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import org.hl7.fhir.utilities.xhtml.XhtmlParser; import org.hl7.fhir.utilities.xhtml.XhtmlParser;
import org.hl7.fhir.utilities.xml.IXMLWriter;
import org.hl7.fhir.utilities.xml.XMLUtil; import org.hl7.fhir.utilities.xml.XMLUtil;
import org.hl7.fhir.utilities.xml.XMLWriter; import org.hl7.fhir.utilities.xml.XMLWriter;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
@ -47,10 +48,22 @@ import org.xml.sax.InputSource;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
public class XmlParser extends ParserBase { public class XmlParser extends ParserBase {
private boolean allowXsiLocation;
public XmlParser(IWorkerContext context) { public XmlParser(IWorkerContext context) {
super(context); super(context);
} }
public boolean isAllowXsiLocation() {
return allowXsiLocation;
}
public void setAllowXsiLocation(boolean allowXsiLocation) {
this.allowXsiLocation = allowXsiLocation;
}
public Element parse(InputStream stream) throws Exception { public Element parse(InputStream stream) throws Exception {
Document doc = null; Document doc = null;
try { try {
@ -205,7 +218,7 @@ public class XmlParser extends ParserBase {
private void parseChildren(String path, org.w3c.dom.Element node, Element context) throws Exception { private void parseChildren(String path, org.w3c.dom.Element node, Element context) throws Exception {
// this parsing routine retains the original order in a the XML file, to support validation // this parsing routine retains the original order in a the XML file, to support validation
reapComments(node, context); reapComments(node, context);
List<Property> properties = getChildProperties(context.getProperty(), context.getName(), XMLUtil.getXsiType(node)); List<Property> properties = context.getProperty().getChildProperties(context.getName(), XMLUtil.getXsiType(node));
String text = XMLUtil.getDirectText(node).trim(); String text = XMLUtil.getDirectText(node).trim();
if (!Utilities.noString(text)) { if (!Utilities.noString(text)) {
@ -229,7 +242,7 @@ public class XmlParser extends ParserBase {
context.setValue(av); context.setValue(av);
else else
context.getChildren().add(new Element(property.getName(), property, property.getType(), av).markLocation(line(node), col(node))); context.getChildren().add(new Element(property.getName(), property, property.getType(), av).markLocation(line(node), col(node)));
} else { } else if (!allowXsiLocation || !attr.getNodeName().endsWith(":schemaLocation") ) {
logError(line(node), col(node), path, IssueType.STRUCTURE, "Undefined attribute '@"+attr.getNodeName()+"'", IssueSeverity.ERROR); logError(line(node), col(node), path, IssueType.STRUCTURE, "Undefined attribute '@"+attr.getNodeName()+"'", IssueSeverity.ERROR);
} }
} }
@ -372,22 +385,38 @@ public class XmlParser extends ParserBase {
} }
private void composeElement(XMLWriter xml, Element element, String elementName) throws IOException { public void compose(Element e, IXMLWriter xml) throws Exception {
xml.start();
xml.setDefaultNamespace(e.getProperty().getNamespace());
composeElement(xml, e, e.getType());
xml.end();
}
private void composeElement(IXMLWriter xml, Element element, String elementName) throws IOException {
for (String s : element.getComments()) { for (String s : element.getComments()) {
xml.comment(s, true); xml.comment(s, true);
} }
if (isText(element.getProperty())) { if (isText(element.getProperty())) {
if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty()));
xml.enter(elementName); xml.enter(elementName);
xml.text(element.getValue()); xml.text(element.getValue());
xml.exit(elementName); xml.exit(elementName);
} else if (element.isPrimitive() || (element.hasType() && ParserBase.isPrimitive(element.getType()))) { } else if (element.isPrimitive() || (element.hasType() && isPrimitive(element.getType()))) {
if (element.getType().equals("xhtml")) { if (element.getType().equals("xhtml")) {
xml.escapedText(element.getValue()); xml.escapedText(element.getValue());
} else if (isText(element.getProperty())) { } else if (isText(element.getProperty())) {
if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty()));
xml.text(element.getValue()); xml.text(element.getValue());
} else { } else {
if (element.hasValue()) if (element.hasValue()) {
if (linkResolver != null)
xml.link(linkResolver.resolveType(element.getType()));
xml.attribute("value", element.getValue()); xml.attribute("value", element.getValue());
}
if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty()));
if (element.hasChildren()) { if (element.hasChildren()) {
xml.enter(elementName); xml.enter(elementName);
for (Element child : element.getChildren()) for (Element child : element.getChildren())
@ -398,16 +427,26 @@ public class XmlParser extends ParserBase {
} }
} else { } else {
for (Element child : element.getChildren()) { for (Element child : element.getChildren()) {
if (isAttr(child.getProperty())) if (isAttr(child.getProperty())) {
if (linkResolver != null)
xml.link(linkResolver.resolveType(child.getType()));
xml.attribute(child.getName(), child.getValue()); xml.attribute(child.getName(), child.getValue());
} }
}
if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty()));
xml.enter(elementName); xml.enter(elementName);
if (element.getSpecial() != null) if (element.getSpecial() != null) {
if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty()));
xml.enter(element.getType()); xml.enter(element.getType());
}
for (Element child : element.getChildren()) { for (Element child : element.getChildren()) {
if (isText(child.getProperty())) if (isText(child.getProperty())) {
if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty()));
xml.text(child.getValue()); xml.text(child.getValue());
else if (!isAttr(child.getProperty())) } else if (!isAttr(child.getProperty()))
composeElement(xml, child, child.getName()); composeElement(xml, child, child.getName());
} }
if (element.getSpecial() != null) if (element.getSpecial() != null)

View File

@ -44,7 +44,7 @@ import org.hl7.fhir.dstu3.exceptions.FHIRException;
/** /**
* Base definition for all elements in a resource. * Base definition for all elements in a resource.
*/ */
public abstract class Element extends Base implements IBaseHasExtensions { public abstract class Element extends Base implements IBaseHasExtensions, IBaseElement {
/** /**
* unique id for the element within a resource (for internal references). * unique id for the element within a resource (for internal references).

View File

@ -1,7 +1,6 @@
package org.hl7.fhir.dstu3.utils; package org.hl7.fhir.dstu3.utils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.EnumSet; import java.util.EnumSet;
@ -10,43 +9,36 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import org.hl7.fhir.dstu3.exceptions.DefinitionException; import org.hl7.fhir.dstu3.exceptions.DefinitionException;
import org.hl7.fhir.dstu3.exceptions.FHIRException; import org.hl7.fhir.dstu3.exceptions.FHIRException;
import org.hl7.fhir.dstu3.exceptions.PathEngineException; import org.hl7.fhir.dstu3.exceptions.PathEngineException;
import org.hl7.fhir.dstu3.metamodel.ParserBase;
import org.hl7.fhir.dstu3.model.Base; import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.BooleanType; import org.hl7.fhir.dstu3.model.BooleanType;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.DateTimeType; import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.DateType; import org.hl7.fhir.dstu3.model.DateType;
import org.hl7.fhir.dstu3.model.DecimalType; import org.hl7.fhir.dstu3.model.DecimalType;
import org.hl7.fhir.dstu3.model.Element;
import org.hl7.fhir.dstu3.model.ElementDefinition; import org.hl7.fhir.dstu3.model.ElementDefinition;
import org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu3.model.ExpressionNode; import org.hl7.fhir.dstu3.model.ExpressionNode;
import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus; import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus;
import org.hl7.fhir.dstu3.model.ExpressionNode.Function; import org.hl7.fhir.dstu3.model.ExpressionNode.Function;
import org.hl7.fhir.dstu3.model.ExpressionNode.TypeDetails;
import org.hl7.fhir.dstu3.model.ExpressionNode.Kind; import org.hl7.fhir.dstu3.model.ExpressionNode.Kind;
import org.hl7.fhir.dstu3.model.ExpressionNode.Operation; import org.hl7.fhir.dstu3.model.ExpressionNode.Operation;
import org.hl7.fhir.dstu3.model.ExpressionNode.SourceLocation; import org.hl7.fhir.dstu3.model.ExpressionNode.SourceLocation;
import org.hl7.fhir.dstu3.model.Factory; import org.hl7.fhir.dstu3.model.ExpressionNode.TypeDetails;
import org.hl7.fhir.dstu3.model.IntegerType; import org.hl7.fhir.dstu3.model.IntegerType;
import org.hl7.fhir.dstu3.model.Reference;
import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.StructureDefinition; import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.TemporalPrecisionEnum; import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule; import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule;
import org.hl7.fhir.dstu3.model.TemporalPrecisionEnum;
import org.hl7.fhir.dstu3.model.TimeType; import org.hl7.fhir.dstu3.model.TimeType;
import org.hl7.fhir.dstu3.model.Type; import org.hl7.fhir.dstu3.model.Type;
import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException; import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException;
import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails; import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails;
import org.hl7.fhir.exceptions.UcumException; import org.hl7.fhir.exceptions.UcumException;
import org.hl7.fhir.utilities.Table;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.ucum.Decimal; import org.hl7.fhir.utilities.ucum.Decimal;
@ -130,21 +122,13 @@ public class FHIRPathEngine {
for (StructureDefinition sd : worker.allStructures()) { for (StructureDefinition sd : worker.allStructures()) {
if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION)
allTypes.put(sd.getName(), sd); allTypes.put(sd.getName(), sd);
if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && isPrimitive(sd)) { if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
primitiveTypes.add(sd.getName()); primitiveTypes.add(sd.getName());
} }
} }
} }
private boolean isPrimitive(StructureDefinition sd) {
for (ElementDefinition ed : sd.getSnapshot().getElement())
if (ed.getPath().equals(sd.getName()+".value") && ed.hasRepresentation(PropertyRepresentation.XMLATTR))
return true;
return false;
}
// --- 3 methods to override in children ------------------------------------------------------- // --- 3 methods to override in children -------------------------------------------------------
// if you don't override, it falls through to the using the base reference implementation // if you don't override, it falls through to the using the base reference implementation
// HAPI overrides to these to support extensing the base model // HAPI overrides to these to support extensing the base model
@ -503,6 +487,10 @@ public class FHIRPathEngine {
if (lexer.getCurrent().equals("-")) { if (lexer.getCurrent().equals("-")) {
lexer.take(); lexer.take();
lexer.setCurrent("-"+lexer.getCurrent()); lexer.setCurrent("-"+lexer.getCurrent());
}
if (lexer.getCurrent().equals("+")) {
lexer.take();
lexer.setCurrent("+"+lexer.getCurrent());
} }
if (lexer.isConstant(false)) { if (lexer.isConstant(false)) {
checkConstant(lexer.getCurrent(), lexer); checkConstant(lexer.getCurrent(), lexer);
@ -1248,7 +1236,7 @@ public class FHIRPathEngine {
if (Base.compareDeep(lUnit, rUnit, true)) { if (Base.compareDeep(lUnit, rUnit, true)) {
return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
} else { } else {
throw new Error("Canonical Comparison isn't done yet"); throw new InternalErrorException("Canonical Comparison isn't done yet");
} }
} }
return new ArrayList<Base>(); return new ArrayList<Base>();
@ -1272,7 +1260,7 @@ public class FHIRPathEngine {
if (Base.compareDeep(lUnit, rUnit, true)) { if (Base.compareDeep(lUnit, rUnit, true)) {
return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
} else { } else {
throw new Error("Canonical Comparison isn't done yet"); throw new InternalErrorException("Canonical Comparison isn't done yet");
} }
} }
return new ArrayList<Base>(); return new ArrayList<Base>();
@ -1322,7 +1310,7 @@ public class FHIRPathEngine {
if (Base.compareDeep(lUnit, rUnit, true)) { if (Base.compareDeep(lUnit, rUnit, true)) {
return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
} else { } else {
throw new Error("Canonical Comparison isn't done yet"); throw new InternalErrorException("Canonical Comparison isn't done yet");
} }
} }
return new ArrayList<Base>(); return new ArrayList<Base>();
@ -2584,7 +2572,7 @@ public class FHIRPathEngine {
return new ElementDefinitionMatch(ed, null); return new ElementDefinitionMatch(ed, null);
if (allowTypedName && ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() > ed.getPath().length()-3) { if (allowTypedName && ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() > ed.getPath().length()-3) {
String s = Utilities.uncapitalize(path.substring(ed.getPath().length()-3)); String s = Utilities.uncapitalize(path.substring(ed.getPath().length()-3));
if (ParserBase.isPrimitive(s)) if (primitiveTypes.contains(s))
return new ElementDefinitionMatch(ed, s); return new ElementDefinitionMatch(ed, s);
else else
return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3)); return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3));

View File

@ -74,22 +74,22 @@ public interface IResourceValidator {
* a Json Object * a Json Object
* *
*/ */
void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws Exception;
void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws Exception;
void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws Exception;
void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource) throws Exception;
void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, String profile) throws Exception;
void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, StructureDefinition profile) throws Exception;
void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.metamodel.Element element) throws Exception; void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.metamodel.Element element) throws Exception;
void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.metamodel.Element element, String profile) throws Exception; void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.metamodel.Element element, String profile) throws Exception;
void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.metamodel.Element element, StructureDefinition profile) throws Exception; void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.metamodel.Element element, StructureDefinition profile) throws Exception;
void validate(List<ValidationMessage> errors, org.w3c.dom.Element element) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws Exception;
void validate(List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws Exception;
void validate(List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws Exception;
void validate(List<ValidationMessage> errors, org.w3c.dom.Document document) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource) throws Exception;
void validate(List<ValidationMessage> errors, org.w3c.dom.Document document, String profile) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, String profile) throws Exception;
void validate(List<ValidationMessage> errors, org.w3c.dom.Document document, StructureDefinition profile) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, StructureDefinition profile) throws Exception;
void validate(List<ValidationMessage> errors, JsonObject object) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Element element) throws Exception;
void validate(List<ValidationMessage> errors, JsonObject object, String profile) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws Exception;
void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception; org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws Exception;
org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Document document) throws Exception;
org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Document document, String profile) throws Exception;
org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Document document, StructureDefinition profile) throws Exception;
org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, JsonObject object) throws Exception;
org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, JsonObject object, String profile) throws Exception;
org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception;
} }

View File

@ -5,6 +5,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -109,6 +110,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private List<String> extensionDomains = new ArrayList<String>(); private List<String> extensionDomains = new ArrayList<String>();
private IdStatus resourceIdRule; private IdStatus resourceIdRule;
private boolean allowXsiLocation;
// used during the build process to keep the overall volume of messages down // used during the build process to keep the overall volume of messages down
private boolean suppressLoincSnomedMessages; private boolean suppressLoincSnomedMessages;
@ -155,49 +157,52 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
@Override @Override
public void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws Exception {
validate(errors, stream, format, (StructureDefinition) null); return validate(errors, stream, format, (StructureDefinition) null);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws Exception {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); StructureDefinition p = context.fetchResource(StructureDefinition.class, profile);
sdTime = sdTime + (System.nanoTime() - t); sdTime = sdTime + (System.nanoTime() - t);
if (p == null) if (p == null)
throw new DefinitionException("StructureDefinition '" + profile + "' not found"); throw new DefinitionException("StructureDefinition '" + profile + "' not found");
validate(errors, stream, format, p); return validate(errors, stream, format, p);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws Exception {
ParserBase parser = Manager.makeParser(context, format); ParserBase parser = Manager.makeParser(context, format);
if (parser instanceof XmlParser)
((XmlParser) parser).setAllowXsiLocation(allowXsiLocation);
parser.setupValidation(ValidationPolicy.EVERYTHING, errors); parser.setupValidation(ValidationPolicy.EVERYTHING, errors);
long t = System.nanoTime(); long t = System.nanoTime();
Element e = parser.parse(stream); Element e = parser.parse(stream);
loadTime = System.nanoTime() - t; loadTime = System.nanoTime() - t;
if (e != null) if (e != null)
validate(errors, e, profile); validate(errors, e, profile);
return e;
} }
@Override @Override
public void validate(List<ValidationMessage> errors, Resource resource) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, Resource resource) throws Exception {
validate(errors, resource, (StructureDefinition) null); return validate(errors, resource, (StructureDefinition) null);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, Resource resource, String profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, Resource resource, String profile) throws Exception {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); StructureDefinition p = context.fetchResource(StructureDefinition.class, profile);
sdTime = sdTime + (System.nanoTime() - t); sdTime = sdTime + (System.nanoTime() - t);
if (p == null) if (p == null)
throw new DefinitionException("StructureDefinition '" + profile + "' not found"); throw new DefinitionException("StructureDefinition '" + profile + "' not found");
validate(errors, resource, p); return validate(errors, resource, p);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, Resource resource, StructureDefinition profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, Resource resource, StructureDefinition profile) throws Exception {
throw new Exception("Not done yet"); throw new Exception("Not done yet");
// ParserBase parser = new ObjectParser(context); // ParserBase parser = new ObjectParser(context);
// parser.setupValidation(ValidationPolicy.EVERYTHING, errors); // parser.setupValidation(ValidationPolicy.EVERYTHING, errors);
@ -213,8 +218,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
@Override @Override
public void validate(List<ValidationMessage> errors, org.w3c.dom.Element element) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Element element) throws Exception {
validate(errors, element, (StructureDefinition) null); return validate(errors, element, (StructureDefinition) null);
} }
@Override @Override
@ -228,73 +233,78 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
@Override @Override
public void validate(List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws Exception {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); StructureDefinition p = context.fetchResource(StructureDefinition.class, profile);
sdTime = sdTime + (System.nanoTime() - t); sdTime = sdTime + (System.nanoTime() - t);
if (p == null) if (p == null)
throw new DefinitionException("StructureDefinition '" + profile + "' not found"); throw new DefinitionException("StructureDefinition '" + profile + "' not found");
validate(errors, element, p); return validate(errors, element, p);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws Exception {
XmlParser parser = new XmlParser(context); XmlParser parser = new XmlParser(context);
parser.setupValidation(ValidationPolicy.EVERYTHING, errors); parser.setupValidation(ValidationPolicy.EVERYTHING, errors);
long t = System.nanoTime(); long t = System.nanoTime();
Element e = parser.parse(element); Element e = parser.parse(element);
loadTime = System.nanoTime() - t; loadTime = System.nanoTime() - t;
validate(errors, e, profile); validate(errors, e, profile);
return e;
} }
@Override @Override
public void validate(List<ValidationMessage> errors, Document document) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, Document document) throws Exception {
validate(errors, document, (StructureDefinition) null); return validate(errors, document, (StructureDefinition) null);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, Document document, String profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, Document document, String profile) throws Exception {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); StructureDefinition p = context.fetchResource(StructureDefinition.class, profile);
sdTime = sdTime + (System.nanoTime() - t); sdTime = sdTime + (System.nanoTime() - t);
if (p == null) if (p == null)
throw new DefinitionException("StructureDefinition '" + profile + "' not found"); throw new DefinitionException("StructureDefinition '" + profile + "' not found");
validate(errors, document, p); return validate(errors, document, p);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, Document document, StructureDefinition profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, Document document, StructureDefinition profile) throws Exception {
XmlParser parser = new XmlParser(context); XmlParser parser = new XmlParser(context);
parser.setupValidation(ValidationPolicy.EVERYTHING, errors); parser.setupValidation(ValidationPolicy.EVERYTHING, errors);
long t = System.nanoTime(); long t = System.nanoTime();
Element e = parser.parse(document); Element e = parser.parse(document);
loadTime = System.nanoTime() - t; loadTime = System.nanoTime() - t;
if (e != null) {
validate(errors, e, profile); validate(errors, e, profile);
} }
return e;
@Override
public void validate(List<ValidationMessage> errors, JsonObject object) throws Exception {
// validate(errors, object, (StructureDefinition) null);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, JsonObject object, String profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, JsonObject object) throws Exception {
return validate(errors, object, (StructureDefinition) null);
}
@Override
public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, JsonObject object, String profile) throws Exception {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); StructureDefinition p = context.fetchResource(StructureDefinition.class, profile);
sdTime = sdTime + (System.nanoTime() - t); sdTime = sdTime + (System.nanoTime() - t);
if (p == null) if (p == null)
throw new DefinitionException("StructureDefinition '" + profile + "' not found"); throw new DefinitionException("StructureDefinition '" + profile + "' not found");
validate(errors, object, p); return validate(errors, object, p);
} }
@Override @Override
public void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception { public org.hl7.fhir.dstu3.metamodel.Element validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception {
JsonParser parser = new JsonParser(context); JsonParser parser = new JsonParser(context);
parser.setupValidation(ValidationPolicy.EVERYTHING, errors); parser.setupValidation(ValidationPolicy.EVERYTHING, errors);
long t = System.nanoTime(); long t = System.nanoTime();
Element e = parser.parse(object); Element e = parser.parse(object);
loadTime = System.nanoTime() - t; loadTime = System.nanoTime() - t;
validate(errors, e, profile); validate(errors, e, profile);
return e;
} }
@Override @Override
@ -874,8 +884,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
// note that we don't check the type here; it could be string, uri or code. // note that we don't check the type here; it could be string, uri or code.
private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, Element element, StructureDefinition profile) { private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, Element element, StructureDefinition profile) {
if (!element.hasPrimitiveValue()) if (!isPrimitiveType(type)) {
return; return;
}
String value = element.primitiveValue(); String value = element.primitiveValue();
// System.out.println("check "+value+" in "+path); // System.out.println("check "+value+" in "+path);
@ -1270,11 +1281,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return false; return false;
} }
private boolean isPrimitiveType(String type) { private boolean isPrimitiveType(String code) {
return type.equalsIgnoreCase("boolean") || type.equalsIgnoreCase("integer") || type.equalsIgnoreCase("string") || type.equalsIgnoreCase("decimal") || type.equalsIgnoreCase("uri") StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
|| type.equalsIgnoreCase("base64Binary") || type.equalsIgnoreCase("instant") || type.equalsIgnoreCase("date") || type.equalsIgnoreCase("uuid") || type.equalsIgnoreCase("id") return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
|| type.equalsIgnoreCase("xhtml") || type.equalsIgnoreCase("markdown") || type.equalsIgnoreCase("dateTime") || type.equalsIgnoreCase("time") || type.equalsIgnoreCase("code")
|| type.equalsIgnoreCase("oid") || type.equalsIgnoreCase("id");
} }
@ -1485,6 +1494,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.resourceIdRule = resourceIdRule; this.resourceIdRule = resourceIdRule;
} }
public boolean isAllowXsiLocation() {
return allowXsiLocation;
}
public void setAllowXsiLocation(boolean allowXsiLocation) {
this.allowXsiLocation = allowXsiLocation;
}
/** /**
* *
* @param element * @param element
@ -2108,7 +2126,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")"); rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")");
else else
rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element is unknown or does not match any slice"); rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element is unknown or does not match any slice");
rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.index >= last), "Element is out of order"); rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.index >= last), "Element \"{0}\" is out of order", ei.name);
last = ei.index; last = ei.index;
} }
@ -2180,9 +2198,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
boolean thisIsCodeableConcept = false; boolean thisIsCodeableConcept = false;
if (type != null) { if (type != null) {
if (isPrimitiveType(type)) if (isPrimitiveType(type)) {
checkPrimitive(errors, ei.path, type, ei.definition, ei.element, profile); checkPrimitive(errors, ei.path, type, ei.definition, ei.element, profile);
else { } else {
if (type.equals("Identifier")) if (type.equals("Identifier"))
checkIdentifier(errors, ei.path, ei.element, ei.definition); checkIdentifier(errors, ei.path, ei.element, ei.definition);
else if (type.equals("Coding")) else if (type.equals("Coding"))

View File

@ -69,6 +69,7 @@ public interface IXMLWriter {
public abstract void element(String namespace, String name, String content) throws IOException; public abstract void element(String namespace, String name, String content) throws IOException;
public abstract void element(String name, String content, boolean onlyIfNotEmpty) throws IOException; public abstract void element(String name, String content, boolean onlyIfNotEmpty) throws IOException;
public abstract void element(String name, String content) throws IOException; public abstract void element(String name, String content) throws IOException;
public abstract void element(String name) throws IOException;
public abstract void text(String content) throws IOException; public abstract void text(String content) throws IOException;
public abstract void text(String content, boolean dontEscape) throws IOException; public abstract void text(String content, boolean dontEscape) throws IOException;
@ -89,5 +90,9 @@ public interface IXMLWriter {
*/ */
public abstract void startCommentBlock() throws IOException; public abstract void startCommentBlock() throws IOException;
public abstract void endCommentBlock() throws IOException; public abstract void endCommentBlock() throws IOException;
public abstract void escapedText(String content) throws IOException;
// this is only implemented by an implementation that is producing an xhtml representation, and is able to render elements as hyperlinks
public abstract void link(String href);
} }

View File

@ -672,6 +672,7 @@ public class XMLWriter extends OutputStreamWriter implements IXMLWriter {
element(null, name, content); element(null, name, content);
} }
@Override
public void element(String name) throws IOException { public void element(String name) throws IOException {
element(null, name, null); element(null, name, null);
} }
@ -844,6 +845,7 @@ public class XMLWriter extends OutputStreamWriter implements IXMLWriter {
this.attributeLineWrap = attributeLineWrap; this.attributeLineWrap = attributeLineWrap;
} }
@Override
public void escapedText(String content) throws IOException { public void escapedText(String content) throws IOException {
text(""); text("");
int i = content.length(); int i = content.length();
@ -859,6 +861,12 @@ public class XMLWriter extends OutputStreamWriter implements IXMLWriter {
write("\r\n"); write("\r\n");
} }
@Override
public void link(String href) {
// ignore this
}
} }

View File

@ -61,7 +61,7 @@ public class BaseDateTimeTypeDstu3Test {
dt.setValueAsString("1974-12-25+10:00"); dt.setValueAsString("1974-12-25+10:00");
fail(); fail();
} catch (ca.uhn.fhir.parser.DataFormatException e) { } catch (ca.uhn.fhir.parser.DataFormatException e) {
assertEquals("Invalid date/time string: 1974-12-25+10:00", e.getMessage()); assertEquals("Invalid date/time string (invalid length): 1974-12-25+10:00", e.getMessage());
} }
try { try {
DateTimeType dt = new DateTimeType(); DateTimeType dt = new DateTimeType();

View File

@ -678,16 +678,13 @@ public class XmlParserDstu3Test {
} }
/**
* Test for #233
*/
@Test @Test
public void testEncodeAndParseProfiledDatatype() { public void testEncodeAndParseProfiledDatatype() {
MedicationOrder mo = new MedicationOrder(); MedicationOrder mo = new MedicationOrder();
mo.addDosageInstruction().getTiming().getRepeat().setBounds(new Duration().setCode("code")); mo.addDosageInstruction().getTiming().getRepeat().setBounds(new Duration().setCode("code"));
String out = ourCtx.newXmlParser().encodeResourceToString(mo); String out = ourCtx.newXmlParser().encodeResourceToString(mo);
ourLog.info(out); ourLog.info(out);
assertThat(out, containsString("</boundsQuantity>")); assertThat(out, containsString("</boundsDuration>"));
mo = ourCtx.newXmlParser().parseResource(MedicationOrder.class, out); mo = ourCtx.newXmlParser().parseResource(MedicationOrder.class, out);
Duration duration = (Duration) mo.getDosageInstruction().get(0).getTiming().getRepeat().getBounds(); Duration duration = (Duration) mo.getDosageInstruction().get(0).getTiming().getRepeat().getBounds();
@ -702,10 +699,10 @@ public class XmlParserDstu3Test {
IParser xmlParser = ourCtx.newXmlParser(); IParser xmlParser = ourCtx.newXmlParser();
MedicationStatement ms = new MedicationStatement(); MedicationStatement ms = new MedicationStatement();
ms.addDosage().setQuantity(new SimpleQuantity().setValue(123)); ms.addDosage().setDose(new SimpleQuantity().setValue(123));
String output = xmlParser.encodeResourceToString(ms); String output = xmlParser.encodeResourceToString(ms);
assertThat(output, containsString("<quantityQuantity><value value=\"123\"/></quantityQuantity>")); assertThat(output, containsString("<doseQuantity><value value=\"123\"/></doseQuantity>"));
} }
@Test @Test

View File

@ -58,7 +58,7 @@ public class UpdateDstu3Test {
ourLog.info("Response was:\n{}", responseContent); ourLog.info("Response was:\n{}", responseContent);
OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent);
assertEquals("OODETAILS", oo.getIssueFirstRep().getDiagnostics()); assertEquals("OODETAILS", oo.getIssue().get(0).getDiagnostics());
assertEquals(200, status.getStatusLine().getStatusCode()); assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("http://localhost:" + ourPort + "/Patient/001/_history/002", status.getFirstHeader("location").getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/001/_history/002", status.getFirstHeader("location").getValue());
@ -133,7 +133,7 @@ public class UpdateDstu3Test {
OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent);
assertEquals( assertEquals(
"Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"3\" does not match URL ID of \"001\"", "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"3\" does not match URL ID of \"001\"",
oo.getIssueFirstRep().getDiagnostics()); oo.getIssue().get(0).getDiagnostics());
assertEquals(400, status.getStatusLine().getStatusCode()); assertEquals(400, status.getStatusLine().getStatusCode());
assertNull(status.getFirstHeader("location")); assertNull(status.getFirstHeader("location"));

View File

@ -199,8 +199,8 @@ public class FhirTerserDstu3Test {
assertEquals(3, element.getAllValues().size()); assertEquals(3, element.getAllValues().size());
assertSame(p, element.getAllValues().get(0)); assertSame(p, element.getAllValues().get(0));
assertSame(p.getLinkFirstRep(), element.getAllValues().get(1)); assertSame(p.getLink().get(0), element.getAllValues().get(1));
assertSame(p.getLinkFirstRep().getTypeElement(), element.getAllValues().get(2)); assertSame(p.getLink().get(0).getTypeElement(), element.getAllValues().get(2));
assertEquals(3, containingElementPath.getAllValues().size()); assertEquals(3, containingElementPath.getAllValues().size());
// assertEquals(0, containingElementPath.getAllValues().get(0).size()); // assertEquals(0, containingElementPath.getAllValues().get(0).size());

View File

@ -100,10 +100,11 @@ public class FhirInstanceValidatorDstu3Test {
ids.add(next.getId()); ids.add(next.getId());
ourLog.info("Validating {}", next.getId()); ourLog.info("Validating {}", next.getId());
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(next));
ValidationResult output = myVal.validateWithResult(next); ValidationResult output = myVal.validateWithResult(next);
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output); List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
assertThat("Failed to validate " + i.getFullUrl(), errors, empty()); assertThat("Failed to validate " + i.getFullUrl() + " - " + errors, errors, empty());
} }
ourLog.info("Validated the following:\n{}", ids); ourLog.info("Validated the following:\n{}", ids);
@ -353,6 +354,7 @@ public class FhirInstanceValidatorDstu3Test {
ValidationResult output = myVal.validateWithResult(input); ValidationResult output = myVal.validateWithResult(input);
assertEquals(output.toString(), 1, output.getMessages().size()); assertEquals(output.toString(), 1, output.getMessages().size());
assertEquals("This cannot be parsed as a FHIR object (no namespace)", output.getMessages().get(0).getMessage());
ourLog.info(output.getMessages().get(0).getLocationString()); ourLog.info(output.getMessages().get(0).getLocationString());
} }
@ -503,9 +505,20 @@ public class FhirInstanceValidatorDstu3Test {
} }
@Test @Test
// @Ignore
// TODO: reenable
public void testValidateResourceWithDefaultValuesetBadCode() { public void testValidateResourceWithDefaultValuesetBadCode() {
String input = "<Observation xmlns=\"http://hl7.org/fhir\">\n" + " <status value=\"notvalidcode\"/>\n" + " <code>\n" + " <text value=\"No code here!\"/>\n" + " </code>\n" + "</Observation>"; //@formatter:off
String input =
"<Observation xmlns=\"http://hl7.org/fhir\">\n" +
" <status value=\"notvalidcode\"/>\n" +
" <code>\n" +
" <text value=\"No code here!\"/>\n" +
" </code>\n" +
"</Observation>";
//@formatter:on
ValidationResult output = myVal.validateWithResult(input); ValidationResult output = myVal.validateWithResult(input);
logResultsAndReturnAll(output);
assertEquals("The value provided ('notvalidcode') is not in the value set http://hl7.org/fhir/ValueSet/observation-status (http://hl7.org/fhir/ValueSet/observation-status, and a code is required from this value set", output.getMessages().get(0).getMessage()); assertEquals("The value provided ('notvalidcode') is not in the value set http://hl7.org/fhir/ValueSet/observation-status (http://hl7.org/fhir/ValueSet/observation-status, and a code is required from this value set", output.getMessages().get(0).getMessage());
} }

View File

@ -39,7 +39,7 @@
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Account/f:balance"> <sch:rule context="//f:Account/f:balance">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Account/f:coveragePeriod"> <sch:rule context="//f:Account/f:coveragePeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -26,7 +26,7 @@
<sch:assert test="not(f:entry/f:search) or (f:type/@value = 'searchset')">bdl-2: entry.search only when a search</sch:assert> <sch:assert test="not(f:entry/f:search) or (f:type/@value = 'searchset')">bdl-2: entry.search only when a search</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Bundle/f:entry"> <sch:rule context="//f:Bundle/f:entry">
<sch:assert test="f:resource or f:request or f:response">bdl-5: must be a resource unless there's a request or response</sch:assert> <sch:assert test="exists(f:resource) or exists(f:request) or exists(f:response)">bdl-5: must be a resource unless there's a request or response</sch:assert>
<sch:assert test="(not(exists(f:fullUrl)) and not(exists(f:resource))) or (exists(f:fullUrl) and exists(f:resource))">bdl-6: The fullUrl element must be present when a resource is present, and not present otherwise</sch:assert> <sch:assert test="(not(exists(f:fullUrl)) and not(exists(f:resource))) or (exists(f:fullUrl) and exists(f:resource))">bdl-6: The fullUrl element must be present when a resource is present, and not present otherwise</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Bundle/f:signature/f:whoReference"> <sch:rule context="//f:Bundle/f:signature/f:whoReference">

View File

@ -56,7 +56,7 @@
<sch:rule context="//f:CarePlan/f:relatedPlan/f:plan"> <sch:rule context="//f:CarePlan/f:relatedPlan/f:plan">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:CarePlan/f:participant/f:member"> <sch:rule context="//f:CarePlan/f:careTeam">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:CarePlan/f:goal"> <sch:rule context="//f:CarePlan/f:goal">
@ -82,15 +82,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat"> <sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -104,12 +106,6 @@
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledPeriod"> <sch:rule context="//f:CarePlan/f:activity/f:detail/f:scheduledPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>

View File

@ -20,7 +20,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -134,6 +134,24 @@
<sch:rule context="//f:Claim/f:referralReference"> <sch:rule context="//f:Claim/f:referralReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:information/f:timingPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:information/f:valueAddress/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:information/f:valueIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:information/f:valueIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:information/f:valueQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:information/f:valueReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:procedure/f:procedureReference"> <sch:rule context="//f:Claim/f:procedure/f:procedureReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -158,50 +176,32 @@
<sch:rule context="//f:Claim/f:coverage/f:claimResponse"> <sch:rule context="//f:Claim/f:coverage/f:claimResponse">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:accidentLocationAddress/f:period"> <sch:rule context="//f:Claim/f:item/f:careTeam/f:providerIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:accidentLocationReference"> <sch:rule context="//f:Claim/f:item/f:careTeam/f:providerIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:onset/f:timePeriod"> <sch:rule context="//f:Claim/f:item/f:careTeam/f:providerReference">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:employmentImpacted">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:hospitalization">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:providerIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:providerIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:providerReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:supervisorIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:supervisorIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:supervisorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:servicedPeriod"> <sch:rule context="//f:Claim/f:item/f:servicedPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:serviceLocationAddress/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:serviceLocationReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Claim/f:item/f:quantity"> <sch:rule context="//f:Claim/f:item/f:quantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:unitPrice"> <sch:rule context="//f:Claim/f:item/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:net"> <sch:rule context="//f:Claim/f:item/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:udi"> <sch:rule context="//f:Claim/f:item/f:udi">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
@ -210,10 +210,10 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:detail/f:unitPrice"> <sch:rule context="//f:Claim/f:item/f:detail/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:detail/f:net"> <sch:rule context="//f:Claim/f:item/f:detail/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:detail/f:udi"> <sch:rule context="//f:Claim/f:item/f:detail/f:udi">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
@ -222,16 +222,16 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:detail/f:subDetail/f:unitPrice"> <sch:rule context="//f:Claim/f:item/f:detail/f:subDetail/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:detail/f:subDetail/f:net"> <sch:rule context="//f:Claim/f:item/f:detail/f:subDetail/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:item/f:detail/f:subDetail/f:udi"> <sch:rule context="//f:Claim/f:item/f:detail/f:subDetail/f:udi">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Claim/f:total"> <sch:rule context="//f:Claim/f:total">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -72,40 +72,28 @@
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:item/f:adjudication/f:amount"> <sch:rule context="//f:ClaimResponse/f:item/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule>
<sch:rule context="//f:ClaimResponse/f:item/f:detail/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:ClaimResponse/f:item/f:detail/f:subDetail/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:addItem/f:fee"> <sch:rule context="//f:ClaimResponse/f:addItem/f:fee">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule>
<sch:rule context="//f:ClaimResponse/f:addItem/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:addItem/f:detail/f:fee"> <sch:rule context="//f:ClaimResponse/f:addItem/f:detail/f:fee">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule>
<sch:rule context="//f:ClaimResponse/f:addItem/f:detail/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:totalCost"> <sch:rule context="//f:ClaimResponse/f:totalCost">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:unallocDeductable"> <sch:rule context="//f:ClaimResponse/f:unallocDeductable">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:totalBenefit"> <sch:rule context="//f:ClaimResponse/f:totalBenefit">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:paymentAdjustment"> <sch:rule context="//f:ClaimResponse/f:paymentAdjustment">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:paymentAmount"> <sch:rule context="//f:ClaimResponse/f:paymentAmount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ClaimResponse/f:paymentRef/f:period"> <sch:rule context="//f:ClaimResponse/f:paymentRef/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>

View File

@ -44,8 +44,8 @@
<sch:rule context="//f:Condition/f:asserter"> <sch:rule context="//f:Condition/f:asserter">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Condition/f:onsetQuantity"> <sch:rule context="//f:Condition/f:onsetAge">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org') and not(contains(f:value/@value, '-'))">age-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Condition/f:onsetPeriod"> <sch:rule context="//f:Condition/f:onsetPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
@ -59,8 +59,8 @@
<sch:rule context="//f:Condition/f:onsetRange/f:high"> <sch:rule context="//f:Condition/f:onsetRange/f:high">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Condition/f:abatementQuantity"> <sch:rule context="//f:Condition/f:abatementAge">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org') and not(contains(f:value/@value, '-'))">age-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Condition/f:abatementPeriod"> <sch:rule context="//f:Condition/f:abatementPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
@ -86,5 +86,8 @@
<sch:rule context="//f:Condition/f:evidence/f:detail"> <sch:rule context="//f:Condition/f:evidence/f:detail">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Condition/f:note/f:authorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -0,0 +1,81 @@
<?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="h" uri="http://www.w3.org/1999/xhtml"/>
<!--
This file contains just the constraints for the resource Consent
It is provided for documentation purposes. When actually validating,
always use fhir-invariants.sch (because of the way containment works)
Alternatively you can use this file to build a smaller version of
fhir-invariants.sch (the contents are identical; only include those
resources relevant to your implementation).
-->
<sch:pattern>
<sch:title>Global</sch:title>
<sch:rule context="//f:*">
<sch:assert test="@value|f:*|h:div">global-1: All FHIR elements must have a @value or children</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
<sch:title>Consent</sch:title>
<sch:rule context="//f:Consent">
<sch:assert test="not(parent::f:contained and f:contained)">dom-2: If the resource is contained in another resource, it SHALL NOT contain nested Resources</sch:assert>
<sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert>
<sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert>
<sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:text/h:div">
<sch:assert test="not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])">txt-3: The narrative SHALL contain only the basic html formatting attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert>
<sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert>
<sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:identifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:identifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:applies">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:topic">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:patient">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:authority">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:domain">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:agent/f:actor">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:except/f:applies">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:except/f:topic">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:except/f:agent/f:actor">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:friendly/f:contentAttachment">
<sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:friendly/f:contentReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:legal/f:contentAttachment">
<sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:legal/f:contentReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Consent/f:rule">
<sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>

View File

@ -72,10 +72,10 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Contract/f:valuedItem/f:unitPrice"> <sch:rule context="//f:Contract/f:valuedItem/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Contract/f:valuedItem/f:net"> <sch:rule context="//f:Contract/f:valuedItem/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Contract/f:term/f:identifier/f:period"> <sch:rule context="//f:Contract/f:term/f:identifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
@ -105,10 +105,10 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Contract/f:term/f:valuedItem/f:unitPrice"> <sch:rule context="//f:Contract/f:term/f:valuedItem/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Contract/f:term/f:valuedItem/f:net"> <sch:rule context="//f:Contract/f:term/f:valuedItem/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Contract/f:bindingAttachment"> <sch:rule context="//f:Contract/f:bindingAttachment">
<sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert> <sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert>

View File

@ -61,15 +61,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat"> <sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -83,12 +85,6 @@
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingReference"> <sch:rule context="//f:DecisionSupportRule/f:trigger/f:eventTimingReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -119,8 +115,8 @@
<sch:rule context="//f:DecisionSupportRule/f:action/f:relatedAction/f:actionIdentifier/f:assigner"> <sch:rule context="//f:DecisionSupportRule/f:action/f:relatedAction/f:actionIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:action/f:relatedAction/f:offsetQuantity"> <sch:rule context="//f:DecisionSupportRule/f:action/f:relatedAction/f:offsetDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportRule/f:action/f:relatedAction/f:offsetRange"> <sch:rule context="//f:DecisionSupportRule/f:action/f:relatedAction/f:offsetRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>

View File

@ -58,15 +58,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat"> <sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -80,12 +82,6 @@
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingReference"> <sch:rule context="//f:DecisionSupportServiceModule/f:trigger/f:eventTimingReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>

View File

@ -43,15 +43,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat"> <sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:boundsQuantity"> <sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:boundsRange"> <sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -65,11 +67,5 @@
<sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:boundsPeriod"> <sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DeviceMetric/f:measurementPeriod/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -26,7 +26,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -49,15 +49,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat"> <sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -71,12 +73,6 @@
<sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DeviceUseRequest/f:timingTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DeviceUseRequest/f:timingPeriod"> <sch:rule context="//f:DeviceUseRequest/f:timingPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>

View File

@ -49,15 +49,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat"> <sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -71,12 +73,6 @@
<sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DeviceUseStatement/f:timingTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:DeviceUseStatement/f:timingPeriod"> <sch:rule context="//f:DeviceUseStatement/f:timingPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>

View File

@ -47,15 +47,9 @@
<sch:rule context="//f:DiagnosticOrder/f:supportingInformation"> <sch:rule context="//f:DiagnosticOrder/f:supportingInformation">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DiagnosticOrder/f:specimen">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-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:rule context="//f:DiagnosticOrder/f:event/f:actor">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:DiagnosticOrder/f:item/f:specimen">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:DiagnosticOrder/f:note/f:authorReference"> <sch:rule context="//f:DiagnosticOrder/f:note/f:authorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>

View File

@ -74,11 +74,11 @@
<sch:rule context="//f:EligibilityResponse/f:contract"> <sch:rule context="//f:EligibilityResponse/f:contract">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:EligibilityResponse/f:benefitBalance/f:financial/f:benefitQuantity"> <sch:rule context="//f:EligibilityResponse/f:benefitBalance/f:financial/f:benefitMoney">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:EligibilityResponse/f:benefitBalance/f:financial/f:benefitUsedQuantity"> <sch:rule context="//f:EligibilityResponse/f:benefitBalance/f:financial/f:benefitUsedMoney">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -60,7 +60,7 @@
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Encounter/f:length"> <sch:rule context="//f:Encounter/f:length">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Encounter/f:indication"> <sch:rule context="//f:Encounter/f:indication">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>

View File

@ -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="h" uri="http://www.w3.org/1999/xhtml"/>
<!--
This file contains just the constraints for the resource Endpoint
It is provided for documentation purposes. When actually validating,
always use fhir-invariants.sch (because of the way containment works)
Alternatively you can use this file to build a smaller version of
fhir-invariants.sch (the contents are identical; only include those
resources relevant to your implementation).
-->
<sch:pattern>
<sch:title>Global</sch:title>
<sch:rule context="//f:*">
<sch:assert test="@value|f:*|h:div">global-1: All FHIR elements must have a @value or children</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
<sch:title>Endpoint</sch:title>
<sch:rule context="//f:Endpoint">
<sch:assert test="not(parent::f:contained and f:contained)">dom-2: If the resource is contained in another resource, it SHALL NOT contain nested Resources</sch:assert>
<sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert>
<sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert>
<sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert>
</sch:rule>
<sch:rule context="//f:Endpoint/f:text/h:div">
<sch:assert test="not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])">txt-3: The narrative SHALL contain only the basic html formatting attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert>
<sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert>
<sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert>
</sch:rule>
<sch:rule context="//f:Endpoint/f:managingOrganization">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Endpoint/f:contact">
<sch:assert test="not(exists(f:value)) or exists(f:system)">cpt-2: A system is required if a value is provided.</sch:assert>
</sch:rule>
<sch:rule context="//f:Endpoint/f:contact/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Endpoint/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>

View File

@ -134,6 +134,24 @@
<sch:rule context="//f:ExplanationOfBenefit/f:referralReference"> <sch:rule context="//f:ExplanationOfBenefit/f:referralReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:information/f:timingPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:information/f:valueAddress/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:information/f:valueIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:information/f:valueIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:information/f:valueQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:information/f:valueReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:procedure/f:procedureReference"> <sch:rule context="//f:ExplanationOfBenefit/f:procedure/f:procedureReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -155,37 +173,13 @@
<sch:rule context="//f:ExplanationOfBenefit/f:coverage/f:coverageReference"> <sch:rule context="//f:ExplanationOfBenefit/f:coverage/f:coverageReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:accidentLocationAddress/f:period"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:careTeam/f:providerIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:accidentLocationReference"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:careTeam/f:providerIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:onset/f:timePeriod"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:careTeam/f:providerReference">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:employmentImpacted">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:hospitalization">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:providerIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:providerIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:providerReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:supervisorIdentifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:supervisorIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:supervisorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:servicedPeriod"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:servicedPeriod">
@ -195,73 +189,61 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:unitPrice"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:net"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:udi"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:udi">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:adjudication/f:amount"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:quantity"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:quantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:unitPrice"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:net"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:udi"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:udi">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:quantity"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:quantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:unitPrice"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:unitPrice">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:net"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:net">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:udi"> <sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:udi">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:item/f:detail/f:subDetail/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:addItem/f:fee"> <sch:rule context="//f:ExplanationOfBenefit/f:addItem/f:fee">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:addItem/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:addItem/f:detail/f:fee"> <sch:rule context="//f:ExplanationOfBenefit/f:addItem/f:detail/f:fee">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:addItem/f:detail/f:adjudication/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:totalCost"> <sch:rule context="//f:ExplanationOfBenefit/f:totalCost">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:unallocDeductable"> <sch:rule context="//f:ExplanationOfBenefit/f:unallocDeductable">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:totalBenefit"> <sch:rule context="//f:ExplanationOfBenefit/f:totalBenefit">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:paymentAdjustment"> <sch:rule context="//f:ExplanationOfBenefit/f:paymentAdjustment">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:paymentAmount"> <sch:rule context="//f:ExplanationOfBenefit/f:paymentAmount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:paymentRef/f:period"> <sch:rule context="//f:ExplanationOfBenefit/f:paymentRef/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
@ -269,11 +251,11 @@
<sch:rule context="//f:ExplanationOfBenefit/f:paymentRef/f:assigner"> <sch:rule context="//f:ExplanationOfBenefit/f:paymentRef/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:benefitBalance/f:financial/f:benefitQuantity"> <sch:rule context="//f:ExplanationOfBenefit/f:benefitBalance/f:financial/f:benefitMoney">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ExplanationOfBenefit/f:benefitBalance/f:financial/f:benefitUsedQuantity"> <sch:rule context="//f:ExplanationOfBenefit/f:benefitBalance/f:financial/f:benefitUsedMoney">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -42,8 +42,8 @@
<sch:rule context="//f:FamilyMemberHistory/f:bornPeriod"> <sch:rule context="//f:FamilyMemberHistory/f:bornPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:FamilyMemberHistory/f:ageQuantity"> <sch:rule context="//f:FamilyMemberHistory/f:ageAge">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org') and not(contains(f:value/@value, '-'))">age-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:FamilyMemberHistory/f:ageRange"> <sch:rule context="//f:FamilyMemberHistory/f:ageRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -54,8 +54,8 @@
<sch:rule context="//f:FamilyMemberHistory/f:ageRange/f:high"> <sch:rule context="//f:FamilyMemberHistory/f:ageRange/f:high">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:FamilyMemberHistory/f:deceasedQuantity"> <sch:rule context="//f:FamilyMemberHistory/f:deceasedAge">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org') and not(contains(f:value/@value, '-'))">age-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:FamilyMemberHistory/f:deceasedRange"> <sch:rule context="//f:FamilyMemberHistory/f:deceasedRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -69,8 +69,8 @@
<sch:rule context="//f:FamilyMemberHistory/f:note/f:authorReference"> <sch:rule context="//f:FamilyMemberHistory/f:note/f:authorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:FamilyMemberHistory/f:condition/f:onsetQuantity"> <sch:rule context="//f:FamilyMemberHistory/f:condition/f:onsetAge">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org') and not(contains(f:value/@value, '-'))">age-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. If value is present, it SHALL be positive.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:FamilyMemberHistory/f:condition/f:onsetRange"> <sch:rule context="//f:FamilyMemberHistory/f:condition/f:onsetRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>

View File

@ -38,10 +38,10 @@
<sch:rule context="//f:Goal/f:subject"> <sch:rule context="//f:Goal/f:subject">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Goal/f:targetQuantity"> <sch:rule context="//f:Goal/f:targetDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Goal/f:author"> <sch:rule context="//f:Goal/f:expressedBy">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Goal/f:addresses"> <sch:rule context="//f:Goal/f:addresses">

View File

@ -53,8 +53,8 @@
<sch:rule context="//f:GuidanceResponse/f:action/f:relatedAction/f:actionIdentifier/f:assigner"> <sch:rule context="//f:GuidanceResponse/f:action/f:relatedAction/f:actionIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:GuidanceResponse/f:action/f:relatedAction/f:offsetQuantity"> <sch:rule context="//f:GuidanceResponse/f:action/f:relatedAction/f:offsetDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:GuidanceResponse/f:action/f:relatedAction/f:offsetRange"> <sch:rule context="//f:GuidanceResponse/f:action/f:relatedAction/f:offsetRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>

View File

@ -20,7 +20,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -21,7 +21,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -49,7 +49,7 @@
<sch:rule context="//f:MedicationAdministration/f:effectiveTimePeriod"> <sch:rule context="//f:MedicationAdministration/f:effectiveTimePeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:practitioner"> <sch:rule context="//f:MedicationAdministration/f:performer">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:prescription"> <sch:rule context="//f:MedicationAdministration/f:prescription">
@ -62,12 +62,12 @@
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage"> <sch:rule context="//f:MedicationAdministration/f:dosage">
<sch:assert test="exists(f:quantity) or exists(f:rateRatio) or exists(f:rateRange)">mad-1: SHALL have at least one of dosage.quantity and dosage.rate[x]</sch:assert> <sch:assert test="exists(f:dose) or exists(f:rateRatio) or exists(f:rateRange)">mad-1: SHALL have at least one of dosage.dose and dosage.rate[x]</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage/f:siteReference"> <sch:rule context="//f:MedicationAdministration/f:dosage/f:siteReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage/f:quantity"> <sch:rule context="//f:MedicationAdministration/f:dosage/f:dose">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRatio"> <sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRatio">
@ -79,14 +79,11 @@
<sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRatio/f:denominator"> <sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRatio/f:denominator">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRange"> <sch:rule context="//f:MedicationAdministration/f:dosage/f:rateQuantity">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRange/f:low">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationAdministration/f:dosage/f:rateRange/f:high"> <sch:rule context="//f:MedicationAdministration/f:eventHistory/f:actor">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -65,15 +65,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:boundsQuantity"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:boundsRange"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -87,12 +89,6 @@
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:boundsPeriod"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:timing/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:siteReference"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:siteReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -126,6 +122,9 @@
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:rateRange/f:high"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:rateRange/f:high">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:rateQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:maxDosePerPeriod"> <sch:rule context="//f:MedicationDispense/f:dosageInstruction/f:maxDosePerPeriod">
<sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert> <sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert>
</sch:rule> </sch:rule>
@ -138,5 +137,8 @@
<sch:rule context="//f:MedicationDispense/f:substitution/f:responsibleParty"> <sch:rule context="//f:MedicationDispense/f:substitution/f:responsibleParty">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationDispense/f:eventHistory/f:actor">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -55,15 +55,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:boundsQuantity"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:boundsRange"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -77,12 +79,6 @@
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:boundsPeriod"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:timing/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:siteReference"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:siteReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -98,6 +94,21 @@
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:doseQuantity"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:doseQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerPeriod">
<sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerPeriod/f:numerator">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerPeriod/f:denominator">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerAdministration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerLifetime">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:rateRatio"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:rateRatio">
<sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert> <sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert>
</sch:rule> </sch:rule>
@ -119,18 +130,6 @@
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:rateQuantity"> <sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:rateQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerPeriod">
<sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerPeriod/f:numerator">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dosageInstruction/f:maxDosePerPeriod/f:denominator">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dispenseRequest/f:medicationReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationOrder/f:dispenseRequest/f:validityPeriod"> <sch:rule context="//f:MedicationOrder/f:dispenseRequest/f:validityPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
@ -138,10 +137,13 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:dispenseRequest/f:expectedSupplyDuration"> <sch:rule context="//f:MedicationOrder/f:dispenseRequest/f:expectedSupplyDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:priorPrescription"> <sch:rule context="//f:MedicationOrder/f:priorPrescription">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationOrder/f:eventHistory/f:actor">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -23,8 +23,9 @@
<sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert> <sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert>
<sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert> <sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert>
<sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert> <sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert>
<sch:assert test="not(exists(*[starts-with(local-name(.), 'reasonForUseReference')]) and f:wasNotTaken/@value=true())">mst-3: Reason for use reference is only permitted if wasNotTaken is false</sch:assert>
<sch:assert test="not(exists(f:reasonNotTaken) and f:wasNotTaken/@value=false())">mst-1: Reason not taken is only permitted if wasNotTaken is true</sch:assert> <sch:assert test="not(exists(f:reasonNotTaken) and f:wasNotTaken/@value=false())">mst-1: Reason not taken is only permitted if wasNotTaken is true</sch:assert>
<sch:assert test="not(exists(*[starts-with(local-name(.), 'reasonForUse')]) and f:wasNotTaken/@value=true())">mst-2: Reason for use is only permitted if wasNotTaken is false</sch:assert> <sch:assert test="not(exists(*[starts-with(local-name(.), 'reasonForUseCode')]) and f:wasNotTaken/@value=true())">mst-2: Reason for use code is only permitted if wasNotTaken is false</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:text/h:div"> <sch:rule context="//f:MedicationStatement/f:text/h:div">
<sch:assert test="not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])">txt-3: The narrative SHALL contain only the basic html formatting attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert> <sch:assert test="not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])">txt-3: The narrative SHALL contain only the basic html formatting attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert>
@ -60,15 +61,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat"> <sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:boundsQuantity"> <sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:boundsRange"> <sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -82,25 +85,19 @@
<sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:boundsPeriod"> <sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:timing/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:siteReference"> <sch:rule context="//f:MedicationStatement/f:dosage/f:siteReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:quantityQuantity"> <sch:rule context="//f:MedicationStatement/f:dosage/f:doseQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:quantityRange"> <sch:rule context="//f:MedicationStatement/f:dosage/f:doseRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:quantityRange/f:low"> <sch:rule context="//f:MedicationStatement/f:dosage/f:doseRange/f:low">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:quantityRange/f:high"> <sch:rule context="//f:MedicationStatement/f:dosage/f:doseRange/f:high">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:rateRatio"> <sch:rule context="//f:MedicationStatement/f:dosage/f:rateRatio">
@ -121,6 +118,9 @@
<sch:rule context="//f:MedicationStatement/f:dosage/f:rateRange/f:high"> <sch:rule context="//f:MedicationStatement/f:dosage/f:rateRange/f:high">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:rateQuantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:MedicationStatement/f:dosage/f:maxDosePerPeriod"> <sch:rule context="//f:MedicationStatement/f:dosage/f:maxDosePerPeriod">
<sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert> <sch:assert test="(count(f:numerator) = count(f:denominator)) and ((count(f:numerator) &gt; 0) or (count(f:extension) &gt; 0))">rat-1: Numerator and denominator SHALL both be present, or both are absent. If both are absent, there SHALL be some extension present</sch:assert>
</sch:rule> </sch:rule>

View File

@ -50,15 +50,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat"> <sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:boundsQuantity"> <sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:boundsRange"> <sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -72,26 +74,22 @@
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:boundsPeriod"> <sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:schedule/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:NutritionOrder/f:oralDiet/f:nutrient/f:amount"> <sch:rule context="//f:NutritionOrder/f:oralDiet/f:nutrient/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat"> <sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:boundsQuantity"> <sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:boundsRange"> <sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -105,12 +103,6 @@
<sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:boundsPeriod"> <sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:NutritionOrder/f:supplement/f:schedule/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:NutritionOrder/f:supplement/f:quantity"> <sch:rule context="//f:NutritionOrder/f:supplement/f:quantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
@ -119,15 +111,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat"> <sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:boundsQuantity"> <sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:boundsRange"> <sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -141,12 +135,6 @@
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:boundsPeriod"> <sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:schedule/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:quantity"> <sch:rule context="//f:NutritionOrder/f:enteralFormula/f:administration/f:quantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>

View File

@ -23,7 +23,7 @@
<sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert> <sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert>
<sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert> <sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert>
<sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert> <sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert>
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">obs-7: Component code SHALL not be same as observation code</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">obs-7: If code is the same as a component code then the value element associated with the code SHALL NOT be present</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">obs-6: dataAbsentReason SHALL only be present if Observation.value[x] is not present</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">obs-6: dataAbsentReason SHALL only be present if Observation.value[x] is not present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Observation/f:text/h:div"> <sch:rule context="//f:Observation/f:text/h:div">

View File

@ -14,14 +14,17 @@
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsTranscriptReferenceSequenceId']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsTranscriptReferenceSequenceId': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsTranscriptReferenceSequenceId']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsTranscriptReferenceSequenceId': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsProteinReferenceSequenceId']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsProteinReferenceSequenceId': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsProteinReferenceSequenceId']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsProteinReferenceSequenceId': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariation']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariation': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariant']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariant': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNAVariationId']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNAVariationId': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNAVariantId']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNAVariantId': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariationType']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariationType': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariantType']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariantType': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChange']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChange': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChange']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChange': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChangeType']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChangeType': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChangeType']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAminoAcidChangeType': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGene']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGene': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGene']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGene': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNARegionName']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNARegionName': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNARegionName']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsDNARegionName': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAlleleName']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAlleleName': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAlleleName']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAlleleName': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAllelicState']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAllelicState': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAllelicFrequency']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsAllelicFrequency': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsCopyNumberEvent']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsCopyNumberEvent': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGenomicSourceClass']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGenomicSourceClass': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGenomicSourceClass']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsGenomicSourceClass': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsSequence']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsSequence': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsSequence']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsSequence': maximum cardinality of 'extension' is 1</sch:assert>
<sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsInterpretation']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsInterpretation': maximum cardinality of 'extension' is 1</sch:assert> <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsInterpretation']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/StructureDefinition/observation-geneticsInterpretation': maximum cardinality of 'extension' is 1</sch:assert>
@ -30,7 +33,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -52,15 +52,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:Order/f:when/f:schedule/f:repeat"> <sch:rule context="//f:Order/f:when/f:schedule/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:boundsQuantity"> <sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:boundsRange"> <sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -74,12 +76,6 @@
<sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:boundsPeriod"> <sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:Order/f:when/f:schedule/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:Order/f:detail"> <sch:rule context="//f:Order/f:detail">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>

View File

@ -77,8 +77,8 @@
<sch:rule context="//f:OrderSet/f:action/f:relatedAction/f:actionIdentifier/f:assigner"> <sch:rule context="//f:OrderSet/f:action/f:relatedAction/f:actionIdentifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:OrderSet/f:action/f:relatedAction/f:offsetQuantity"> <sch:rule context="//f:OrderSet/f:action/f:relatedAction/f:offsetDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:OrderSet/f:action/f:relatedAction/f:offsetRange"> <sch:rule context="//f:OrderSet/f:action/f:relatedAction/f:offsetRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -51,7 +51,7 @@
<sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert> <sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Patient/f:contact"> <sch:rule context="//f:Patient/f:contact">
<sch:assert test="f:name or f:telecom or f:address or f:organization">pat-1: SHALL at least contain a contact's details or a reference to an organization</sch:assert> <sch:assert test="exists(f:name) or exists(f:telecom) or exists(f:address) or exists(f:organization)">pat-1: SHALL at least contain a contact's details or a reference to an organization</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Patient/f:contact/f:name/f:period"> <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 &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>

View File

@ -111,10 +111,10 @@
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:PaymentReconciliation/f:detail/f:amount"> <sch:rule context="//f:PaymentReconciliation/f:detail/f:amount">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:PaymentReconciliation/f:total"> <sch:rule context="//f:PaymentReconciliation/f:total">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='urn:iso:std:iso:4217')">mny-1: There SHALL be a code if there is a value and it SHALL be an expression of currency. If system is present, it SHALL be ISO 4217 (system = &quot;urn:iso:std:iso:4217&quot; - currency).</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -46,15 +46,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat"> <sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -68,12 +70,6 @@
<sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:ProcedureRequest/f:scheduledTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:ProcedureRequest/f:encounter"> <sch:rule context="//f:ProcedureRequest/f:encounter">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>

View File

@ -45,7 +45,7 @@
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:duration"> <sch:rule context="//f:Protocol/f:step/f:duration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:precondition"> <sch:rule context="//f:Protocol/f:step/f:precondition">
<sch:assert test="(count(f:condition) + count(f:intersection[1]) + count(f:union[1]) + count(f:exclude[1])) &lt;= 1">ptl-1: Only one of condition, intersection, union or exclude may be present</sch:assert> <sch:assert test="(count(f:condition) + count(f:intersection[1]) + count(f:union[1]) + count(f:exclude[1])) &lt;= 1">ptl-1: Only one of condition, intersection, union or exclude may be present</sch:assert>
@ -63,19 +63,21 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:wait"> <sch:rule context="//f:Protocol/f:step/f:activity/f:wait">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:boundsQuantity"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:boundsRange"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -89,19 +91,13 @@
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:boundsPeriod"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:timingTiming/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:location"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:location">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:performer"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:performer">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:product"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:productReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:quantity"> <sch:rule context="//f:Protocol/f:step/f:activity/f:detail/f:quantity">

View File

@ -12,7 +12,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -50,8 +50,8 @@
<sch:rule context="//f:RiskAssessment/f:basis"> <sch:rule context="//f:RiskAssessment/f:basis">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:RiskAssessment/f:prediction/f:probabilityDecimal"> <sch:rule context="//f:RiskAssessment/f:prediction">
<sch:assert test="@value &lt;= 100">ras-2: Must be &lt;= 100</sch:assert> <sch:assert test="not(f:probabilityDecimal) or f:probabilityDecimal/@value &lt;= 100">ras-2: Must be &lt;= 100</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:RiskAssessment/f:prediction/f:probabilityRange"> <sch:rule context="//f:RiskAssessment/f:prediction/f:probabilityRange">
<sch:assert test="(not(f:low) or f:low[f:code/@value='%' and f:system/@value='http://unitsofmeasure.org']) and (not(f:high) or f:high[f:code/@value='%' and f:system/@value='http://unitsofmeasure.org'])">ras-1: low and high must be percentages, if present</sch:assert> <sch:assert test="(not(f:low) or f:low[f:code/@value='%' and f:system/@value='http://unitsofmeasure.org']) and (not(f:high) or f:high[f:code/@value='%' and f:system/@value='http://unitsofmeasure.org'])">ras-1: low and high must be percentages, if present</sch:assert>

View File

@ -29,6 +29,12 @@
<sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert> <sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, &lt;a&gt; elements (either name or href), images and internally contained style attributes</sch:assert>
<sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert> <sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Sequence/f:identifier/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Sequence/f:identifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Sequence/f:patient"> <sch:rule context="//f:Sequence/f:patient">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -50,8 +56,5 @@
<sch:rule context="//f:Sequence/f:pointer"> <sch:rule context="//f:Sequence/f:pointer">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Sequence/f:observation">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -47,6 +47,9 @@
<sch:rule context="//f:Specimen/f:parent"> <sch:rule context="//f:Specimen/f:parent">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Specimen/f:request">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-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:rule context="//f:Specimen/f:collection/f:collector">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
@ -59,6 +62,9 @@
<sch:rule context="//f:Specimen/f:treatment/f:additive"> <sch:rule context="//f:Specimen/f:treatment/f:additive">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Specimen/f:treatment/f:timePeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-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:period"> <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 &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
@ -74,5 +80,8 @@
<sch:rule context="//f:Specimen/f:container/f:additiveReference"> <sch:rule context="//f:Specimen/f:container/f:additiveReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Specimen/f:note/f:authorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -53,7 +53,7 @@
<sch:rule context="//f:Substance/f:ingredient/f:quantity/f:denominator"> <sch:rule context="//f:Substance/f:ingredient/f:quantity/f:denominator">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Substance/f:ingredient/f:substance"> <sch:rule context="//f:Substance/f:ingredient/f:substanceReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -41,7 +41,7 @@
<sch:rule context="//f:SupplyDelivery/f:quantity"> <sch:rule context="//f:SupplyDelivery/f:quantity">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyDelivery/f:suppliedItem"> <sch:rule context="//f:SupplyDelivery/f:suppliedItemReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyDelivery/f:supplier"> <sch:rule context="//f:SupplyDelivery/f:supplier">

View File

@ -41,7 +41,7 @@
<sch:rule context="//f:SupplyRequest/f:identifier/f:assigner"> <sch:rule context="//f:SupplyRequest/f:identifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyRequest/f:orderedItem"> <sch:rule context="//f:SupplyRequest/f:orderedItemReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyRequest/f:supplier"> <sch:rule context="//f:SupplyRequest/f:supplier">
@ -52,15 +52,17 @@
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat"> <sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat">
<sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert> <sch:assert test="not(exists(f:offset)) or exists(f:when)">tim-9: If there's an offset, there must be a when</sch:assert>
<sch:assert test="f:period/@value &gt;= 0 or not(f:period/@value)">tim-5: period SHALL be a non-negative value</sch:assert>
<sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert> <sch:assert test="not(exists(f:periodMax)) or exists(f:period)">tim-6: If there's a periodMax, there must be a period</sch:assert>
<sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert> <sch:assert test="not(exists(f:durationMax)) or exists(f:duration)">tim-7: If there's a durationMax, there must be a duration</sch:assert>
<sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert> <sch:assert test="not(exists(f:countMax)) or exists(f:count)">tim-8: If there's a countMax, there must be a count</sch:assert>
<sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert> <sch:assert test="not(exists(f:duration)) or exists(f:durationUnit)">tim-1: if there's a duration, there needs to be duration units</sch:assert>
<sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert> <sch:assert test="not(exists(f:period)) or exists(f:periodUnit)">tim-2: if there's a period, there needs to be period units</sch:assert>
<sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert> <sch:assert test="not((f:period or f:frequency) and f:when)">tim-3: Either frequency or when can exist, not both</sch:assert>
<sch:assert test="f:duration/@value &gt;= 0 or not(f:duration/@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:boundsQuantity"> <sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:boundsDuration">
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert> <sch:assert test="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')">drt-1: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:boundsRange"> <sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:boundsRange">
<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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</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) &lt;= number(f:high/f:value/@value))">rng-2: If present, low SHALL have a lower value than high</sch:assert>
@ -74,11 +76,5 @@
<sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:boundsPeriod"> <sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:boundsPeriod">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:duration">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-4: duration SHALL be a non-negative value</sch:assert>
</sch:rule>
<sch:rule context="//f:SupplyRequest/f:when/f:schedule/f:repeat/f:period">
<sch:assert test="@value &gt;= 0 or not(@value)">tim-5: period SHALL be a non-negative value</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -23,7 +23,6 @@
<sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert> <sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert>
<sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert> <sch:assert test="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert>
<sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert> <sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert>
<sch:assert test="not(exists(f:failureReason)) or f:status/@value = 'failed'">inv-2: A Failure reason may be present only when a task has failed.</sch:assert>
<sch:assert test="f:lastModified &gt;= f:created">inv-1: Last modified date must be greater than or equal to created date.</sch:assert> <sch:assert test="f:lastModified &gt;= f:created">inv-1: Last modified date must be greater than or equal to created date.</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Task/f:text/h:div"> <sch:rule context="//f:Task/f:text/h:div">
@ -37,20 +36,41 @@
<sch:rule context="//f:Task/f:identifier/f:assigner"> <sch:rule context="//f:Task/f:identifier/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Task/f:subject"> <sch:rule context="//f:Task/f:basedOn">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Task/f:for"> <sch:rule context="//f:Task/f:requisition/f:period">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Task/f:creator"> <sch:rule context="//f:Task/f:requisition/f:assigner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:owner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Task/f:parent"> <sch:rule context="//f:Task/f:parent">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert> <sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule> </sch:rule>
<sch:rule context="//f:Task/f:focus">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:for">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:context">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:requester">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:owner">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:note/f:authorReference">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:fulfillment/f:period">
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>
<sch:rule context="//f:Task/f:fulfillment/f:recipients">
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
</sch:rule>
</sch:pattern> </sch:pattern>
</sch:schema> </sch:schema>

View File

@ -20,7 +20,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>

View File

@ -20,7 +20,7 @@
<sch:pattern> <sch:pattern>
<sch:title>Observation</sch:title> <sch:title>Observation</sch:title>
<sch:rule context="f:Observation"> <sch:rule context="f:Observation">
<sch:assert test="not(exists(f:component/f:code)) or count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0">Component code SHALL not be same as observation code (inherited)</sch:assert> <sch:assert test="not(exists(f:value)) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and f:system/@value=$coding/f:system/@value])=0)">If code is the same as a component code then the value element associated with the code SHALL NOT be present (inherited)</sch:assert>
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert> <sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">dataAbsentReason SHALL only be present if Observation.value[x] is not present (inherited)</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
@ -74,6 +74,12 @@
<sch:assert test="count(f:code) &gt;= 1">code: minimum cardinality of 'code' is 1</sch:assert> <sch:assert test="count(f:code) &gt;= 1">code: minimum cardinality of 'code' is 1</sch:assert>
</sch:rule> </sch:rule>
</sch:pattern> </sch:pattern>
<sch:pattern>
<sch:title>f:Observation/f:referenceRange</sch:title>
<sch:rule context="f:Observation/f:referenceRange">
<sch:assert test="count(f:meaning) &lt;= 1">meaning: maximum cardinality of 'meaning' is 1</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern> <sch:pattern>
<sch:title>Observation.referenceRange</sch:title> <sch:title>Observation.referenceRange</sch:title>
<sch:rule context="f:Observation/f:referenceRange"> <sch:rule context="f:Observation/f:referenceRange">

View File

@ -10,17 +10,17 @@
<LastAuthor>Brian Postlethwaite</LastAuthor> <LastAuthor>Brian Postlethwaite</LastAuthor>
<Created>2012-03-19T11:12:07Z</Created> <Created>2012-03-19T11:12:07Z</Created>
<LastSaved>2016-03-28T01:14:11Z</LastSaved> <LastSaved>2016-03-28T01:14:11Z</LastSaved>
<Version>16.00</Version> <Version>14.00</Version>
</DocumentProperties> </DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/> <AllowPNG/>
</OfficeDocumentSettings> </OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>6756</WindowHeight> <WindowHeight>4980</WindowHeight>
<WindowWidth>22824</WindowWidth> <WindowWidth>7470</WindowWidth>
<WindowTopX>0</WindowTopX> <WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY> <WindowTopY>0</WindowTopY>
<ActiveSheet>8</ActiveSheet> <ActiveSheet>2</ActiveSheet>
<FirstVisibleSheet>1</FirstVisibleSheet> <FirstVisibleSheet>1</FirstVisibleSheet>
<RefModeR1C1/> <RefModeR1C1/>
<ProtectStructure>False</ProtectStructure> <ProtectStructure>False</ProtectStructure>
@ -868,30 +868,28 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="26" ss:ExpandedRowCount="104" x:FullColumns="1" <Table ss:ExpandedColumnCount="26" ss:ExpandedRowCount="104" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s68" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s68" ss:DefaultRowHeight="15">
<Column ss:StyleID="s69" ss:Width="227.39999999999998"/> <Column ss:StyleID="s69" ss:Width="227.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="77.399999999999991"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="77.25"/>
<Column ss:StyleID="s68" ss:Width="29.4"/> <Column ss:StyleID="s68" ss:Width="29.25"/>
<Column ss:StyleID="s68" ss:Width="34.799999999999997"/> <Column ss:StyleID="s68" ss:Width="34.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.4"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="28.8"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="28.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="27"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="27"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="106.80000000000001" <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="106.5" ss:Span="1"/>
ss:Span="1"/>
<Column ss:Index="10" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="81"/> <Column ss:Index="10" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="81"/>
<Column ss:StyleID="s68" ss:Width="52.8" ss:Span="1"/> <Column ss:StyleID="s68" ss:Width="52.5" ss:Span="1"/>
<Column ss:Index="13" ss:StyleID="s68" ss:AutoFitWidth="0" <Column ss:Index="13" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="80.25"/>
ss:Width="80.400000000000006"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="121.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="121.8"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="213"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="213"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="114"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="114"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="214.20000000000002"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="214.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="120"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="120"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="135"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="135"/>
<Column ss:Index="21" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="103.8" <Column ss:Index="21" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="103.5"
ss:Span="2"/> ss:Span="2"/>
<Column ss:Index="24" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="50.4"/> <Column ss:Index="24" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="50.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="66"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="66"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.4"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.25"/>
<Row ss:AutoFitHeight="0" ss:Height="45" ss:StyleID="s70"> <Row ss:AutoFitHeight="0" ss:Height="45" ss:StyleID="s70">
<Cell ss:StyleID="s71"><Data ss:Type="String">Element</Data><Comment <Cell ss:StyleID="s71"><Data ss:Type="String">Element</Data><Comment
ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font
@ -1068,7 +1066,7 @@
<Cell ss:StyleID="s90"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s90"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s92"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s92"><NamedCell ss:Name="_FilterDatabase"/></Cell>
</Row> </Row>
<Row ss:Height="72"> <Row ss:AutoFitHeight="0" ss:Height="72">
<Cell ss:StyleID="s86"><Data ss:Type="String">Appointment.status</Data><NamedCell <Cell ss:StyleID="s86"><Data ss:Type="String">Appointment.status</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s87"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s87"><NamedCell ss:Name="_FilterDatabase"/></Cell>
@ -1108,7 +1106,7 @@
<Cell ss:StyleID="s90"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s90"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s92"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s92"><NamedCell ss:Name="_FilterDatabase"/></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0" ss:Height="79.2"> <Row ss:AutoFitHeight="0" ss:Height="79.3125">
<Cell ss:StyleID="s86"><Data ss:Type="String">Appointment.serviceCategory</Data><NamedCell <Cell ss:StyleID="s86"><Data ss:Type="String">Appointment.serviceCategory</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s87"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s87"><NamedCell ss:Name="_FilterDatabase"/></Cell>
@ -4148,13 +4146,12 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="52" x:FullColumns="1" <Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="52" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s102" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s102" ss:DefaultRowHeight="15">
<Column ss:Index="2" ss:StyleID="s102" ss:AutoFitWidth="0" <Column ss:Index="2" ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="115.5"/>
ss:Width="115.80000000000001"/> <Column ss:StyleID="s102" ss:Width="55.5"/>
<Column ss:StyleID="s102" ss:Width="55.800000000000004"/>
<Column ss:StyleID="s102" ss:Width="165"/> <Column ss:StyleID="s102" ss:Width="165"/>
<Column ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="205.8"/> <Column ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="205.5"/>
<Column ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="199.79999999999998"/> <Column ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="199.5"/>
<Column ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="221.4"/> <Column ss:StyleID="s102" ss:AutoFitWidth="0" ss:Width="221.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s70"> <Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s70">
<Cell ss:StyleID="s103"><Data ss:Type="String">Id</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Id</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -4195,7 +4192,7 @@
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s83"><Data ss:Type="String">Either the type or actor on the participant MUST be specified</Data><NamedCell <Cell ss:StyleID="s83"><Data ss:Type="String">Either the type or actor on the participant MUST be specified</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s83"><Data ss:Type="String">type or actor</Data><NamedCell <Cell ss:StyleID="s83"><Data ss:Type="String">type.exists() or actor.exists()</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s107"><Data ss:Type="String">(exists(f:type) or exists(f:actor))</Data><NamedCell <Cell ss:StyleID="s107"><Data ss:Type="String">(exists(f:type) or exists(f:actor))</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
@ -4207,7 +4204,7 @@
<Cell ss:StyleID="s90"/> <Cell ss:StyleID="s90"/>
<Cell ss:StyleID="s90"><Data ss:Type="String">Appointment</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Appointment</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">Either start and end are specified, or neither</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Either start and end are specified, or neither</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">start.empty() xor end</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">start.empty() xor end.exists()</Data></Cell>
<Cell ss:StyleID="s109"><Data ss:Type="String">((exists(f:start) and exists(f:end)) or (not(exists(f:start)) and not(exists(f:end))))</Data></Cell> <Cell ss:StyleID="s109"><Data ss:Type="String">((exists(f:start) and exists(f:end)) or (not(exists(f:start)) and not(exists(f:end))))</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0"> <Row ss:AutoFitHeight="0">
@ -4217,7 +4214,7 @@
<Cell ss:StyleID="s90"/> <Cell ss:StyleID="s90"/>
<Cell ss:StyleID="s90"><Data ss:Type="String">Appointment</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Appointment</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">Only proposed or cancelled appointments can be missing start/end dates</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Only proposed or cancelled appointments can be missing start/end dates</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">(start and end) or status = 'proposed' or status = 'cancelled'</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">(start.exists() and end.exists()) or (status in ('proposed' | 'cancelled'))</Data></Cell>
<Cell ss:StyleID="s109"><Data ss:Type="String">((exists(f:start) and exists(f:end)) or (f:status/@value='proposed') or (f:status/@value='cancelled'))</Data></Cell> <Cell ss:StyleID="s109"><Data ss:Type="String">((exists(f:start) and exists(f:end)) or (f:status/@value='proposed') or (f:status/@value='cancelled'))</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0"> <Row ss:AutoFitHeight="0">
@ -4657,6 +4654,7 @@
<HorizontalResolution>600</HorizontalResolution> <HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution> <VerticalResolution>600</VerticalResolution>
</Print> </Print>
<Selected/>
<FreezePanes/> <FreezePanes/>
<FrozenNoSplit/> <FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal> <SplitHorizontal>1</SplitHorizontal>
@ -4677,8 +4675,7 @@
</Pane> </Pane>
<Pane> <Pane>
<Number>0</Number> <Number>0</Number>
<ActiveRow>4</ActiveRow> <ActiveCol>0</ActiveCol>
<ActiveCol>5</ActiveCol>
</Pane> </Pane>
</Panes> </Panes>
<ProtectObjects>False</ProtectObjects> <ProtectObjects>False</ProtectObjects>
@ -4694,11 +4691,11 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="32" x:FullColumns="1" <Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="32" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15">
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="70.8"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="70.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="57"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="57"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="109.8"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="109.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="210"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="210"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="382.79999999999995"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="382.5"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s115"> <Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s115">
<Cell ss:StyleID="s103"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40">Unique name for search parameter - required, lower-case, dash-delimited string </ss:Data></Comment><NamedCell xmlns="http://www.w3.org/TR/REC-html40">Unique name for search parameter - required, lower-case, dash-delimited string </ss:Data></Comment><NamedCell
@ -4975,15 +4972,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15">
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="130.80000000000001"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="130.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="124.80000000000001"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="124.5"/>
<Column ss:StyleID="s114" ss:Width="24"/> <Column ss:StyleID="s114" ss:Width="24"/>
<Column ss:StyleID="s114" ss:Width="25.8"/> <Column ss:StyleID="s114" ss:Width="25.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="106.80000000000001" <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="106.5" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="7" ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="223.5"/>
<Column ss:Index="7" ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="223.8"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="253.5" ss:Span="1"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="253.79999999999998"
ss:Span="1"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s126"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s126"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -5605,15 +5600,14 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="21" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="21" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15">
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="82.8" ss:Span="1"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="82.5" ss:Span="1"/>
<Column ss:Index="3" ss:StyleID="s114" ss:AutoFitWidth="0" <Column ss:Index="3" ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="199.5"/>
ss:Width="199.79999999999998"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="157.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="157.80000000000001"/> <Column ss:StyleID="s114" ss:Width="106.5"/>
<Column ss:StyleID="s114" ss:Width="106.80000000000001"/> <Column ss:StyleID="s114" ss:Width="113.25"/>
<Column ss:StyleID="s114" ss:Width="113.39999999999999"/>
<Column ss:StyleID="s114" ss:Width="120"/> <Column ss:StyleID="s114" ss:Width="120"/>
<Column ss:StyleID="s114" ss:Width="127.8"/> <Column ss:StyleID="s114" ss:Width="127.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="74.400000000000006"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="74.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Event Code</Data><Comment <Cell ss:StyleID="s103"><Data ss:Type="String">Event Code</Data><Comment
ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font
@ -5904,7 +5898,7 @@
<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="41" x:FullColumns="1" <Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="41" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15">
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="114"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="114"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="281.39999999999998"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="281.25"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="252"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="252"/>
<Column ss:StyleID="s114" ss:Width="63"/> <Column ss:StyleID="s114" ss:Width="63"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
@ -6202,14 +6196,14 @@
ss:Hidden="1"/> ss:Hidden="1"/>
</Names> </Names>
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="41" x:FullColumns="1" <Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="41" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s139" ss:DefaultColumnWidth="260.39999999999998" x:FullRows="1" ss:StyleID="s139" ss:DefaultColumnWidth="260.25"
ss:DefaultRowHeight="15"> ss:DefaultRowHeight="15">
<Column ss:StyleID="s139" ss:Width="88.800000000000011"/> <Column ss:StyleID="s139" ss:Width="88.5"/>
<Column ss:StyleID="s139" ss:Width="28.8"/> <Column ss:StyleID="s139" ss:Width="28.5"/>
<Column ss:StyleID="s139" ss:Width="328.79999999999995"/> <Column ss:StyleID="s139" ss:Width="328.5"/>
<Column ss:StyleID="s139" ss:Width="57"/> <Column ss:StyleID="s139" ss:Width="57"/>
<Column ss:StyleID="s139" ss:Width="205.8" ss:Span="1"/> <Column ss:StyleID="s139" ss:Width="205.5" ss:Span="1"/>
<Column ss:Index="7" ss:StyleID="s139" ss:Width="40.799999999999997"/> <Column ss:Index="7" ss:StyleID="s139" ss:Width="40.5"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -6642,19 +6636,18 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="17" ss:ExpandedRowCount="29" x:FullColumns="1" <Table ss:ExpandedColumnCount="17" ss:ExpandedRowCount="29" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s114" ss:DefaultRowHeight="15">
<Column ss:StyleID="s114" ss:Width="115.80000000000001"/> <Column ss:StyleID="s114" ss:Width="115.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="274.8"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="274.5"/>
<Column ss:StyleID="s114" ss:Width="51"/> <Column ss:StyleID="s114" ss:Width="51"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="82.8"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="82.5"/>
<Column ss:StyleID="s114" ss:Width="255.6"/> <Column ss:StyleID="s114" ss:Width="255.75"/>
<Column ss:StyleID="s114" ss:Width="172.79999999999998"/> <Column ss:StyleID="s114" ss:Width="172.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="97.800000000000011"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="97.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="88.800000000000011"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="88.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="114"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="114"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="172.79999999999998"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="172.5"/>
<Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="166.8" ss:Span="1"/> <Column ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="166.5" ss:Span="1"/>
<Column ss:Index="13" ss:StyleID="s114" ss:AutoFitWidth="0" <Column ss:Index="13" ss:StyleID="s114" ss:AutoFitWidth="0" ss:Width="106.5"/>
ss:Width="106.80000000000001"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Binding Name</Data><Comment <Cell ss:StyleID="s103"><Data ss:Type="String">Binding Name</Data><Comment
ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font
@ -7131,7 +7124,6 @@
<HorizontalResolution>600</HorizontalResolution> <HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution> <VerticalResolution>600</VerticalResolution>
</Print> </Print>
<Selected/>
<FreezePanes/> <FreezePanes/>
<FrozenNoSplit/> <FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal> <SplitHorizontal>1</SplitHorizontal>
@ -7169,15 +7161,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="52" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="52" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15">
<Column ss:StyleID="s139" ss:Width="80.400000000000006"/> <Column ss:StyleID="s139" ss:Width="80.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.799999999999997"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.5"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.39999999999998"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.400000000000006" <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.25" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="244.5"/>
<Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0"
ss:Width="244.79999999999998"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/>
<Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.4"/> <Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -7810,15 +7800,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15">
<Column ss:StyleID="s139" ss:Width="80.400000000000006"/> <Column ss:StyleID="s139" ss:Width="80.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.799999999999997"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.5"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.39999999999998"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.400000000000006" <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.25" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="244.5"/>
<Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0"
ss:Width="244.79999999999998"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/>
<Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.4"/> <Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -8440,15 +8428,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="49" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="49" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15">
<Column ss:StyleID="s139" ss:Width="80.400000000000006"/> <Column ss:StyleID="s139" ss:Width="80.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.799999999999997"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.5"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.39999999999998"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.400000000000006" <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.25" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="244.5"/>
<Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0"
ss:Width="244.79999999999998"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/>
<Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.4"/> <Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -9048,15 +9034,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s139" ss:DefaultRowHeight="15">
<Column ss:StyleID="s139" ss:Width="80.400000000000006"/> <Column ss:StyleID="s139" ss:Width="80.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.799999999999997"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="34.5"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.39999999999998"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="155.25"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.400000000000006" <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="80.25" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="244.5"/>
<Column ss:Index="6" ss:StyleID="s139" ss:AutoFitWidth="0"
ss:Width="244.79999999999998"/>
<Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/> <Column ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/>
<Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.4"/> <Column ss:Index="9" ss:StyleID="s139" ss:AutoFitWidth="0" ss:Width="242.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s103"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"

View File

@ -10,17 +10,17 @@
<LastAuthor>Brian Postlethwaite</LastAuthor> <LastAuthor>Brian Postlethwaite</LastAuthor>
<Created>2012-03-19T11:12:07Z</Created> <Created>2012-03-19T11:12:07Z</Created>
<LastSaved>2016-03-28T03:43:31Z</LastSaved> <LastSaved>2016-03-28T03:43:31Z</LastSaved>
<Version>16.00</Version> <Version>14.00</Version>
</DocumentProperties> </DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/> <AllowPNG/>
</OfficeDocumentSettings> </OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>8880</WindowHeight> <WindowHeight>8880</WindowHeight>
<WindowWidth>22824</WindowWidth> <WindowWidth>22830</WindowWidth>
<WindowTopX>0</WindowTopX> <WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY> <WindowTopY>0</WindowTopY>
<ActiveSheet>8</ActiveSheet> <ActiveSheet>2</ActiveSheet>
<RefModeR1C1/> <RefModeR1C1/>
<ProtectStructure>False</ProtectStructure> <ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows> <ProtectWindows>False</ProtectWindows>
@ -841,30 +841,28 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="26" ss:ExpandedRowCount="100" x:FullColumns="1" <Table ss:ExpandedColumnCount="26" ss:ExpandedRowCount="100" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s68" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s68" ss:DefaultRowHeight="15">
<Column ss:StyleID="s69" ss:Width="227.39999999999998"/> <Column ss:StyleID="s69" ss:Width="227.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="77.399999999999991"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="77.25"/>
<Column ss:StyleID="s68" ss:Width="29.4"/> <Column ss:StyleID="s68" ss:Width="29.25"/>
<Column ss:StyleID="s68" ss:Width="34.799999999999997"/> <Column ss:StyleID="s68" ss:Width="34.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.4"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="28.8"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="28.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="27"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="27"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="106.80000000000001" <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="106.5" ss:Span="1"/>
ss:Span="1"/>
<Column ss:Index="10" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="81"/> <Column ss:Index="10" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="81"/>
<Column ss:StyleID="s68" ss:Width="52.8" ss:Span="1"/> <Column ss:StyleID="s68" ss:Width="52.5" ss:Span="1"/>
<Column ss:Index="13" ss:StyleID="s68" ss:AutoFitWidth="0" <Column ss:Index="13" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="80.25"/>
ss:Width="80.400000000000006"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="121.5"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="121.8"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="161.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="161.4"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="114"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="114"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="135"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="135"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="120"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="120"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="135"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="135"/>
<Column ss:Index="21" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="103.8" <Column ss:Index="21" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="103.5"
ss:Span="2"/> ss:Span="2"/>
<Column ss:Index="24" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="50.4"/> <Column ss:Index="24" ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="50.25"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="66"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="66"/>
<Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.4"/> <Column ss:StyleID="s68" ss:AutoFitWidth="0" ss:Width="119.25"/>
<Row ss:AutoFitHeight="0" ss:Height="45" ss:StyleID="s70"> <Row ss:AutoFitHeight="0" ss:Height="45" ss:StyleID="s70">
<Cell ss:StyleID="s71"><Data ss:Type="String">Element</Data><Comment <Cell ss:StyleID="s71"><Data ss:Type="String">Element</Data><Comment
ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font
@ -3887,13 +3885,12 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s101" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s101" ss:DefaultRowHeight="15">
<Column ss:Index="2" ss:StyleID="s101" ss:AutoFitWidth="0" <Column ss:Index="2" ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="115.5"/>
ss:Width="115.80000000000001"/> <Column ss:StyleID="s101" ss:Width="55.5"/>
<Column ss:StyleID="s101" ss:Width="55.800000000000004"/>
<Column ss:StyleID="s101" ss:Width="165"/> <Column ss:StyleID="s101" ss:Width="165"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="205.8"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="205.5"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="199.79999999999998"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="199.5"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="188.4"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="188.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s70"> <Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s70">
<Cell ss:StyleID="s102"><Data ss:Type="String">Id</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s102"><Data ss:Type="String">Id</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -3934,7 +3931,7 @@
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s82"><Data ss:Type="String">Either the participantType or actor must be specified</Data><NamedCell <Cell ss:StyleID="s82"><Data ss:Type="String">Either the participantType or actor must be specified</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s83"><Data ss:Type="String">participantType or actor</Data><NamedCell <Cell ss:StyleID="s83"><Data ss:Type="String">participantType.exists() or actor.exists()</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s106"><Data ss:Type="String">(exists(f:participantType) or exists(f:actor))</Data><NamedCell <Cell ss:StyleID="s106"><Data ss:Type="String">(exists(f:participantType) or exists(f:actor))</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
@ -4385,6 +4382,7 @@
<HorizontalResolution>600</HorizontalResolution> <HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution> <VerticalResolution>600</VerticalResolution>
</Print> </Print>
<Selected/>
<FreezePanes/> <FreezePanes/>
<FrozenNoSplit/> <FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal> <SplitHorizontal>1</SplitHorizontal>
@ -4404,8 +4402,7 @@
</Pane> </Pane>
<Pane> <Pane>
<Number>0</Number> <Number>0</Number>
<ActiveRow>2</ActiveRow> <ActiveCol>0</ActiveCol>
<ActiveCol>5</ActiveCol>
</Pane> </Pane>
</Panes> </Panes>
<ProtectObjects>False</ProtectObjects> <ProtectObjects>False</ProtectObjects>
@ -4421,11 +4418,11 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="34" x:FullColumns="1" <Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="34" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15">
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="70.8"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="70.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="57"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="57"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="109.8"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="109.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="210"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="210"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="382.79999999999995"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="382.5"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s113"> <Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s113">
<Cell ss:StyleID="s102"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s102"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40">Unique name for search parameter - required, lower-case, dash-delimited string </ss:Data></Comment><NamedCell xmlns="http://www.w3.org/TR/REC-html40">Unique name for search parameter - required, lower-case, dash-delimited string </ss:Data></Comment><NamedCell
@ -4716,15 +4713,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15">
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="130.80000000000001"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="130.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="124.80000000000001"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="124.5"/>
<Column ss:StyleID="s112" ss:Width="24"/> <Column ss:StyleID="s112" ss:Width="24"/>
<Column ss:StyleID="s112" ss:Width="25.8"/> <Column ss:StyleID="s112" ss:Width="25.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="106.80000000000001" <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="106.5" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="7" ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="223.5"/>
<Column ss:Index="7" ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="223.8"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="253.5" ss:Span="1"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="253.79999999999998"
ss:Span="1"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s124"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s124"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -5346,15 +5341,14 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="21" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="21" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15">
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="82.8" ss:Span="1"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="82.5" ss:Span="1"/>
<Column ss:Index="3" ss:StyleID="s112" ss:AutoFitWidth="0" <Column ss:Index="3" ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="199.5"/>
ss:Width="199.79999999999998"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="157.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="157.80000000000001"/> <Column ss:StyleID="s112" ss:Width="106.5"/>
<Column ss:StyleID="s112" ss:Width="106.80000000000001"/> <Column ss:StyleID="s112" ss:Width="113.25"/>
<Column ss:StyleID="s112" ss:Width="113.39999999999999"/>
<Column ss:StyleID="s112" ss:Width="120"/> <Column ss:StyleID="s112" ss:Width="120"/>
<Column ss:StyleID="s112" ss:Width="127.8"/> <Column ss:StyleID="s112" ss:Width="127.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="74.400000000000006"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="74.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s102"><Data ss:Type="String">Event Code</Data><Comment <Cell ss:StyleID="s102"><Data ss:Type="String">Event Code</Data><Comment
ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font
@ -5645,7 +5639,7 @@
<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="41" x:FullColumns="1" <Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="41" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15">
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="114"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="114"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="281.39999999999998"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="281.25"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="252"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="252"/>
<Column ss:StyleID="s112" ss:Width="63"/> <Column ss:StyleID="s112" ss:Width="63"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
@ -5943,14 +5937,14 @@
ss:Hidden="1"/> ss:Hidden="1"/>
</Names> </Names>
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="41" x:FullColumns="1" <Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="41" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s137" ss:DefaultColumnWidth="260.39999999999998" x:FullRows="1" ss:StyleID="s137" ss:DefaultColumnWidth="260.25"
ss:DefaultRowHeight="15"> ss:DefaultRowHeight="15">
<Column ss:StyleID="s137" ss:Width="88.800000000000011"/> <Column ss:StyleID="s137" ss:Width="88.5"/>
<Column ss:StyleID="s137" ss:Width="28.8"/> <Column ss:StyleID="s137" ss:Width="28.5"/>
<Column ss:StyleID="s137" ss:Width="328.79999999999995"/> <Column ss:StyleID="s137" ss:Width="328.5"/>
<Column ss:StyleID="s137" ss:Width="57"/> <Column ss:StyleID="s137" ss:Width="57"/>
<Column ss:StyleID="s137" ss:Width="205.8" ss:Span="1"/> <Column ss:StyleID="s137" ss:Width="205.5" ss:Span="1"/>
<Column ss:Index="7" ss:StyleID="s137" ss:Width="40.799999999999997"/> <Column ss:Index="7" ss:StyleID="s137" ss:Width="40.5"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s102"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s102"><Data ss:Type="String">Name</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -6382,19 +6376,18 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="13" ss:ExpandedRowCount="31" x:FullColumns="1" <Table ss:ExpandedColumnCount="13" ss:ExpandedRowCount="31" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s112" ss:DefaultRowHeight="15">
<Column ss:StyleID="s112" ss:Width="115.80000000000001"/> <Column ss:StyleID="s112" ss:Width="115.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="274.8"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="274.5"/>
<Column ss:StyleID="s112" ss:Width="51"/> <Column ss:StyleID="s112" ss:Width="51"/>
<Column ss:StyleID="s112" ss:Width="79.2"/> <Column ss:StyleID="s112" ss:Width="79.5"/>
<Column ss:StyleID="s112" ss:Width="255.6"/> <Column ss:StyleID="s112" ss:Width="255.75"/>
<Column ss:StyleID="s112" ss:Width="172.79999999999998"/> <Column ss:StyleID="s112" ss:Width="172.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="97.800000000000011"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="97.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="88.800000000000011"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="88.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="114"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="114"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="172.79999999999998"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="172.5"/>
<Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="166.8" ss:Span="1"/> <Column ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="166.5" ss:Span="1"/>
<Column ss:Index="13" ss:StyleID="s112" ss:AutoFitWidth="0" <Column ss:Index="13" ss:StyleID="s112" ss:AutoFitWidth="0" ss:Width="106.5"/>
ss:Width="106.80000000000001"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s102"><Data ss:Type="String">Binding Name</Data><Comment <Cell ss:StyleID="s102"><Data ss:Type="String">Binding Name</Data><Comment
ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font ss:Author=""><ss:Data xmlns="http://www.w3.org/TR/REC-html40"> <Font
@ -6898,7 +6891,6 @@
<HorizontalResolution>600</HorizontalResolution> <HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution> <VerticalResolution>600</VerticalResolution>
</Print> </Print>
<Selected/>
<FreezePanes/> <FreezePanes/>
<FrozenNoSplit/> <FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal> <SplitHorizontal>1</SplitHorizontal>
@ -6936,15 +6928,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s137" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s137" ss:DefaultRowHeight="15">
<Column ss:StyleID="s137" ss:Width="80.400000000000006"/> <Column ss:StyleID="s137" ss:Width="80.25"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="34.799999999999997"/> <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="34.5"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="155.39999999999998"/> <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="155.25"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="80.400000000000006" <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="80.25" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="6" ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="244.5"/>
<Column ss:Index="6" ss:StyleID="s137" ss:AutoFitWidth="0"
ss:Width="244.79999999999998"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/> <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/>
<Column ss:Index="9" ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="242.4"/> <Column ss:Index="9" ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="242.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s102"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s102"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"
@ -7566,15 +7556,13 @@
</Names> </Names>
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1" <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="51" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s137" ss:DefaultRowHeight="15"> x:FullRows="1" ss:StyleID="s137" ss:DefaultRowHeight="15">
<Column ss:StyleID="s137" ss:Width="80.400000000000006"/> <Column ss:StyleID="s137" ss:Width="80.25"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="34.799999999999997"/> <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="34.5"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="155.39999999999998"/> <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="155.25"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="80.400000000000006" <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="80.25" ss:Span="1"/>
ss:Span="1"/> <Column ss:Index="6" ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="244.5"/>
<Column ss:Index="6" ss:StyleID="s137" ss:AutoFitWidth="0"
ss:Width="244.79999999999998"/>
<Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/> <Column ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="84" ss:Span="1"/>
<Column ss:Index="9" ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="242.4"/> <Column ss:Index="9" ss:StyleID="s137" ss:AutoFitWidth="0" ss:Width="242.25"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75"> <Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s102"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s102"><Data ss:Type="String">Code</Data><Comment ss:Author=""><ss:Data
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma" xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Face="Tahoma"

View File

@ -20,7 +20,7 @@
<WindowWidth>28800</WindowWidth> <WindowWidth>28800</WindowWidth>
<WindowTopX>0</WindowTopX> <WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY> <WindowTopY>0</WindowTopY>
<ActiveSheet>1</ActiveSheet> <ActiveSheet>2</ActiveSheet>
<RefModeR1C1/> <RefModeR1C1/>
<ProtectStructure>False</ProtectStructure> <ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows> <ProtectWindows>False</ProtectWindows>
@ -4439,7 +4439,6 @@
<HorizontalResolution>600</HorizontalResolution> <HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution> <VerticalResolution>600</VerticalResolution>
</Print> </Print>
<Selected/>
<FreezePanes/> <FreezePanes/>
<FrozenNoSplit/> <FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal> <SplitHorizontal>1</SplitHorizontal>
@ -4482,7 +4481,7 @@
<Column ss:StyleID="s104" ss:Width="55.5"/> <Column ss:StyleID="s104" ss:Width="55.5"/>
<Column ss:StyleID="s104" ss:Width="165"/> <Column ss:StyleID="s104" ss:Width="165"/>
<Column ss:StyleID="s104" ss:AutoFitWidth="0" ss:Width="233.25"/> <Column ss:StyleID="s104" ss:AutoFitWidth="0" ss:Width="233.25"/>
<Column ss:StyleID="s104" ss:AutoFitWidth="0" ss:Width="108.75"/> <Column ss:StyleID="s104" ss:AutoFitWidth="0" ss:Width="192"/>
<Column ss:StyleID="s104" ss:AutoFitWidth="0" ss:Width="246.75"/> <Column ss:StyleID="s104" ss:AutoFitWidth="0" ss:Width="246.75"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s71"> <Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s71">
<Cell ss:StyleID="s105"><Data ss:Type="String">Id</Data><Comment ss:Author=""><ss:Data <Cell ss:StyleID="s105"><Data ss:Type="String">Id</Data><Comment ss:Author=""><ss:Data
@ -4536,7 +4535,7 @@
<Cell ss:StyleID="s92"/> <Cell ss:StyleID="s92"/>
<Cell ss:StyleID="s92"><Data ss:Type="String">AuditEvent.entity</Data></Cell> <Cell ss:StyleID="s92"><Data ss:Type="String">AuditEvent.entity</Data></Cell>
<Cell ss:StyleID="s92"><Data ss:Type="String">Either an identifier or a reference, (or both)</Data></Cell> <Cell ss:StyleID="s92"><Data ss:Type="String">Either an identifier or a reference, (or both)</Data></Cell>
<Cell ss:StyleID="s92"><Data ss:Type="String">identifier or reference</Data></Cell> <Cell ss:StyleID="s92"><Data ss:Type="String">identifier.exists() or reference.exists()</Data></Cell>
<Cell ss:StyleID="s111"><Data ss:Type="String">exists(f:identifier) or exists(f:reference)</Data></Cell> <Cell ss:StyleID="s111"><Data ss:Type="String">exists(f:identifier) or exists(f:reference)</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0"> <Row ss:AutoFitHeight="0">
@ -4546,7 +4545,7 @@
<Cell ss:StyleID="s92"/> <Cell ss:StyleID="s92"/>
<Cell ss:StyleID="s92"><Data ss:Type="String">AuditEvent.agent</Data></Cell> <Cell ss:StyleID="s92"><Data ss:Type="String">AuditEvent.agent</Data></Cell>
<Cell ss:StyleID="s92"><Data ss:Type="String">Either a userId or a reference, (or both)</Data></Cell> <Cell ss:StyleID="s92"><Data ss:Type="String">Either a userId or a reference, (or both)</Data></Cell>
<Cell ss:StyleID="s92"><Data ss:Type="String">userId or reference</Data></Cell> <Cell ss:StyleID="s92"><Data ss:Type="String">userId.exists() or reference.exists()</Data></Cell>
<Cell ss:StyleID="s111"><Data ss:Type="String">exists(f:userId) or exists(f:reference)</Data></Cell> <Cell ss:StyleID="s111"><Data ss:Type="String">exists(f:userId) or exists(f:reference)</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0"> <Row ss:AutoFitHeight="0">
@ -4977,6 +4976,7 @@
<HorizontalResolution>600</HorizontalResolution> <HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution> <VerticalResolution>600</VerticalResolution>
</Print> </Print>
<Selected/>
<FreezePanes/> <FreezePanes/>
<FrozenNoSplit/> <FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal> <SplitHorizontal>1</SplitHorizontal>
@ -4996,8 +4996,7 @@
</Pane> </Pane>
<Pane> <Pane>
<Number>0</Number> <Number>0</Number>
<ActiveRow>3</ActiveRow> <ActiveCol>0</ActiveCol>
<ActiveCol>1</ActiveCol>
</Pane> </Pane>
</Panes> </Panes>
<ProtectObjects>False</ProtectObjects> <ProtectObjects>False</ProtectObjects>

File diff suppressed because it is too large Load Diff

View File

@ -10,14 +10,14 @@
<LastAuthor>Lloyd</LastAuthor> <LastAuthor>Lloyd</LastAuthor>
<Created>2012-03-19T11:12:07Z</Created> <Created>2012-03-19T11:12:07Z</Created>
<LastSaved>2015-09-14T23:59:23Z</LastSaved> <LastSaved>2015-09-14T23:59:23Z</LastSaved>
<Version>16.00</Version> <Version>14.00</Version>
</DocumentProperties> </DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/> <AllowPNG/>
</OfficeDocumentSettings> </OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>6900</WindowHeight> <WindowHeight>4980</WindowHeight>
<WindowWidth>2910</WindowWidth> <WindowWidth>7470</WindowWidth>
<WindowTopX>0</WindowTopX> <WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY> <WindowTopY>0</WindowTopY>
<ActiveSheet>2</ActiveSheet> <ActiveSheet>2</ActiveSheet>
@ -3942,8 +3942,8 @@
<Column ss:StyleID="s101" ss:Width="55.5"/> <Column ss:StyleID="s101" ss:Width="55.5"/>
<Column ss:StyleID="s101" ss:Width="165"/> <Column ss:StyleID="s101" ss:Width="165"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="204.75"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="204.75"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="198.75"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="297"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="188.25"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="266.25"/>
<Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="260.25"/> <Column ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="260.25"/>
<Column ss:Index="11" ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="216.75"/> <Column ss:Index="11" ss:StyleID="s101" ss:AutoFitWidth="0" ss:Width="216.75"/>
<Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s70"> <Row ss:AutoFitHeight="0" ss:Height="15.75" ss:StyleID="s70">
@ -4023,8 +4023,8 @@
<Cell ss:StyleID="s90"><Data ss:Type="String">error</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">error</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">Bundle.entry</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Bundle.entry</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">must be a resource unless there's a request or response</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">must be a resource unless there's a request or response</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">resource or request or response</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">resource.exists() or request.exists() or response.exists()</Data></Cell>
<Cell ss:StyleID="s106"><Data ss:Type="String">f:resource or f:request or f:response</Data></Cell> <Cell ss:StyleID="s106"><Data ss:Type="String">exists(f:resource) or exists(f:request) or exists(f:response)</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0" ss:Height="60"> <Row ss:AutoFitHeight="0" ss:Height="60">
<Cell ss:StyleID="s105"><Data ss:Type="Number">6</Data><NamedCell <Cell ss:StyleID="s105"><Data ss:Type="Number">6</Data><NamedCell
@ -4033,7 +4033,7 @@
<Cell ss:StyleID="s90"><Data ss:Type="String">error</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">error</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">Bundle.entry</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Bundle.entry</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">The fullUrl element must be present when a resource is present, and not present otherwise</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">The fullUrl element must be present when a resource is present, and not present otherwise</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">fullUrl.empty() xor resource</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">fullUrl.empty() xor resource.exists()</Data></Cell>
<Cell ss:StyleID="s106"><Data ss:Type="String">(not(exists(f:fullUrl)) and not(exists(f:resource))) or (exists(f:fullUrl) and exists(f:resource))</Data></Cell> <Cell ss:StyleID="s106"><Data ss:Type="String">(not(exists(f:fullUrl)) and not(exists(f:resource))) or (exists(f:fullUrl) and exists(f:resource))</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0" ss:Height="180"> <Row ss:AutoFitHeight="0" ss:Height="180">
@ -4043,7 +4043,7 @@
<Cell ss:StyleID="s90"><Data ss:Type="String">error</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">error</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">Bundle</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">Bundle</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">FullUrl must be unique in a bundle, or else entries with the same fullUrl must have different meta.versionId</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">FullUrl must be unique in a bundle, or else entries with the same fullUrl must have different meta.versionId</Data></Cell>
<Cell ss:StyleID="s90"><Data ss:Type="String">entry.where(fullUrl).select(fullUrl+resource.meta.versionId).distinct()</Data></Cell> <Cell ss:StyleID="s90"><Data ss:Type="String">entry.where(fullUrl).select(fullUrl&amp;resource.meta.versionId).isDistinct()</Data></Cell>
<Cell ss:StyleID="s107"><Data ss:Type="String">count(for $entry in f:entry[f:resource] return $entry[count(parent::f:Bundle/f:entry[f:fullUrl/@value=$entry/f:fullUrl/@value and ((not(f:resource/*/f:meta/f:versionId/@value) and not($entry/f:resource/*/f:meta/f:versionId/@value)) or f:resource/*/f:meta/f:versionId/@value=$entry/f:resource/*/f:meta/f:versionId/@value)])!=1])=0</Data></Cell> <Cell ss:StyleID="s107"><Data ss:Type="String">count(for $entry in f:entry[f:resource] return $entry[count(parent::f:Bundle/f:entry[f:fullUrl/@value=$entry/f:fullUrl/@value and ((not(f:resource/*/f:meta/f:versionId/@value) and not($entry/f:resource/*/f:meta/f:versionId/@value)) or f:resource/*/f:meta/f:versionId/@value=$entry/f:resource/*/f:meta/f:versionId/@value)])!=1])=0</Data></Cell>
</Row> </Row>
<Row ss:AutoFitHeight="0"> <Row ss:AutoFitHeight="0">
@ -4395,8 +4395,7 @@
</Pane> </Pane>
<Pane> <Pane>
<Number>0</Number> <Number>0</Number>
<ActiveRow>7</ActiveRow> <ActiveCol>0</ActiveCol>
<ActiveCol>5</ActiveCol>
</Pane> </Pane>
</Panes> </Panes>
<ProtectObjects>False</ProtectObjects> <ProtectObjects>False</ProtectObjects>

Some files were not shown because too many files have changed in this diff Show More