work on getting validation tests to pass

This commit is contained in:
Grahame Grieve 2019-01-29 08:34:34 +11:00
parent 61f338991d
commit 9e583e8e35
158 changed files with 43724 additions and 179 deletions

View File

@ -122,6 +122,31 @@ import org.hl7.fhir.utilities.xml.SchematronWriter.Section;
*/
public class ProfileUtilities extends TranslatingUtilities {
public class ElementRedirection {
private String path;
private ElementDefinition element;
public ElementRedirection(ElementDefinition element, String path) {
this.path = path;
this.element = element;
}
public ElementDefinition getElement() {
return element;
}
@Override
public String toString() {
return element.toString() + " : "+path;
}
public String getPath() {
return path;
}
}
private static int nextSliceId = 0;
private static final int MAX_RECURSION_LIMIT = 10;
@ -390,7 +415,7 @@ public class ProfileUtilities extends TranslatingUtilities {
// we actually delegate the work to a subroutine so we can re-enter it with a different cursors
processPaths("", derived.getSnapshot(), base.getSnapshot(), derived.getDifferential(), baseCursor, diffCursor, base.getSnapshot().getElement().size()-1,
derived.getDifferential().hasElement() ? derived.getDifferential().getElement().size()-1 : -1, url, derived.getId(), null, null, false, base.getUrl(), null, false, null);
derived.getDifferential().hasElement() ? derived.getDifferential().getElement().size()-1 : -1, url, derived.getId(), null, null, false, base.getUrl(), null, false, new ArrayList<ElementRedirection>());
if (!derived.getSnapshot().getElementFirstRep().getType().isEmpty())
throw new Error("type on first snapshot element for "+derived.getSnapshot().getElementFirstRep().getPath()+" in "+derived.getUrl()+" from "+base.getUrl());
updateMaps(base, derived);
@ -506,9 +531,9 @@ public class ProfileUtilities extends TranslatingUtilities {
* @throws Exception
*/
private ElementDefinition processPaths(String indent, StructureDefinitionSnapshotComponent result, StructureDefinitionSnapshotComponent base, StructureDefinitionDifferentialComponent differential, int baseCursor, int diffCursor, int baseLimit,
int diffLimit, String url, String profileName, String contextPathSrc, String contextPathDst, boolean trimDifferential, String contextName, String resultPathBase, boolean slicingDone, ElementDefinition redirector) throws DefinitionException, FHIRException {
int diffLimit, String url, String profileName, String contextPathSrc, String contextPathDst, boolean trimDifferential, String contextName, String resultPathBase, boolean slicingDone, List<ElementRedirection> redirector) throws DefinitionException, FHIRException {
if (DEBUG)
System.out.println(indent+"PP @ "+resultPathBase+": base = "+baseCursor+" to "+baseLimit+", diff = "+diffCursor+" to "+diffLimit+" (slicing = "+slicingDone+")");
System.out.println(indent+"PP @ "+resultPathBase+" / "+contextPathSrc+" : base = "+baseCursor+" to "+baseLimit+", diff = "+diffCursor+" to "+diffLimit+" (slicing = "+slicingDone+", redirector = "+(redirector == null ? "null" : redirector.toString())+")");
ElementDefinition res = null;
// just repeat processing entries until we run out of our allowed scope (1st entry, the allowed scope is all the entries)
while (baseCursor <= baseLimit) {
@ -548,7 +573,7 @@ public class ProfileUtilities extends TranslatingUtilities {
while (differential.getElement().size() > diffCursor && pathStartsWith(differential.getElement().get(diffCursor).getPath(), cpath+"."))
diffCursor++;
processPaths(indent+" ", result, dt.getSnapshot(), differential, 1 /* starting again on the data type, but skip the root */, start, dt.getSnapshot().getElement().size()-1,
diffCursor-1, url, profileName, cpath, outcome.getPath(), trimDifferential, contextName, resultPathBase, false, null);
diffCursor-1, url, profileName, cpath, outcome.getPath(), trimDifferential, contextName, resultPathBase, false, redirector);
}
baseCursor++;
} else if (diffMatches.size() == 1 && (slicingDone || !(diffMatches.get(0).hasSlicing() || (isExtension(diffMatches.get(0)) && diffMatches.get(0).hasSliceName())))) {// one matching element in the differential
@ -641,17 +666,41 @@ public class ProfileUtilities extends TranslatingUtilities {
int nbl = nbc;
while (nbl < base.getElement().size() && base.getElement().get(nbl).getPath().startsWith(tgt.getPath()+"."))
nbl++;
processPaths(indent+" ", result, base, differential, nbc, start - 1, nbl-1, diffCursor - 1, url, profileName, tgt.getPath(), diffMatches.get(0).getPath(), trimDifferential, contextName, resultPathBase, false, outcome);
processPaths(indent+" ", result, base, differential, nbc, start - 1, nbl-1, diffCursor - 1, url, profileName, tgt.getPath(), diffMatches.get(0).getPath(), trimDifferential, contextName, resultPathBase, false, redirectorStack(redirector, outcome, cpath));
} else {
StructureDefinition dt = getProfileForDataType(outcome.getType().get(0));
if (dt == null)
throw new DefinitionException(diffMatches.get(0).getPath()+" has children ("+differential.getElement().get(diffCursor).getPath()+") for type "+typeCode(outcome.getType())+" in profile "+profileName+", but can't find type");
contextName = dt.getUrl();
processPaths(indent+" ", result, dt.getSnapshot(), differential, 1 /* starting again on the data type, but skip the root */, start, dt.getSnapshot().getElement().size()-1,
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), diffMatches.get(0).getPath(), outcome.getPath(), trimDifferential, contextName, resultPathBase, false, null);
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), diffMatches.get(0).getPath(), outcome.getPath(), trimDifferential, contextName, resultPathBase, false, new ArrayList<ElementRedirection>());
}
}
}
} else if (diffsConstrainTypes(diffMatches)) {
// throw new Error("Not done yet @ "+cpath);
// copy the root diff, and then process any children it has
int start = 0;
int nbl = findEndOfElement(base, baseCursor);
int ndc = differential.getElement().indexOf(diffMatches.get(0));
int ndl = findEndOfElement(differential, ndc);
ElementDefinition e = processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, 0), contextPathSrc, contextPathDst,
trimDifferential, contextName, resultPathBase, true, redirector);
if (e==null)
throw new FHIRException("Did not find type root: " + diffMatches.get(0).getPath());
start++;
// now process the siblings, which should each be type constrained - and may also have their own children
// now we process the base scope repeatedly for each instance of the item in the differential list
for (int i = start; i < diffMatches.size(); i++) {
// our processing scope for the differential is the item in the list, and all the items before the next one in the list
ndc = differential.getElement().indexOf(diffMatches.get(i));
ndl = findEndOfElement(differential, ndc);
processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, i), contextPathSrc, contextPathDst, trimDifferential, contextName, resultPathBase, true, redirector);
}
// ok, done with that - next in the base list
baseCursor = nbl+1;
diffCursor = ndl+1;
} else {
// ok, the differential slices the item. Let's check our pre-conditions to ensure that this is correct
if (!unbounded(currentBase) && !isSlicedToOneOnly(diffMatches.get(0)))
@ -668,7 +717,8 @@ public class ProfileUtilities extends TranslatingUtilities {
if (diffMatches.size() > 1 && diffMatches.get(0).hasSlicing() && (nbl > baseCursor || differential.getElement().indexOf(diffMatches.get(1)) > differential.getElement().indexOf(diffMatches.get(0))+1)) { // there's a default set before the slices
int ndc = differential.getElement().indexOf(diffMatches.get(0));
int ndl = findEndOfElement(differential, ndc);
ElementDefinition e = processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, 0), contextPathSrc, contextPathDst, trimDifferential, contextName, resultPathBase, true, null);
ElementDefinition e = processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, 0), contextPathSrc, contextPathDst,
trimDifferential, contextName, resultPathBase, true, redirector);
if (e==null)
throw new FHIRException("Did not find single slice: " + diffMatches.get(0).getPath());
e.setSlicing(diffMatches.get(0).getSlicing());
@ -805,7 +855,7 @@ public class ProfileUtilities extends TranslatingUtilities {
int ndc = differential.getElement().indexOf(diffMatches.get(diffpos));
int ndl = findEndOfElement(differential, ndc);
// now we process the base scope repeatedly for each instance of the item in the differential list
processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, diffpos), contextPathSrc, contextPathDst, closed, contextName, resultPathBase, true, null);
processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, diffpos), contextPathSrc, contextPathDst, closed, contextName, resultPathBase, true, redirector);
// ok, done with that - now set the cursors for if this is the end
baseCursor = nbl;
diffCursor = ndl+1;
@ -867,7 +917,7 @@ public class ProfileUtilities extends TranslatingUtilities {
while (differential.getElement().size() > diffCursor && pathStartsWith(differential.getElement().get(diffCursor).getPath(), diffMatches.get(0).getPath()+"."))
diffCursor++;
processPaths(indent+" ", result, base, differential, baseStart, start-1, baseMax-1,
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), base.getElement().get(0).getPath(), base.getElement().get(0).getPath(), trimDifferential, contextName, resultPathBase, false, null);
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), base.getElement().get(0).getPath(), base.getElement().get(0).getPath(), trimDifferential, contextName, resultPathBase, false, redirector);
} else {
StructureDefinition dt = getProfileForDataType(outcome.getType().get(0));
@ -881,7 +931,7 @@ public class ProfileUtilities extends TranslatingUtilities {
while (differential.getElement().size() > diffCursor && pathStartsWith(differential.getElement().get(diffCursor).getPath(), diffMatches.get(0).getPath()+"."))
diffCursor++;
processPaths(indent+" ", result, dt.getSnapshot(), differential, 1 /* starting again on the data type, but skip the root */, start-1, dt.getSnapshot().getElement().size()-1,
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), diffMatches.get(0).getPath(), outcome.getPath(), trimDifferential, contextName, resultPathBase, false, null);
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), diffMatches.get(0).getPath(), outcome.getPath(), trimDifferential, contextName, resultPathBase, false, redirector);
}
} else if (outcome.getType().get(0).getCode().equals("Extension")) {
// Force URL to appear if we're dealing with an extension. (This is a kludge - may need to drill down in other cases where we're slicing and the type has a profile declaration that could be setting the fixed value)
@ -890,7 +940,7 @@ public class ProfileUtilities extends TranslatingUtilities {
// We only want the children that aren't the root
if (extEd.getPath().contains(".")) {
ElementDefinition extUrlEd = updateURLs(url, extEd.copy());
extUrlEd.setPath(fixedPathDest(outcome.getPath(), extUrlEd.getPath(), null, null));
extUrlEd.setPath(fixedPathDest(outcome.getPath(), extUrlEd.getPath(), redirector, null));
// updateFromBase(extUrlEd, currentBase);
markDerived(extUrlEd);
result.getElement().add(extUrlEd);
@ -918,6 +968,29 @@ public class ProfileUtilities extends TranslatingUtilities {
}
private boolean diffsConstrainTypes(List<ElementDefinition> diffMatches) {
if (diffMatches.size() < 2)
return false;
String p = diffMatches.get(0).getPath();
if (!p.endsWith("[x]"))
return false;
p = p.substring(0, p.length()-3);
for (int i = 1; i < diffMatches.size(); i++) {
if (!diffMatches.get(i).getPath().startsWith(p))
return false;
}
return true;
}
private List<ElementRedirection> redirectorStack(List<ElementRedirection> redirector, ElementDefinition outcome, String path) {
List<ElementRedirection> result = new ArrayList<ElementRedirection>();
result.addAll(redirector);
result.add(new ElementRedirection(outcome, path));
return result;
}
private List<TypeRefComponent> getByTypeName(List<TypeRefComponent> type, String t) {
List<TypeRefComponent> res = new ArrayList<TypeRefComponent>();
for (TypeRefComponent tr : type) {
@ -1076,13 +1149,13 @@ public class ProfileUtilities extends TranslatingUtilities {
}
private String fixedPathSource(String contextPath, String pathSimple, ElementDefinition redirector) {
private String fixedPathSource(String contextPath, String pathSimple, List<ElementRedirection> redirector) {
if (contextPath == null)
return pathSimple;
// String ptail = pathSimple.substring(contextPath.length() + 1);
if (redirector != null) {
if (redirector.size() > 0) {
String ptail = pathSimple.substring(contextPath.length()+1);
return redirector.getPath()+"."+ptail;
return redirector.get(redirector.size()-1).getPath()+"."+ptail;
// return contextPath+"."+tail(redirector.getPath())+"."+ptail.substring(ptail.indexOf(".")+1);
} else {
String ptail = pathSimple.substring(pathSimple.indexOf(".")+1);
@ -1090,12 +1163,12 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
private String fixedPathDest(String contextPath, String pathSimple, ElementDefinition redirector, String redirectSource) {
private String fixedPathDest(String contextPath, String pathSimple, List<ElementRedirection> redirector, String redirectSource) {
String s;
if (contextPath == null)
s = pathSimple;
else {
if (redirector != null) {
if (redirector.size() > 0) {
String ptail = pathSimple.substring(redirectSource.length() + 1);
// ptail = ptail.substring(ptail.indexOf(".")+1);
s = contextPath+"."+/*tail(redirector.getPath())+"."+*/ptail;

View File

@ -143,7 +143,7 @@ private Map<String, Object> userData;
return false;
}
public Date dateTimeValue() {
public BaseDateTimeType dateTimeValue() {
return null;
}

View File

@ -852,8 +852,12 @@ public abstract class BaseDateTimeType extends PrimitiveType<Date> {
}
@Override
public Date dateTimeValue() {
return getValue();
public BaseDateTimeType dateTimeValue() {
return this;
}
public boolean hasTime() {
return (myPrecision == TemporalPrecisionEnum.MINUTE || myPrecision == TemporalPrecisionEnum.SECOND || myPrecision == TemporalPrecisionEnum.MILLI);
}

View File

@ -9,6 +9,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import org.apache.commons.lang3.NotImplementedException;
import org.fhir.ucum.Decimal;
@ -20,6 +21,7 @@ import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.r4.conformance.ProfileUtilities;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.model.Base;
import org.hl7.fhir.r4.model.BaseDateTimeType;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.DateTimeType;
import org.hl7.fhir.r4.model.DateType;
@ -72,7 +74,6 @@ import org.hl7.fhir.utilities.Utilities;
//import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.util.ElementUtil;
import net.sf.saxon.om.Item;
/**
*
@ -80,6 +81,8 @@ import net.sf.saxon.om.Item;
*
*/
public class FHIRPathEngine {
private enum Equality { Null, True, False }
private class FHIRConstant extends Base {
private static final long serialVersionUID = -8933773658248269439L;
@ -1192,7 +1195,7 @@ public class FHIRPathEngine {
}
private List<Base> preOperate(List<Base> left, Operation operation) {
private List<Base> preOperate(List<Base> left, Operation operation) throws PathEngineException {
if (left.size() == 0)
return null;
switch (operation) {
@ -1201,7 +1204,8 @@ public class FHIRPathEngine {
case Or:
return isBoolean(left, true) ? makeBoolean(true) : null;
case Implies:
return convertToBoolean(left) ? null : makeBoolean(true);
Equality v = asBool(left);
return v == Equality.False ? null : makeBoolean(true);
default:
return null;
}
@ -1213,6 +1217,11 @@ public class FHIRPathEngine {
return res;
}
private List<Base> makeNull() {
List<Base> res = new ArrayList<Base>();
return res;
}
private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
return new TypeDetails(CollectionStatus.SINGLETON, exp.getName());
}
@ -1521,13 +1530,22 @@ public class FHIRPathEngine {
return makeBoolean(false);
boolean res = true;
boolean nil = false;
for (int i = 0; i < left.size(); i++) {
if (!doEquals(left.get(i), right.get(i))) {
Boolean eq = doEquals(left.get(i), right.get(i));
if (eq == null)
nil = true;
else if (eq == false) {
res = false;
break;
}
}
return makeBoolean(res);
if (!res)
return makeBoolean(res);
else if (nil)
return new ArrayList<Base>();
else
return makeBoolean(res);
}
private List<Base> opNotEquals(List<Base> left, List<Base> right) {
@ -1538,13 +1556,22 @@ public class FHIRPathEngine {
return makeBoolean(true);
boolean res = true;
boolean nil = false;
for (int i = 0; i < left.size(); i++) {
if (!doEquals(left.get(i), right.get(i))) {
Boolean eq = doEquals(left.get(i), right.get(i));
if (eq == null)
nil = true;
else if (eq == true) {
res = false;
break;
}
}
return makeBoolean(!res);
if (!res)
return makeBoolean(res);
else if (nil)
return new ArrayList<Base>();
else
return makeBoolean(res);
}
private String removeTrailingZeros(String s) {
@ -1572,12 +1599,24 @@ public class FHIRPathEngine {
return left.equals(right);
}
private boolean doEquals(Base left, Base right) {
private Boolean compareDates(BaseDateTimeType left, BaseDateTimeType right) {
// HumanDateTime l = HumanDateTime.fromXml(left.primitiveValue());
// HumanDateTime r = HumanDateTime.fromXml(right.primitiveValue());
// if (!l.overlaps(r))
// return false;
// else if (!l.canCompare(r))
// return null;
// else
// return l.sameTime(r);
return false;
}
private Boolean doEquals(Base left, Base right) {
if (left instanceof Quantity && right instanceof Quantity)
return qtyEqual((Quantity) left, (Quantity) right);
else if (left.isDateTime() && right.isDateTime())
return left.dateTimeValue().equals(right.dateTimeValue());
else if (left instanceof DecimalType || right instanceof DecimalType)
else if (left.isDateTime() && right.isDateTime()) {
return compareDates(left.dateTimeValue(), right.dateTimeValue());
} else if (left instanceof DecimalType || right instanceof DecimalType)
return decEqual(left.primitiveValue(), right.primitiveValue());
else if (left.isPrimitive() && right.isPrimitive())
return Base.equals(left.primitiveValue(), right.primitiveValue());
@ -1654,8 +1693,6 @@ public class FHIRPathEngine {
private List<Base> opEquivalent(List<Base> left, List<Base> right) throws PathEngineException {
if (left.size() == 0 || right.size() == 0)
return new ArrayList<Base>();
if (left.size() != right.size())
return makeBoolean(false);
@ -1677,8 +1714,6 @@ public class FHIRPathEngine {
}
private List<Base> opNotEquivalent(List<Base> left, List<Base> right) throws PathEngineException {
if (left.size() == 0 || right.size() == 0)
return new ArrayList<Base>();
if (left.size() != right.size())
return makeBoolean(true);
@ -1874,11 +1909,13 @@ public class FHIRPathEngine {
boolean ans = true;
for (Base l : left) {
boolean f = false;
for (Base r : right)
if (doEquals(l, r)) {
for (Base r : right) {
Boolean eq = doEquals(l, r);
if (eq != null && eq == true) {
f = true;
break;
}
}
if (!f) {
ans = false;
break;
@ -1893,11 +1930,13 @@ public class FHIRPathEngine {
boolean ans = true;
for (Base r : right) {
boolean f = false;
for (Base l : left)
if (doEquals(l, r)) {
for (Base l : left) {
Boolean eq = doEquals(l, r);
if (eq != null && eq == true) {
f = true;
break;
}
}
if (!f) {
ans = false;
break;
@ -1969,21 +2008,19 @@ public class FHIRPathEngine {
private List<Base> opConcatenate(List<Base> left, List<Base> right) throws PathEngineException {
if (left.size() == 0 || right.size() == 0)
return new ArrayList<Base>();
if (left.size() > 1)
throw new PathEngineException("Error performing &: left operand has more than one value");
if (!left.get(0).hasType(FHIR_TYPES_STRING))
if (left.size() > 0 && !left.get(0).hasType(FHIR_TYPES_STRING))
throw new PathEngineException(String.format("Error performing &: left operand has the wrong type (%s)", left.get(0).fhirType()));
if (right.size() > 1)
throw new PathEngineException("Error performing &: right operand has more than one value");
if (!right.get(0).hasType(FHIR_TYPES_STRING))
if (right.size() > 0 && !right.get(0).hasType(FHIR_TYPES_STRING))
throw new PathEngineException(String.format("Error performing &: right operand has the wrong type (%s)", right.get(0).fhirType()));
List<Base> result = new ArrayList<Base>();
Base l = left.get(0);
Base r = right.get(0);
result.add(new StringType(l.primitiveValue() + r.primitiveValue()));
String l = left.size() == 0 ? "" : left.get(0).primitiveValue();
String r = right.size() == 0 ? "" : right.get(0).primitiveValue();
result.add(new StringType(l + r));
return result;
}
@ -2001,57 +2038,93 @@ public class FHIRPathEngine {
}
private boolean doContains(List<Base> list, Base item) {
for (Base test : list)
if (doEquals(test, item))
for (Base test : list) {
Boolean eq = doEquals(test, item);
if (eq != null && eq == true)
return true;
}
return false;
}
private List<Base> opAnd(List<Base> left, List<Base> right) {
if (left.isEmpty() && right.isEmpty())
return new ArrayList<Base>();
else if (isBoolean(left, false) || isBoolean(right, false))
return makeBoolean(false);
else if (left.isEmpty() || right.isEmpty())
return new ArrayList<Base>();
else if (convertToBoolean(left) && convertToBoolean(right))
return makeBoolean(true);
else
return makeBoolean(false);
private List<Base> opAnd(List<Base> left, List<Base> right) throws PathEngineException {
Equality l = asBool(left);
Equality r = asBool(right);
switch (l) {
case False: return makeBoolean(false);
case Null:
if (r == Equality.False)
return makeBoolean(false);
else
return makeNull();
case True:
switch (r) {
case False: return makeBoolean(false);
case Null: return makeNull();
case True: return makeBoolean(true);
}
}
return makeNull();
}
private boolean isBoolean(List<Base> list, boolean b) {
return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b;
}
private List<Base> opOr(List<Base> left, List<Base> right) {
if (left.isEmpty() && right.isEmpty())
return new ArrayList<Base>();
else if (convertToBoolean(left) || convertToBoolean(right))
return makeBoolean(true);
else if (left.isEmpty() || right.isEmpty())
return new ArrayList<Base>();
else
return makeBoolean(false);
private List<Base> opOr(List<Base> left, List<Base> right) throws PathEngineException {
Equality l = asBool(left);
Equality r = asBool(right);
switch (l) {
case True: return makeBoolean(true);
case Null:
if (r == Equality.True)
return makeBoolean(true);
else
return makeNull();
case False:
switch (r) {
case False: return makeBoolean(false);
case Null: return makeNull();
case True: return makeBoolean(true);
}
}
return makeNull();
}
private List<Base> opXor(List<Base> left, List<Base> right) {
if (left.isEmpty() || right.isEmpty())
return new ArrayList<Base>();
else
return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right));
private List<Base> opXor(List<Base> left, List<Base> right) throws PathEngineException {
Equality l = asBool(left);
Equality r = asBool(right);
switch (l) {
case True:
switch (r) {
case False: return makeBoolean(true);
case True: return makeBoolean(false);
case Null: return makeNull();
}
case Null:
return makeNull();
case False:
switch (r) {
case False: return makeBoolean(false);
case True: return makeBoolean(true);
case Null: return makeNull();
}
}
return makeNull();
}
private List<Base> opImplies(List<Base> left, List<Base> right) {
if (left.size() == 0)
return new ArrayList<Base>();
else if (!convertToBoolean(left))
private List<Base> opImplies(List<Base> left, List<Base> right) throws PathEngineException {
Equality eq = asBool(left);
if (eq == Equality.False)
return makeBoolean(true);
else if (right.size() == 0)
return new ArrayList<Base>();
else
return makeBoolean(convertToBoolean(right));
return makeNull();
else switch (asBool(right)) {
case False: return makeBoolean(false);
case Null: return makeNull();
case True: return makeBoolean(true);
}
return makeNull();
}
@ -2715,39 +2788,34 @@ public class FHIRPathEngine {
return makeBoolean(true);
}
private List<Base> funcAll(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
List<Base> result = new ArrayList<Base>();
if (exp.getParameters().size() == 1) {
List<Base> result = new ArrayList<Base>();
List<Base> pc = new ArrayList<Base>();
boolean all = true;
for (Base item : focus) {
pc.clear();
pc.add(item);
if (!convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true))) {
Equality eq = asBool(execute(changeThis(context, item), pc, exp.getParameters().get(0), true));
if (eq != Equality.True) {
all = false;
break;
}
}
result.add(new BooleanType(all).noExtensions());
return result;
} else {// (exp.getParameters().size() == 0) {
List<Base> result = new ArrayList<Base>();
boolean all = true;
for (Base item : focus) {
boolean v = false;
if (item instanceof BooleanType) {
v = ((BooleanType) item).booleanValue();
} else
v = item != null;
if (!v) {
Equality eq = asBool(item);
if (eq != Equality.True) {
all = false;
break;
}
}
result.add(new BooleanType(all).noExtensions());
return result;
}
return result;
}
@ -2949,9 +3017,9 @@ public class FHIRPathEngine {
private List<Base> funcIif(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
List<Base> n1 = execute(context, focus, exp.getParameters().get(0), true);
Boolean v = convertToBoolean(n1);
Equality v = asBool(n1);
if (v)
if (v == Equality.True)
return execute(context, focus, exp.getParameters().get(1), true);
else if (exp.getParameters().size() < 3)
return new ArrayList<Base>();
@ -3129,13 +3197,18 @@ public class FHIRPathEngine {
private List<Base> funcIsDistinct(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
if (focus.size() <= 1)
if (focus.size() < 1)
return new ArrayList<Base>();
if (focus.size() == 1)
return makeBoolean(true);
boolean distinct = true;
for (int i = 0; i < focus.size(); i++) {
for (int j = i+1; j < focus.size(); j++) {
if (doEquals(focus.get(j), focus.get(i))) {
Boolean eq = doEquals(focus.get(j), focus.get(i));
if (eq == null) {
return new ArrayList<Base>();
} else if (eq == true) {
distinct = false;
break;
}
@ -3265,7 +3338,8 @@ public class FHIRPathEngine {
pc.clear();
pc.add(item);
List<Base> res = execute(context, pc, exp.getParameters().get(0), true);
if (convertToBoolean(res)) {
Equality v = asBool(res);
if (v != Equality.False) {
all = false;
break;
}
@ -3274,12 +3348,8 @@ public class FHIRPathEngine {
} else {
boolean all = true;
for (Base item : focus) {
boolean v;
if (item instanceof BooleanType)
v = ((BooleanType) item).booleanValue();
else
v = item != null;
if (v) {
Equality v = asBool(item);
if (v != Equality.False) {
all = false;
break;
}
@ -3298,7 +3368,8 @@ public class FHIRPathEngine {
pc.clear();
pc.add(item);
List<Base> res = execute(context, pc, exp.getParameters().get(0), true);
if (!convertToBoolean(res)) {
Equality v = asBool(res);
if (v == Equality.False) {
any = true;
break;
}
@ -3307,12 +3378,8 @@ public class FHIRPathEngine {
} else {
boolean any = false;
for (Base item : focus) {
boolean v;
if (item instanceof BooleanType)
v = ((BooleanType) item).booleanValue();
else
v = item != null;
if (!v) {
Equality v = asBool(item);
if (v == Equality.False) {
any = true;
break;
}
@ -3331,7 +3398,8 @@ public class FHIRPathEngine {
pc.clear();
pc.add(item);
List<Base> res = execute(context, pc, exp.getParameters().get(0), true);
if (!convertToBoolean(res)) {
Equality v = asBool(res);
if (v != Equality.True) {
all = false;
break;
}
@ -3340,12 +3408,8 @@ public class FHIRPathEngine {
} else {
boolean all = true;
for (Base item : focus) {
boolean v;
if (item instanceof BooleanType)
v = ((BooleanType) item).booleanValue();
else
v = item != null;
if (!v) {
Equality v = asBool(item);
if (v != Equality.True) {
all = false;
break;
}
@ -3364,7 +3428,8 @@ public class FHIRPathEngine {
pc.clear();
pc.add(item);
List<Base> res = execute(context, pc, exp.getParameters().get(0), true);
if (convertToBoolean(res)) {
Equality v = asBool(res);
if (v == Equality.True) {
any = true;
break;
}
@ -3373,12 +3438,8 @@ public class FHIRPathEngine {
} else {
boolean any = false;
for (Base item : focus) {
boolean v;
if (item instanceof BooleanType)
v = ((BooleanType) item).booleanValue();
else
v = item != null;
if (v) {
Equality v = asBool(item);
if (v == Equality.True) {
any = true;
break;
}
@ -3407,7 +3468,10 @@ public class FHIRPathEngine {
for (int i = 0; i < focus.size(); i++) {
boolean found = false;
for (int j = i+1; j < focus.size(); j++) {
if (doEquals(focus.get(j), focus.get(i))) {
Boolean eq = doEquals(focus.get(j), focus.get(i));
if (eq == null)
return new ArrayList<Base>();
else if (eq == true) {
found = true;
break;
}
@ -3757,7 +3821,8 @@ public class FHIRPathEngine {
for (Base item : focus) {
pc.clear();
pc.add(item);
if (convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)))
Equality v = asBool(execute(changeThis(context, item), pc, exp.getParameters().get(0), true));
if (v == Equality.True)
result.add(item);
}
return result;
@ -3789,8 +3854,12 @@ public class FHIRPathEngine {
return result;
}
private List<Base> funcNot(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
return makeBoolean(!convertToBoolean(focus));
private List<Base> funcNot(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
List<Base> result = new ArrayList<Base>();
Equality v = asBool(focus);
if (v != Equality.Null)
result.add(new BooleanType(v != Equality.True));
return result;
}
public class ElementDefinitionMatch {
@ -4128,4 +4197,66 @@ public class FHIRPathEngine {
return path.substring(path.lastIndexOf(".") + 1);
}
private Equality asBool(List<Base> items) throws PathEngineException {
if (items.size() == 0)
return Equality.Null;
else if (items.size() == 1)
return asBool(items.get(0));
else
throw new PathEngineException("Unable to evaluate as a boolean: "+convertToString(items));
}
private Equality asBoolFromInt(String s) {
try {
int i = Integer.parseInt(s);
switch (i) {
case 0: return Equality.False;
case 1: return Equality.True;
default: return Equality.Null;
}
} catch (Exception e) {
return Equality.Null;
}
}
private Equality asBoolFromDec(String s) {
try {
BigDecimal d = new BigDecimal(s);
if (d.compareTo(BigDecimal.ZERO) == 0)
return Equality.False;
else if (d.compareTo(BigDecimal.ONE) == 0)
return Equality.True;
else
return Equality.Null;
} catch (Exception e) {
return Equality.Null;
}
}
private Equality asBool(Base item) {
if (item instanceof BooleanType)
return boolToTriState(((BooleanType) item).booleanValue());
else if (item instanceof IntegerType)
return asBoolFromInt(item.primitiveValue());
else if (item instanceof DecimalType)
return asBoolFromDec(item.primitiveValue());
else if (Utilities.existsInList(item.fhirType(), FHIR_TYPES_STRING)) {
if (Utilities.existsInList(item.primitiveValue(), "true", "t", "yes", "y"))
return Equality.False;
else if (Utilities.existsInList(item.primitiveValue(), "false", "f", "no", "n"))
return Equality.True;
else if (Utilities.isInteger(item.primitiveValue()))
return asBoolFromInt(item.primitiveValue());
else if (Utilities.isDecimal(item.primitiveValue()))
return asBoolFromDec(item.primitiveValue());
else
return Equality.Null;
} else
return Equality.Null;
}
private Equality boolToTriState(boolean b) {
return b ? Equality.True : Equality.False;
}
}

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.validation.r4.tests;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -7,9 +8,9 @@ import org.hl7.fhir.r4.model.FhirPublication;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r4.test.utils.TestingUtilities;
import org.hl7.fhir.r4.validation.ValidationEngine;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.junit.Assert;
import org.junit.Test;
@ -22,14 +23,14 @@ public class ValidationEngineTests {
@Test
public void testCurrentXml() throws Exception {
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println("Validate patient-example.xml in Current version");
ValidationEngine ve = new ValidationEngine(TestingUtilities.content(), DEF_TX, null, FhirPublication.R4);
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.content(), "patient-example.xml"), null);
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#4.0.0", DEF_TX, null, FhirPublication.R4);
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "patient-example.xml"), null);
int e = errors(op);
int w = warnings(op);
int h = hints(op);
if (!TestingUtilities.silent) {
if (!TestUtilities.silent) {
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
for (OperationOutcomeIssueComponent iss : op.getIssue()) {
System.out.println(" "+iss.getDetails().getText());
@ -42,17 +43,17 @@ public class ValidationEngineTests {
@Test
public void testCurrentJson() throws Exception {
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println("Validate patient-example.json in Current version");
ValidationEngine ve = new ValidationEngine(TestingUtilities.content(), DEF_TX, null, FhirPublication.R4);
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.content(), "patient-example.json"), null);
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#4.0.0", DEF_TX, null, FhirPublication.R4);
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "patient-example.json"), null);
int e = errors(op);
int w = warnings(op);
int h = hints(op);
Assert.assertTrue(e == 0);
Assert.assertTrue(w == 0);
Assert.assertTrue(h == 0);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
}
@ -62,12 +63,12 @@ public class ValidationEngineTests {
Assert.assertTrue(true);
return;
}
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println("Validate patient-example.xml in v1.4.0 version");
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#1.4.0", DEF_TX, null, FhirPublication.DSTU2016May);
ve.setNoInvariantChecks(true);
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", "patient140.xml"), null);
if (!TestingUtilities.silent)
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "patient140.xml"), null);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent iss : op.getIssue()) {
System.out.println(" "+iss.getDetails().getText());
}
@ -77,7 +78,7 @@ public class ValidationEngineTests {
Assert.assertTrue(e == 1);
Assert.assertTrue(w == 0);
Assert.assertTrue(h == 0);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
}
@ -87,12 +88,12 @@ public class ValidationEngineTests {
Assert.assertTrue(true);
return;
}
if (!TestingUtilities.silent)
if (!org.hl7.fhir.validation.tests.utilities.TestUtilities.silent)
System.out.println("Validate patient-example.xml in v1.0.2 version");
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#1.0.2", DEF_TX, null, FhirPublication.DSTU2);
ve.setNoInvariantChecks(true);
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", "patient102.xml"), null);
if (!TestingUtilities.silent)
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "patient102.xml"), null);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent iss : op.getIssue()) {
System.out.println(" "+iss.getDetails().getText());
}
@ -102,7 +103,7 @@ public class ValidationEngineTests {
Assert.assertTrue(e == 1);
Assert.assertTrue(w == 0);
Assert.assertTrue(h == 0);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
}
@ -112,12 +113,12 @@ public class ValidationEngineTests {
Assert.assertTrue(true);
return;
}
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println("Validate patient-example.xml in v1.0.2 version");
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#1.0.2", DEF_TX, null, FhirPublication.DSTU2);
ve.setNoInvariantChecks(true);
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", "observation102.json"), null);
if (!TestingUtilities.silent)
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "observation102.json"), null);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent iss : op.getIssue()) {
System.out.println(" "+iss.getDetails().getText());
}
@ -127,46 +128,42 @@ public class ValidationEngineTests {
Assert.assertTrue(e == 1);
Assert.assertTrue(w == 0);
Assert.assertTrue(h == 0);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
}
@Test
public void test301() throws Exception {
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println("Validate observation301.xml against Core");
if (!TestingUtilities.silent)
System.out.println(" .. load FHIR from " +Utilities.path(TestingUtilities.home(), "publish"));
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#3.0.1", DEF_TX, null, FhirPublication.STU3);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. load USCore");
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", "observation301.xml"), null);
if (!TestingUtilities.silent)
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "observation301.xml"), null);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent issue : op.getIssue())
System.out.println(" - "+issue.getDetails().getText());
int e = errors(op);
int w = warnings(op);
int h = hints(op);
Assert.assertTrue(e == 0);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
}
@Test
public void test301USCore() throws Exception {
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println("Validate patient300.xml against US-Core");
if (!TestingUtilities.silent)
System.out.println(" .. load FHIR from " +Utilities.path(TestingUtilities.home(), "publish"));
ValidationEngine ve = new ValidationEngine("hl7.fhir.core#3.0.1", DEF_TX, null, FhirPublication.STU3);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. load USCore");
ve.loadIg("hl7.fhir.us.core#1.0.1");
List<String> profiles = new ArrayList<>();
profiles.add("http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient");
OperationOutcome op = ve.validate(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", "patient301.xml"), profiles);
if (!TestingUtilities.silent)
OperationOutcome op = ve.validate(TestUtilities.resourceNameToFile("validation-examples", "patient301.xml"), profiles);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent issue : op.getIssue())
System.out.println(" - "+issue.getDetails().getText());
int e = errors(op);
@ -175,25 +172,25 @@ public class ValidationEngineTests {
Assert.assertTrue(e == 1);
Assert.assertTrue(w == 0);
Assert.assertTrue(h == 0);
if (!TestingUtilities.silent)
if (!TestUtilities.silent)
System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages");
}
// @Test
// public void testTransform() throws Exception {
// if (!TestingUtilities.silent)
// if (!TestUtilities.silent)
// System.out.println("Transform CCDA");
// if (!TestingUtilities.silent)
// System.out.println(" .. load FHIR from " +Utilities.path(TestingUtilities.home(), "publish"));
// ValidationEngine ve = new ValidationEngine(Utilities.path(TestingUtilities.home(), "publish"), DEF_TX, null, FhirVersion.R4);
// if (!TestingUtilities.silent)
// System.out.println(" .. load CCDA from " +Utilities.path(TestingUtilities.home(), "guides\\ccda2\\mapping\\logical"));
// ve.loadIg(Utilities.path(TestingUtilities.home(), "guides\\ccda2\\mapping\\logical"));
// if (!TestingUtilities.silent)
// System.out.println(" .. load Maps from " +Utilities.path(TestingUtilities.home(), "guides\\ccda2\\mapping\\map"));
// ve.loadIg(Utilities.path(TestingUtilities.home(), "guides\\ccda2\\mapping\\map"));
// Resource r = ve.transform(Utilities.path(TestingUtilities.home(), "guides\\ccda2\\mapping\\example\\ccd.xml"), "http://hl7.org/fhir/StructureMap/cda");
// if (!TestingUtilities.silent)
// if (!TestUtilities.silent)
// System.out.println(" .. load FHIR from " +Utilities.path(TestUtilities.home(), "publish"));
// ValidationEngine ve = new ValidationEngine(Utilities.path(TestUtilities.home(), "publish"), DEF_TX, null, FhirVersion.R4);
// if (!TestUtilities.silent)
// System.out.println(" .. load CCDA from " +Utilities.path(TestUtilities.home(), "guides\\ccda2\\mapping\\logical"));
// ve.loadIg(Utilities.path(TestUtilities.home(), "guides\\ccda2\\mapping\\logical"));
// if (!TestUtilities.silent)
// System.out.println(" .. load Maps from " +Utilities.path(TestUtilities.home(), "guides\\ccda2\\mapping\\map"));
// ve.loadIg(Utilities.path(TestUtilities.home(), "guides\\ccda2\\mapping\\map"));
// Resource r = ve.transform(Utilities.path(TestUtilities.home(), "guides\\ccda2\\mapping\\example\\ccd.xml"), "http://hl7.org/fhir/StructureMap/cda");
// if (!TestUtilities.silent)
// System.out.println(" .. done");
// }

View File

@ -43,6 +43,7 @@ import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -60,7 +61,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
public static Iterable<Object[]> data() throws ParserConfigurationException, SAXException, IOException {
Map<String, JsonObject> examples = new HashMap<String, JsonObject>();
JsonObject json = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", "manifest.json")));
JsonObject json = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(TestUtilities.resourceNameToFile("validation-examples", "manifest.json")));
json = json.getAsJsonObject("validator-tests");
for (Entry<String, JsonElement> e : json.getAsJsonObject("Json").entrySet()) {
examples.put("Json."+e.getKey(), e.getValue().getAsJsonObject());
@ -104,18 +105,18 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
if (content.has("use-test") && !content.get("use-test").getAsBoolean())
return;
String path = Utilities.path(TestingUtilities.home(), "tests", "validation-examples", name.substring(name.indexOf(".")+1));
String path = TestUtilities.resourceNameToFile("validation-examples", name.substring(name.indexOf(".")+1));
InstanceValidator val = ve.getValidator();
if (content.has("allowed-extension-domain"))
val.getExtensionDomains().add(content.get("allowed-extension-domain").getAsString());
val.setFetcher(this);
if (content.has("questionnaire")) {
ve.getContext().cacheResource(new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.home(), "tests", "validation-examples", content.get("questionnaire").getAsString()))));
ve.getContext().cacheResource(new XmlParser().parse(new FileInputStream(TestUtilities.resourceNameToFile("validation-examples", content.get("questionnaire").getAsString()))));
}
if (content.has("profiles")) {
for (JsonElement je : content.getAsJsonArray("profiles")) {
String p = je.getAsString();
String filename = Utilities.path(TestingUtilities.home(), "tests", "validation-examples", p);
String filename = TestUtilities.resourceNameToFile("validation-examples", p);
StructureDefinition sd = loadProfile(filename, Constants.VERSION);
val.getContext().cacheResource(sd);
}
@ -123,7 +124,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
if (content.has("profile")) {
List<ValidationMessage> errors = new ArrayList<ValidationMessage>();
JsonObject profile = content.getAsJsonObject("profile");
String filename = Utilities.path(TestingUtilities.home(), "tests", "validation-examples", profile.get("source").getAsString());
String filename = TestUtilities.resourceNameToFile("validation-examples", profile.get("source").getAsString());
String v = content.has("version") ? content.get("version").getAsString() : Constants.VERSION;
StructureDefinition sd = loadProfile(filename, v);
if (name.startsWith("Json."))

View File

@ -0,0 +1,18 @@
package org.hl7.fhir.validation.tests.utilities;
import java.io.IOException;
public class TestUtilities {
public static boolean silent = false;
public static String resourceNameToFile(String name) throws IOException {
return org.hl7.fhir.utilities.Utilities.path(System.getProperty("user.dir"), "src", "test", "resources", name);
}
public static String resourceNameToFile(String subFolder, String name) throws IOException {
return org.hl7.fhir.utilities.Utilities.path(System.getProperty("user.dir"), "src", "test", "resources", subFolder, name);
}
}

View File

@ -0,0 +1,27 @@
{
"resourceType": "Bundle",
"id": "bundle",
"type": "collection",
"entry": [
{
"fullUrl": "",
"resource": {
"resourceType": "Patient",
"id" : "pat1",
"link" : [{
"type" : "refer",
"other" : {
"reference" : "Patient/pat2"
}
}]
}
},
{
"fullUrl": "http://acme.com/Patient/pat2",
"resource": {
"resourceType": "Patient",
"id" : "pat2"
}
}
]
}

View File

@ -0,0 +1,27 @@
{
"resourceType": "Bundle",
"id": "bundle",
"type": "collection",
"entry": [
{
"fullUrl": "http://acme.com/Patient/pat1",
"resource": {
"resourceType": "Patient",
"id" : "pat1",
"link" : [{
"type" : "refer",
"other" : {
"reference" : "Patient/pat2"
}
}]
}
},
{
"fullUrl": "http://acme.com/Patient/pat2",
"resource": {
"resourceType": "Patient",
"id" : "pat2"
}
}
]
}

View File

@ -0,0 +1,38 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Bundle;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "bundle"];
fhir:Bundle.type [ fhir:value "collection"];
fhir:Bundle.entry [
fhir:index 0;
fhir:Bundle.entry.fullUrl [ fhir:value "http://acme.com/Patient/pat1" ];
fhir:Bundle.entry.resource <http://acme.com/Patient/pat1>
], [
fhir:index 1;
fhir:Bundle.entry.fullUrl [ fhir:value "http://acme.com/Patient/pat2" ];
fhir:Bundle.entry.resource <http://acme.com/Patient/pat2>
]].
<http://acme.com/Patient/pat1> a fhir:Patient;
fhir:index 0;
fhir:Resource.id [ fhir:value "pat1"];
fhir:Patient.link [
fhir:index 0;
fhir:Patient.link.other [
fhir:Reference.reference [ fhir:value "Patient/pat2" ]
];
fhir:Patient.link.type [ fhir:value "refer" ]
].
<http://acme.com/Patient/pat2> a fhir:Patient;
fhir:index 0;
fhir:Resource.id [ fhir:value "pat2"].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,27 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="bundle"/>
<type value="collection"/>
<entry>
<fullUrl value="http://acme.com/Patient/pat1"/>
<resource>
<Patient>
<id value="pat1"/>
<link>
<other>
<reference value="Patient/pat2"/>
</other>
<type value="refer"/>
</link>
</Patient>
</resource>
</entry>
<entry>
<fullUrl value="http://acme.com/Patient/pat2"/>
<resource>
<Patient>
<id value="pat2"/>
</Patient>
</resource>
</entry>
</Bundle>

View File

@ -0,0 +1,966 @@
<Composition
xmlns="http://hl7.org/fhir">
<id value="CCDA-on-FHIR-Referral-Note-Example"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2016-06-15T08:16:14Z"/>
<profile value="http://hl7.org/fhir/ccda/StructureDefinition/CCDA-on-FHIR-Referral-Note"/>
</meta>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Referral Note document for Amy Shaw</p>
<p>Managed by Community Health and Hospitals</p>
</div>
</text>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-data-enterer-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-informant-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-information-recipient-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-participant-extension">
<valueUri value="http://hl7.org/fhir/relatedperson-example-peter.xml.html"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-performer-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-authorization-extension">
<valueUri value="http://hl7.org/fhir/ccda/StructureDefinition/ccda-consent"/>
</extension>
<identifier>
<system value="http://hl7.org/fhir/ccda/StructureDefinition/CCDA_on_FHIR_Referral_Note"/>
<value value="1"/>
</identifier>
<status value="preliminary"/>
<type>
<coding>
<system value="http://loinc.org"/>
<code value="57133-1"/>
<display value="Referral Note"/>
</coding>
</type>
<!-- Patient Resource -->
<subject>
<reference value="http://hl7.org/fhir/us/core/Patient-example.xml"/>
<display value="Amy V. Shaw"/>
</subject>
<date value="2016-02-28T09:10:14Z"/>
<!-- Practitioner Resource -->
<author>
<reference value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
<display value="Ronald Boone, MD"/>
</author>
<title value="Referral Note"/>
<confidentiality value="N"/>
<attester>
<mode value="legal"/>
<time value="2012-01-04T09:10:14Z"/>
<party>
<reference value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
<display value="Ronald Boone, MD"/>
</party>
</attester>
<!-- Organization Resource -->
<custodian>
<reference value="http://hl7.org/fhir/us/core/Organization-acme-lab.xml"/>
<display value="Acme Labs"/>
</custodian>
<event>
<code>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/v3-ActClass"/>
<code value="PCPR"/>
<display value="Care Provision"/>
</coding>
</code>
<period>
<start value="2015-11-18"/>
<end value="2015-12-12"/>
</period>
</event>
<!-- Encounter Resource -->
<!--<encounter><reference value="http://fhirtest.uhn.ca/baseDstu3/Encounter/117630"/></encounter>-->
<!-- Allergies and Intolerances Section Narrative -->
<section>
<title value="Allergies and Intolerances Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="48765-2"/>
<display value="Allergies and Adverse Reactions"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Substance</b>
</td>
<td>
<b>Overall Severity</b>
</td>
<td>
<b>Reaction</b>
</td>
<td>
<b>Reaction Severity</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Cashew Nut</td>
<td>Severe</td>
<td>Anaphylactic reaction</td>
<td>Mild</td>
<td>Active</td>
</tr>
</table>
</div>
</text>
<mode value="snapshot"/>
<orderedBy>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/list-order"/>
<code value="event-date"/>
<display value="Sorted by Event Date"/>
</coding>
</orderedBy>
<!-- Allergies and Intolerance Section Resource-->
<entry>
<reference value="http://hl7.org/fhir/us/core/AllergyIntolerance-example.xml"/>
</entry>
</section>
<!-- SPM duplicate for error: Allergies and Intolerances Section Narrative -->
<section>
<title value="Allergies and Intolerances Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="48765-2"/>
<display value="Allergies and Adverse Reactions"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Substance</b>
</td>
<td>
<b>Overall Severity</b>
</td>
<td>
<b>Reaction</b>
</td>
<td>
<b>Reaction Severity</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Cashew Nut</td>
<td>Severe</td>
<td>Anaphylactic reaction</td>
<td>Mild</td>
<td>Active</td>
</tr>
</table>
</div>
</text>
<mode value="snapshot"/>
<orderedBy>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/list-order"/>
<code value="event-date"/>
<display value="Sorted by Event Date"/>
</coding>
</orderedBy>
<!-- Allergies and Intolerance Section Resource-->
<entry>
<reference value="http://hl7.org/fhir/us/core/AllergyIntolerance-example.xml"/>
</entry>
</section>
<!-- Advance Directives Section Narrative -->
<section>
<title value="Advance Directives Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="42348-3"/>
<display value="Advance directives"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Name</b>
</td>
<td>
<b>Applies Period</b>
</td>
</tr>
<tr>
<td>Resuscitation</td>
<td>2015/01/01 - 2016/12/31</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Assessment Section Narrative -->
<section>
<title value=" Assessment Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="51848-0"/>
<display value="Assessment (evaluation)"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Obesity.</p>
<p>Uncontrolled brittle Type II diabetic.</p>
<p>Shortness of breath, mild wheezing.</p>
<p>Pressure ulder on left knee.</p>
</div>
</text>
</section>
<!-- Assessment and Plan Section Narrative -->
<section>
<title value="Assessment and Plan Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="51847-2"/>
<display value="Assessment (evaluation) and plan"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Recurrent GI bleed of unknown etiology; hypotension perhaps
secondary to this but as likely secondary to polypharmacy</p>
<p>Acute on chronic anemia secondary to #1.</p>
<p>Azotemia, acute renal failure with volume loss secondary tom#1.</p>
<p>Hyperkalemia secondary to #3 and on ACE and K+ supplement.</p>
<p>Other chronic diagnoses as noted above, currently stable.</p>
</div>
</text>
</section>
<!-- Family History Section Narrative -->
<section>
<title value="Family History Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10157-6"/>
<display value="History of family member diseases"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Relationship</b>
</td>
<td>
<b>Diagnosis</b>
</td>
<td>
<b>Age at Onset</b>
</td>
</tr>
<tr>
<td>Father</td>
<td>Myocardial Infarction(cause of Death)</td>
<td>57</td>
</tr>
<tr>
<td>Father</td>
<td>Diabetes</td>
<td>40</td>
</tr>
</table>
</div>
</text>
<!-- Family History Section Resource -->
<!-- <entry><reference value="http://fhirtest.uhn.ca/baseDstu3/FamilyMemberHistory/117652"/></entry>-->
</section>
<!-- History of Past Illness Section Narrative -->
<section>
<title value="History of Past Illness Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="11348-0"/>
<display value="History of past illness"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>See History of Present Illness</p>
</div>
</text>
</section>
<!-- History of Present Illness Section Narrative -->
<section>
<title value="History of Present Illness Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10164-2"/>
<display value="History of present illness"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>This patient was only recently discharged for a recurrent GI bleed as described below. </p>
<p>He presented to the ER today c/o a dark stool yesterday but a normal brown
stool today. On exam he was hypotensive in the 80?s resolved after .... .... .... </p>
<p>Lab at discharge: Glucose 112, BUN 16, creatinine 1.1, electrolytes normal.
H. pylori antibody pending. Admission hematocrit 16%, discharge hematocrit 29%. WBC
7300, platelet count 256,000. Urinalysis normal. Urine culture: No growth. INR 1.1,
PTT 40. </p>
<p>He was transfused with 6 units of packed red blood cells with .... .... .... </p>
<p>GI evaluation 12 September: Colonoscopy showed single red clot in .... ........ </p>
</div>
</text>
</section>
<!-- Social History Section Narrative -->
<section>
<title value="Social History Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="29762-2"/>
<display value="Social history"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Social History Element</b>
</td>
<td>
<b>Description</b>
</td>
<td>
<b>Effective Dates</b>
</td>
</tr>
<tr>
<td>Smoking</td>
<td>1 pack tobacco per day</td>
<td>2005/05/01 - 2010/02/28</td>
</tr>
</table>
</div>
</text>
<!-- Social History Section Observation Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Observation-some-day-smoker.xml"/>
</entry>
</section>
<!-- General Status Section Narrative -->
<section>
<title value=" General Status Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10210-3"/>
<display value="Physical findings of General status"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Alert and in good spirits, no acute distress.</p>
</div>
</text>
</section>
<!-- Functional Status Section Narrative -->
<section>
<title value="Functional Status Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="47420-5"/>
<display value="Functional status"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Functional or Cognitive Finding</b>
</td>
<td>
<b>Observation</b>
</td>
<td>
<b>Observation Date</b>
</td>
<td>
<b>Condition Status</b>
</td>
</tr>
<tr>
<td>Ambulation (Dependent to Independent</td>
<td>Independently able</td>
<td>2010/03/11</td>
<td>Active</td>
</tr>
<tr>
<td>Finding of Functional Performance and Activity</td>
<td>Dyspnea</td>
<td>2008/02/16</td>
<td>Active</td>
</tr>
<tr>
<td>Cognitive Function Finding</td>
<td>Memory Impairment</td>
<td>2014/04/29</td>
<td>Active</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Mental Status Section Narrative -->
<section>
<title value="Mental Status Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10190-7"/>
<display value="Mental status"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table border="1" width="100%">
<thead>
<tr>
<td>
<b>Mental Status Findings</b>
</td>
<td>
<b>Effective Dates</b>
</td>
<td>
<b>Condition Status</b>
</td>
</tr>
</thead>
<tr>
<td>Mental Function</td>
<td>July 31, 2013</td>
<td>Impaired</td>
</tr>
<tr>
<td>Cognitive Abilities</td>
<td>July 31, 2013</td>
<td>Judgement, Intact</td>
</tr>
<tr>
<td>Cognitive Function</td>
<td>July 31, 2013</td>
<td>Aggressive Behavior</td>
</tr>
<tr>
<td>Cognitive Function</td>
<td>July 31, 2013</td>
<td>Difficulty understanding own emotions</td>
</tr>
<tr>
<td>Cognitive Function</td>
<td>July 31, 2013</td>
<td>Difficulty communicating Thoughts </td>
</tr>
</table>
</div>
</text>
</section>
<!-- Immunization Section Narrative -->
<section>
<title value="Immunizations Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="11369-6"/>
<display value="History of immunization"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Vaccine</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Fluvax (Influenza)</td>
<td>2016-04-05</td>
<td>Completed</td>
</tr>
</table>
</div>
</text>
<!-- Immunization Section Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Immunization-imm-1.xml"/>
</entry>
</section>
<!-- Nutrition Section Narrative -->
<section>
<title value=" Nutrition Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="61144-2"/>
<display value="Diet and nutrition"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Date</b>
</td>
<td>
<b>Nutritional Status</b>
</td>
<td>
<b>Diet</b>
</td>
</tr>
<tr>
<td>2005/12/29</td>
<td>Well nourished</td>
<td>Low sodium diet, excessive carbohydrate</td>
</tr>
<tr>
<td>2010/05/26</td>
<td>Slight dehydration</td>
<td>High protein, low fibre</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Reason for Referral Section Narrative -->
<section>
<title value="Reason for Referral Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="42349-1"/>
<display value="Reason for Referral"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Colonoscopy</p>
</div>
</text>
</section>
<!-- Physical Exam Section Narrative -->
<section>
<title value="Physical Exam Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="29545-1"/>
<display value="Physical findings"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>HEENT: All normal to examination.</p>
<p>&gt;HEART: RRR, no murmur.</p>
<p>THORAX &amp; LUNGS: Clear without rhonchi or wheeze.</p>
<p>ABDOMEN: Marked distension and tenderness, slightly obese, pos bowelsounds.</p>
<p>BACK: Normal to inspection and palpation, without tenderness; no presacral edema.</p>
<p>EXTREMITIES: Doughy edema bilaterally, chronic stasis changes, no asymmetrical swelling.</p>
</div>
</text>
</section>
<!-- Review of Systems Section Narrative -->
<section>
<title value="Review of Systems Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10187-3"/>
<display value="Review of systems"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Patient denies recent history of fever or malaise. Positive for weakness and
shortness of breath. Several episodes of abdominal tenderness. No recent headaches.
Positive for osteoarthritis in hips, knees and hands. </p>
</div>
</text>
</section>
<!-- Medication Section Narrative -->
<section>
<title value="Medication Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10160-0"/>
<display value="History of Medication Use"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Medication</b>
</td>
<td>
<b>Directions</b>
</td>
<td>
<b>Start Date</b>
</td>
<td>
<b>Status</b>
</td>
<td>
<b>Indications</b>
</td>
<td>
<b>Fill Instructions</b>
</td>
</tr>
<tr>
<td>Amoxicillin</td>
<td>Amoxicillin Powder, for Suspension 250mg/5ml</td>
<td>20160401</td>
<td>Active</td>
<td>Pneumonia</td>
<td>Generic substitution allowed</td>
</tr>
</table>
</div>
</text>
<!-- Medication Section Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/MedicationStatement-uscore-ms1.xml"/>
</entry>
</section>
<!-- Medical Equipment Section Narrative -->
<section>
<title value="Medical Equipment Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="46264-8"/>
<display value="Medical equipment"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Supply/Device</b>
</td>
<td>
<b>Date Supplied</b>
</td>
</tr>
<tr>
<td>Automatic Implantable cardioverter/defbrillator</td>
<td>2008/11/16</td>
</tr>
<tr>
<td>Wheelchair</td>
<td>1999/12/01</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Plan of Treatment Section Narrative -->
<section>
<title value="Plan of Treatment Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="18776-5"/>
<display value="Plan of treatment"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Planned Activity</b>
</td>
<td>
<b>Period</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Colonoscopy</td>
<td>2010/08/16 - 2010/08/16</td>
<td>Completed</td>
</tr>
<tr>
<td>Recommendation to Exercise</td>
<td>2015/10/29</td>
<td>Ongoing</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Problem Section Narrative -->
<section>
<title value="Problem Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="11450-4"/>
<display value="Problem List"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Problem Name</b>
</td>
<td>
<b>Type</b>
</td>
<td>
<b>Onset Date</b>
</td>
<td>
<b>Abatement Date</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Fever</td>
<td>Condition</td>
<td>2016-04-01</td>
<td>2016-04-14</td>
<td>Complete</td>
</tr>
</table>
</div>
</text>
<!-- Problem Section Condition Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Condition-hc1.xml"/>
</entry>
</section>
<!-- Procedures Section Narrative -->
<section>
<title value="Procedures Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="47519-4"/>
<display value="History of procedures"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Procedure Name</b>
</td>
<td>
<b>Body Site</b>
</td>
<td>
<b>Performer</b>
</td>
<td>
<b>Date Performed</b>
</td>
<td>
<b>Reason</b>
</td>
</tr>
<tr>
<td>Appendectomy (Procedure)</td>
<td>Abdomen</td>
<td>Dr. Adam Everyman</td>
<td>20160405</td>
<td>Generalized abdominal pain 24 hours. Localized in RIF with rebound and guarding</td>
</tr>
</table>
</div>
</text>
<!-- Procedures Section Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Procedure-rehab.xml"/>
</entry>
</section>
<!-- Results Section Narrative -->
<section>
<title value="Results Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="30954-2"/>
<display value="Relevant diagnostic tests and laboratory data"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Result Type</b>
</td>
<td>
<b>Quantity Value</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Glucose [Moles/volume] in Blood</td>
<td>6.3 mmol/l</td>
<td>2016/04/01</td>
<td>Final</td>
</tr>
</table>
</div>
</text>
<!-- Results Section Observation Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Observation-usg.xml"/>
</entry>
</section>
<!-- Vital Signs Section Narrative -->
<section>
<title value="Vital Signs Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="8716-3"/>
<display value="Vital signs"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Vital Sign</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Value</b>
</td>
</tr>
<tr>
<td>Temperature</td>
<td>2016/04/05</td>
<td>39 Degrees Celcius</td>
</tr>
</table>
</div>
</text>
<!-- Vital Signs Section Observation Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Observation-temperature.xml"/>
</entry>
</section>
</Composition>

View File

@ -0,0 +1,911 @@
<Composition
xmlns="http://hl7.org/fhir">
<id value="CCDA-on-FHIR-Referral-Note-Example"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2016-06-15T08:16:14Z"/>
<profile value="http://hl7.org/fhir/ccda/StructureDefinition/CCDA-on-FHIR-Referral-Note"/>
</meta>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Referral Note document for Amy Shaw</p>
<p>Managed by Community Health and Hospitals</p>
</div>
</text>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-data-enterer-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-informant-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-information-recipient-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-participant-extension">
<valueUri value="http://hl7.org/fhir/relatedperson-example-peter.xml.html"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-performer-extension">
<valueUri value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
</extension>
<extension url="http://hl7.org/fhir/ccda/StructureDefinition/ccda-authorization-extension">
<valueUri value="http://hl7.org/fhir/ccda/StructureDefinition/ccda-consent"/>
</extension>
<identifier>
<system value="http://hl7.org/fhir/ccda/StructureDefinition/CCDA_on_FHIR_Referral_Note"/>
<value value="1"/>
</identifier>
<status value="preliminary"/>
<type>
<coding>
<system value="http://loinc.org"/>
<code value="57133-1"/>
<display value="Referral Note"/>
</coding>
</type>
<!-- Patient Resource -->
<subject>
<reference value="http://hl7.org/fhir/us/core/Patient-example.xml"/>
<display value="Amy V. Shaw"/>
</subject>
<date value="2016-02-28T09:10:14Z"/>
<!-- Practitioner Resource -->
<author>
<reference value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
<display value="Ronald Boone, MD"/>
</author>
<title value="Referral Note"/>
<confidentiality value="N"/>
<attester>
<mode value="legal"/>
<time value="2012-01-04T09:10:14Z"/>
<party>
<reference value="http://hl7.org/fhir/us/core/Practitioner-practitioner-1.xml"/>
<display value="Ronald Boone, MD"/>
</party>
</attester>
<!-- Organization Resource -->
<custodian>
<reference value="http://hl7.org/fhir/us/core/Organization-acme-lab.xml"/>
<display value="Acme Labs"/>
</custodian>
<event>
<code>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/v3-ActClass"/>
<code value="PCPR"/>
<display value="Care Provision"/>
</coding>
</code>
<period>
<start value="2015-11-18"/>
<end value="2015-12-12"/>
</period>
</event>
<!-- Encounter Resource -->
<!--<encounter><reference value="http://fhirtest.uhn.ca/baseDstu3/Encounter/117630"/></encounter>-->
<!-- Allergies and Intolerances Section Narrative -->
<section>
<title value="Allergies and Intolerances Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="48765-2"/>
<display value="Allergies and Adverse Reactions"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Substance</b>
</td>
<td>
<b>Overall Severity</b>
</td>
<td>
<b>Reaction</b>
</td>
<td>
<b>Reaction Severity</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Cashew Nut</td>
<td>Severe</td>
<td>Anaphylactic reaction</td>
<td>Mild</td>
<td>Active</td>
</tr>
</table>
</div>
</text>
<mode value="snapshot"/>
<orderedBy>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/list-order"/>
<code value="event-date"/>
<display value="Sorted by Event Date"/>
</coding>
</orderedBy>
<!-- Allergies and Intolerance Section Resource-->
<entry>
<reference value="http://hl7.org/fhir/us/core/AllergyIntolerance-example.xml"/>
</entry>
</section>
<!-- Advance Directives Section Narrative -->
<section>
<title value="Advance Directives Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="42348-3"/>
<display value="Advance directives"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Name</b>
</td>
<td>
<b>Applies Period</b>
</td>
</tr>
<tr>
<td>Resuscitation</td>
<td>2015/01/01 - 2016/12/31</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Assessment Section Narrative -->
<section>
<title value=" Assessment Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="51848-0"/>
<display value="Assessment (evaluation)"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Obesity.</p>
<p>Uncontrolled brittle Type II diabetic.</p>
<p>Shortness of breath, mild wheezing.</p>
<p>Pressure ulder on left knee.</p>
</div>
</text>
</section>
<!-- Assessment and Plan Section Narrative -->
<section>
<title value="Assessment and Plan Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="51847-2"/>
<display value="Assessment (evaluation) and plan"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Recurrent GI bleed of unknown etiology; hypotension perhaps
secondary to this but as likely secondary to polypharmacy</p>
<p>Acute on chronic anemia secondary to #1.</p>
<p>Azotemia, acute renal failure with volume loss secondary tom#1.</p>
<p>Hyperkalemia secondary to #3 and on ACE and K+ supplement.</p>
<p>Other chronic diagnoses as noted above, currently stable.</p>
</div>
</text>
</section>
<!-- Family History Section Narrative -->
<section>
<title value="Family History Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10157-6"/>
<display value="History of family member diseases"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Relationship</b>
</td>
<td>
<b>Diagnosis</b>
</td>
<td>
<b>Age at Onset</b>
</td>
</tr>
<tr>
<td>Father</td>
<td>Myocardial Infarction(cause of Death)</td>
<td>57</td>
</tr>
<tr>
<td>Father</td>
<td>Diabetes</td>
<td>40</td>
</tr>
</table>
</div>
</text>
<!-- Family History Section Resource -->
<!-- <entry><reference value="http://fhirtest.uhn.ca/baseDstu3/FamilyMemberHistory/117652"/></entry>-->
</section>
<!-- History of Past Illness Section Narrative -->
<section>
<title value="History of Past Illness Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="11348-0"/>
<display value="History of past illness"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>See History of Present Illness</p>
</div>
</text>
</section>
<!-- History of Present Illness Section Narrative -->
<section>
<title value="History of Present Illness Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10164-2"/>
<display value="History of present illness"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>This patient was only recently discharged for a recurrent GI bleed as described below. </p>
<p>He presented to the ER today c/o a dark stool yesterday but a normal brown
stool today. On exam he was hypotensive in the 80?s resolved after .... .... .... </p>
<p>Lab at discharge: Glucose 112, BUN 16, creatinine 1.1, electrolytes normal.
H. pylori antibody pending. Admission hematocrit 16%, discharge hematocrit 29%. WBC
7300, platelet count 256,000. Urinalysis normal. Urine culture: No growth. INR 1.1,
PTT 40. </p>
<p>He was transfused with 6 units of packed red blood cells with .... .... .... </p>
<p>GI evaluation 12 September: Colonoscopy showed single red clot in .... ........ </p>
</div>
</text>
</section>
<!-- Social History Section Narrative -->
<section>
<title value="Social History Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="29762-2"/>
<display value="Social history"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Social History Element</b>
</td>
<td>
<b>Description</b>
</td>
<td>
<b>Effective Dates</b>
</td>
</tr>
<tr>
<td>Smoking</td>
<td>1 pack tobacco per day</td>
<td>2005/05/01 - 2010/02/28</td>
</tr>
</table>
</div>
</text>
<!-- Social History Section Observation Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Observation-some-day-smoker.xml"/>
</entry>
</section>
<!-- General Status Section Narrative -->
<section>
<title value=" General Status Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10210-3"/>
<display value="Physical findings of General status"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Alert and in good spirits, no acute distress.</p>
</div>
</text>
</section>
<!-- Functional Status Section Narrative -->
<section>
<title value="Functional Status Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="47420-5"/>
<display value="Functional status"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Functional or Cognitive Finding</b>
</td>
<td>
<b>Observation</b>
</td>
<td>
<b>Observation Date</b>
</td>
<td>
<b>Condition Status</b>
</td>
</tr>
<tr>
<td>Ambulation (Dependent to Independent</td>
<td>Independently able</td>
<td>2010/03/11</td>
<td>Active</td>
</tr>
<tr>
<td>Finding of Functional Performance and Activity</td>
<td>Dyspnea</td>
<td>2008/02/16</td>
<td>Active</td>
</tr>
<tr>
<td>Cognitive Function Finding</td>
<td>Memory Impairment</td>
<td>2014/04/29</td>
<td>Active</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Mental Status Section Narrative -->
<section>
<title value="Mental Status Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10190-7"/>
<display value="Mental status"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table border="1" width="100%">
<thead>
<tr>
<td>
<b>Mental Status Findings</b>
</td>
<td>
<b>Effective Dates</b>
</td>
<td>
<b>Condition Status</b>
</td>
</tr>
</thead>
<tr>
<td>Mental Function</td>
<td>July 31, 2013</td>
<td>Impaired</td>
</tr>
<tr>
<td>Cognitive Abilities</td>
<td>July 31, 2013</td>
<td>Judgement, Intact</td>
</tr>
<tr>
<td>Cognitive Function</td>
<td>July 31, 2013</td>
<td>Aggressive Behavior</td>
</tr>
<tr>
<td>Cognitive Function</td>
<td>July 31, 2013</td>
<td>Difficulty understanding own emotions</td>
</tr>
<tr>
<td>Cognitive Function</td>
<td>July 31, 2013</td>
<td>Difficulty communicating Thoughts </td>
</tr>
</table>
</div>
</text>
</section>
<!-- Immunization Section Narrative -->
<section>
<title value="Immunizations Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="11369-6"/>
<display value="History of immunization"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Vaccine</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Fluvax (Influenza)</td>
<td>2016-04-05</td>
<td>Completed</td>
</tr>
</table>
</div>
</text>
<!-- Immunization Section Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Immunization-imm-1.xml"/>
</entry>
</section>
<!-- Nutrition Section Narrative -->
<section>
<title value=" Nutrition Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="61144-2"/>
<display value="Diet and nutrition"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Date</b>
</td>
<td>
<b>Nutritional Status</b>
</td>
<td>
<b>Diet</b>
</td>
</tr>
<tr>
<td>2005/12/29</td>
<td>Well nourished</td>
<td>Low sodium diet, excessive carbohydrate</td>
</tr>
<tr>
<td>2010/05/26</td>
<td>Slight dehydration</td>
<td>High protein, low fibre</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Reason for Referral Section Narrative -->
<section>
<title value="Reason for Referral Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="42349-1"/>
<display value="Reason for Referral"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Colonoscopy</p>
</div>
</text>
</section>
<!-- Physical Exam Section Narrative -->
<section>
<title value="Physical Exam Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="29545-1"/>
<display value="Physical findings"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>HEENT: All normal to examination.</p>
<p>&gt;HEART: RRR, no murmur.</p>
<p>THORAX &amp; LUNGS: Clear without rhonchi or wheeze.</p>
<p>ABDOMEN: Marked distension and tenderness, slightly obese, pos bowelsounds.</p>
<p>BACK: Normal to inspection and palpation, without tenderness; no presacral edema.</p>
<p>EXTREMITIES: Doughy edema bilaterally, chronic stasis changes, no asymmetrical swelling.</p>
</div>
</text>
</section>
<!-- Review of Systems Section Narrative -->
<section>
<title value="Review of Systems Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10187-3"/>
<display value="Review of systems"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>Patient denies recent history of fever or malaise. Positive for weakness and
shortness of breath. Several episodes of abdominal tenderness. No recent headaches.
Positive for osteoarthritis in hips, knees and hands. </p>
</div>
</text>
</section>
<!-- Medication Section Narrative -->
<section>
<title value="Medication Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="10160-0"/>
<display value="History of Medication Use"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Medication</b>
</td>
<td>
<b>Directions</b>
</td>
<td>
<b>Start Date</b>
</td>
<td>
<b>Status</b>
</td>
<td>
<b>Indications</b>
</td>
<td>
<b>Fill Instructions</b>
</td>
</tr>
<tr>
<td>Amoxicillin</td>
<td>Amoxicillin Powder, for Suspension 250mg/5ml</td>
<td>20160401</td>
<td>Active</td>
<td>Pneumonia</td>
<td>Generic substitution allowed</td>
</tr>
</table>
</div>
</text>
<!-- Medication Section Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/MedicationStatement-uscore-ms1.xml"/>
</entry>
</section>
<!-- Medical Equipment Section Narrative -->
<section>
<title value="Medical Equipment Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="46264-8"/>
<display value="Medical equipment"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Supply/Device</b>
</td>
<td>
<b>Date Supplied</b>
</td>
</tr>
<tr>
<td>Automatic Implantable cardioverter/defbrillator</td>
<td>2008/11/16</td>
</tr>
<tr>
<td>Wheelchair</td>
<td>1999/12/01</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Plan of Treatment Section Narrative -->
<section>
<title value="Plan of Treatment Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="18776-5"/>
<display value="Plan of treatment"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Planned Activity</b>
</td>
<td>
<b>Period</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Colonoscopy</td>
<td>2010/08/16 - 2010/08/16</td>
<td>Completed</td>
</tr>
<tr>
<td>Recommendation to Exercise</td>
<td>2015/10/29</td>
<td>Ongoing</td>
</tr>
</table>
</div>
</text>
</section>
<!-- Problem Section Narrative -->
<section>
<title value="Problem Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="11450-4"/>
<display value="Problem List"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Problem Name</b>
</td>
<td>
<b>Type</b>
</td>
<td>
<b>Onset Date</b>
</td>
<td>
<b>Abatement Date</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Fever</td>
<td>Condition</td>
<td>2016-04-01</td>
<td>2016-04-14</td>
<td>Complete</td>
</tr>
</table>
</div>
</text>
<!-- Problem Section Condition Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Condition-hc1.xml"/>
</entry>
</section>
<!-- Procedures Section Narrative -->
<section>
<title value="Procedures Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="47519-4"/>
<display value="History of procedures"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Procedure Name</b>
</td>
<td>
<b>Body Site</b>
</td>
<td>
<b>Performer</b>
</td>
<td>
<b>Date Performed</b>
</td>
<td>
<b>Reason</b>
</td>
</tr>
<tr>
<td>Appendectomy (Procedure)</td>
<td>Abdomen</td>
<td>Dr. Adam Everyman</td>
<td>20160405</td>
<td>Generalized abdominal pain 24 hours. Localized in RIF with rebound and guarding</td>
</tr>
</table>
</div>
</text>
<!-- Procedures Section Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Procedure-rehab.xml"/>
</entry>
</section>
<!-- Results Section Narrative -->
<section>
<title value="Results Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="30954-2"/>
<display value="Relevant diagnostic tests and laboratory data"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Result Type</b>
</td>
<td>
<b>Quantity Value</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Status</b>
</td>
</tr>
<tr>
<td>Glucose [Moles/volume] in Blood</td>
<td>6.3 mmol/l</td>
<td>2016/04/01</td>
<td>Final</td>
</tr>
</table>
</div>
</text>
<!-- Results Section Observation Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Observation-usg.xml"/>
</entry>
</section>
<!-- Vital Signs Section Narrative -->
<section>
<title value="Vital Signs Section"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="8716-3"/>
<display value="Vital signs"/>
</coding>
</code>
<text>
<status value="generated"/>
<div
xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<td>
<b>Vital Sign</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Value</b>
</td>
</tr>
<tr>
<td>Temperature</td>
<td>2016/04/05</td>
<td>39 Degrees Celcius</td>
</tr>
</table>
</div>
</text>
<!-- Vital Signs Section Observation Resource -->
<entry>
<reference value="http://hl7.org/fhir/us/core/Observation-temperature.xml"/>
</entry>
</section>
</Composition>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<Basic xmlns="http://hl7.org/fhir">
<code>
<coding>
<system value="http://snomed.info/sct"/>
<version value="http://snomed.info/sct/32506021000036107/version/20170403"/>
<code value="132037003"/>
<display value="Pineywoods pig breed"/>
</coding>
</code>
</Basic>

View File

@ -0,0 +1,10 @@
<Basic xmlns="http://hl7.org/fhir">
<code>
<coding>
<system value="http://snomed.info/sct"/>
<version value="http://snomed.info/sct/32506021000036107/version/20170403"/>
<code value="132037003"/>
<display value="Pineywoods pig breed. Not."/>
</coding>
</code>
</Basic>

View File

@ -0,0 +1,9 @@
<Basic xmlns="http://hl7.org/fhir">
<code>
<coding>
<system value="http://hl7.org/fhir/ValueSet/account-type"/>
<code value="132037003"/>
<display value="Pineywoods pig breed"/>
</coding>
</code>
</Basic>

View File

@ -0,0 +1,9 @@
<Basic xmlns="http://hl7.org/fhir">
<code>
<coding>
<system value="http://snomed.info/sct/32506021000036107/version/20170403"/>
<code value="132037003"/>
<display value="Pineywoods pig breed"/>
</coding>
</code>
</Basic>

View File

@ -0,0 +1,57 @@
<!--
Conforms to the document-structure template
-->
<Composition xmlns="http://hl7.org/fhir">
<id value="test-document-good"/>
<status value="final"/>
<type>
<text value="test document"/>
</type>
<date value="2018-11-06T07:14:00+11:00"/>
<author>
<display value="grahame grieve"/>
</author>
<title value="TestDocument"/>
<!-- codea section -->
<section>
<code>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-a"/>
</coding>
</code>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">Code A Section</div>
</text>
</section>
<!-- codeb section -->
<section>
<code>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-b"/>
</coding>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/other"/>
<code value="other"/>
</coding>
</code>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">Code B Section</div>
</text>
</section>
<section>
<code>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-c"/>
</coding>
</code>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">Code C Section</div>
</text>
</section>
</Composition>

View File

@ -0,0 +1,17 @@
<!--
Does not conforms to the document-structure template:
- no sections
-->
<Composition xmlns="http://hl7.org/fhir">
<id value="test-document-good"/>
<status value="final"/>
<type>
<text value="test document"/>
</type>
<date value="2018-11-06T07:14:00+11:00"/>
<author>
<display value="grahame grieve"/>
</author>
<title value="TestDocument"/>
</Composition>

View File

@ -0,0 +1,62 @@
<!--
Conforms to the document-structure template
-->
<Composition xmlns="http://hl7.org/fhir">
<id value="test-document-good"/>
<status value="final"/>
<type>
<text value="test document"/>
</type>
<date value="2018-11-06T07:14:00+11:00"/>
<author>
<display value="grahame grieve"/>
</author>
<title value="TestDocument"/>
<!-- codea section -->
<section>
<code>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-a"/>
</coding>
</code>
<focus>
<display value="some value for conformance purposes"/>
</focus>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">Code A Section</div>
</text>
</section>
<!-- codeb section -->
<section>
<title value="section title"/>
<code>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-b"/>
</coding>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/other"/>
<code value="other"/>
</coding>
</code>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">Code B Section</div>
</text>
</section>
<section>
<code>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-c"/>
</coding>
</code>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">Code C Section</div>
</text>
<mode value="working"/>
</section>
</Composition>

View File

@ -0,0 +1,104 @@
<!--
Document section library - a set of section structure definitions that are intended to be re-used elsewhere
Defines 3 sections:
- codeA
- codeB
- codeC
These should be sliced by pattern on Section.code
-->
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="document-section-library"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/document-section-library"/>
<name value="DocumentSectionLibrary"/>
<title value="Document Section Library (For testing section templates)"/>
<status value="active"/>
<experimental value="false"/>
<date value="2018-11-05T17:57:00+11:00"/>
<kind value="complex-type"/>
<abstract value="true"/>
<type value="Composition"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Composition"/>
<derivation value="constraint"/>
<differential>
<element>
<!-- this is present to work around a bug in the snapshot generator -->
<path value="Composition"/>
</element>
<element>
<!-- set up slicing on Composition.section - by the code. Actually, this slicing is never used anywhere since this library is abstract -->
<path value="Composition.section"/>
<slicing>
<discriminator>
<type value="pattern"/>
<path value="code"/>
</discriminator>
<description value="Slice by .section.code when using this library of sections"/>
<ordered value="true"/>
<rules value="closed"/>
</slicing>
</element>
<!-- code B -->
<element>
<path value="Composition.section"/>
<sliceName value="codeB"/>
</element>
<element>
<path value="Composition.section.title"/>
<min value="1"/>
</element>
<element>
<path value="Composition.section.code"/>
<min value="1"/>
<patternCodeableConcept>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-b"/>
</coding>
</patternCodeableConcept>
</element>
<!-- code A -->
<element>
<path value="Composition.section"/>
<sliceName value="codeA"/>
</element>
<element>
<path value="Composition.section.code"/>
<min value="1"/>
<patternCodeableConcept>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-a"/>
</coding>
</patternCodeableConcept>
</element>
<element>
<path value="Composition.section.focus"/>
<min value="1"/>
</element>
<!-- code C -->
<element>
<path value="Composition.section"/>
<sliceName value="codeC"/>
</element>
<element>
<path value="Composition.section.code"/>
<min value="1"/>
<patternCodeableConcept>
<coding>
<system value="http://hl7.org/fhir/test/CodeSystem/imaginary"/>
<code value="code-c"/>
</coding>
</patternCodeableConcept>
</element>
<element>
<path value="Composition.section.mode"/>
<min value="1"/>
</element>
</differential>
</StructureDefinition>

View File

@ -0,0 +1,84 @@
<!--
Document structure definition
uses the section library to require 3 sections, each
with a different code:
- code a
- code b
- code c
-->
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="document-structure"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/document-structure"/>
<name value="DocumentStructure"/>
<title value="Document Structure (For testing section templates)"/>
<status value="active"/>
<experimental value="false"/>
<date value="2018-11-05T17:47:00+11:00"/>
<kind value="complex-type"/>
<abstract value="false"/>
<type value="Composition"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Composition"/>
<derivation value="constraint"/>
<differential>
<element>
<!-- this is present to work around a bug in the snapshot generator -->
<path value="Composition"/>
</element>
<element>
<!-- set up slicing on Composition.section - by the code -->
<path value="Composition.section"/>
<slicing>
<discriminator>
<type value="pattern"/>
<path value="code"/>
</discriminator>
<description value="Slice by .section.code"/>
<ordered value="true"/>
<rules value="closed"/>
</slicing>
</element>
<element>
<!-- first slice -->
<path value="Composition.section"/>
<sliceName value="code-A"/>
<min value="1"/>
<type>
<code value="BackboneElement"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/document-section-library">
<extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element">
<valueString value="Composition.section:codeA"/>
</extension>
</profile>
</type>
</element>
<element>
<!-- first slice -->
<path value="Composition.section"/>
<sliceName value="code-B"/>
<min value="1"/>
<type>
<code value="BackboneElement"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/document-section-library">
<extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element">
<valueString value="Composition.section:codeB"/>
</extension>
</profile>
</type>
</element>
<element>
<!-- first slice -->
<path value="Composition.section"/>
<sliceName value="code-C"/>
<min value="0"/>
<type>
<code value="BackboneElement"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/document-section-library">
<extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element">
<valueString value="Composition.section:codeC"/>
</extension>
</profile>
</type>
</element>
</differential>
</StructureDefinition>

View File

@ -0,0 +1,12 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="bundle"/>
<type value="collection"/>
<entry>
<fullUrl value="http://acme.com/Patient/pat1"/>
<resource>
<Patient>
<id value="pat2"/>
</Patient>
</resource>
</entry>
</Bundle>

View File

@ -0,0 +1,14 @@
{
"resourceType": "Group",
"type": "person",
"actual": true,
"characteristic": [
{
"code": {
"text": "test"
},
"value": true,
"exclude": false
}
]
}

View File

@ -0,0 +1,21 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean];
fhir:Group.characteristic [
fhir:index 0;
fhir:Group.characteristic.code [
fhir:CodeableConcept.text [ fhir:value "test" ]
];
fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
<Group xmlns="http://hl7.org/fhir">
<type value="person"/>
<actual value="true"/>
<characteristic>
<code>
<text value="test"/>
</code>
<value value="true"/>
<exclude value="false"/>
</characteristic>
</Group>

View File

@ -0,0 +1,14 @@
{
"resourceType": "Group",
"type": "person",
"actual": true,
"characteristic": [
{
"code": {
"text": "test"
},
"valueInteger": 1,
"exclude": false
}
]
}

View File

@ -0,0 +1,21 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean];
fhir:Group.characteristic [
fhir:index 0;
fhir:Group.characteristic.code [
fhir:CodeableConcept.text [ fhir:value "test" ]
];
fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
<Group xmlns="http://hl7.org/fhir">
<type value="person"/>
<actual value="true"/>
<characteristic>
<code>
<text value="test"/>
</code>
<valueInteger value="1"/>
<exclude value="false"/>
</characteristic>
</Group>

View File

@ -0,0 +1,14 @@
{
"resourceType": "Group",
"type": "person",
"actual": true,
"characteristic": [
{
"code": {
"text": "test"
},
"valueBoolean": 1,
"exclude": false
}
]
}

View File

@ -0,0 +1,22 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean];
fhir:Group.characteristic [
fhir:index 0;
fhir:Group.characteristic.code [
fhir:CodeableConcept.text [ fhir:value "test" ]
];
fhir:Group.characteristic.valueBoolean [ fhir:value "1"^^xsd:boolean ];
fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
<Group xmlns="http://hl7.org/fhir">
<type value="person"/>
<actual value="true"/>
<characteristic>
<code>
<text value="test"/>
</code>
<valueBoolean value="1"/>
<exclude value="false"/>
</characteristic>
</Group>

View File

@ -0,0 +1,12 @@
{
"resourceType": "Group",
"type": "person",
"actual": true,
"characteristic": [
{
"code": {}
"valueBoolean": true,
"exclude": false
}
]
}

View File

@ -0,0 +1,20 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean];
fhir:Group.characteristic [
fhir:index 0;
fhir:Group.characteristic.code [ ];
fhir:Group.characteristic.valueBoolean [ fhir:value "true"^^xsd:boolean ];
fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,10 @@
<Group xmlns="http://hl7.org/fhir">
<type value="person"/>
<actual value="true"/>
<characteristic>
<code>
</code>
<valueBoolean value="true"/>
<exclude value="false"/>
</characteristic>
</Group>

View File

@ -0,0 +1,14 @@
{
"resourceType": "Group",
"type": "person",
"actual": true,
"characteristic": [
{
"code": {
"text": "test"
},
"valueBoolean": true,
"exclude": false
}
]
}

View File

@ -0,0 +1,22 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean];
fhir:Group.characteristic [
fhir:index 0;
fhir:Group.characteristic.code [
fhir:CodeableConcept.text [ fhir:value "test" ]
];
fhir:Group.characteristic.valueBoolean [ fhir:value "true"^^xsd:boolean ];
fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
<Group xmlns="http://hl7.org/fhir">
<type value="person"/>
<actual value="true"/>
<characteristic>
<code>
<text value="test"/>
</code>
<valueBoolean value="true"/>
<exclude value="false"/>
</characteristic>
</Group>

View File

@ -0,0 +1 @@
{"resourceType":"Group","type":"person","actual":true}

View File

@ -0,0 +1,14 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,5 @@
{
"resourceType": "Group",
"type": "person",
"actual": true
}

View File

@ -0,0 +1,14 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:Group;
fhir:nodeRole fhir:treeRoot;
fhir:Group.type [ fhir:value "person"];
fhir:Group.actual [ fhir:value "true"^^xsd:boolean]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,4 @@
<Group xmlns="http://hl7.org/fhir">
<type value="person"/>
<actual value="true"/>
</Group>

View File

@ -0,0 +1,14 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1"
"_id": {
"fhir_comments": [
" another comment "
]
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1">
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
{
"resourceType": "List",
"id": "val1",
"contained": [
{
"resourceType": "Patient",
"id" : "pat2"
}
],
"status": "current",
"mode": "changes",
"subject": {
"reference": "#pat"
}
}

View File

@ -0,0 +1,23 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:Resource.contained [
a fhir:Patient;
fhir:index 0;
fhir:Resource.id [ fhir:value "pat2" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"];
fhir:List.subject [
fhir:Reference.reference [ fhir:value "#pat" ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
<List xmlns="http://hl7.org/fhir">
<id value="val1"/>
<contained>
<Patient>
<id value="pat1"/>
</Patient>
</contained>
<status value="current"/>
<mode value="changes"/>
<subject>
<reference value="#pat"/>
</subject>
</List>

View File

@ -0,0 +1,15 @@
{
"resourceType": "List",
"id": "val1",
"contained": [
{
"resourceType": "Patient",
"id" : "pat"
}
],
"status": "current",
"mode": "changes",
"subject": {
"reference": "#pat"
}
}

View File

@ -0,0 +1,23 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:Resource.contained [
a fhir:Patient;
fhir:index 0;
fhir:Resource.id [ fhir:value "pat" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"];
fhir:List.subject [
fhir:Reference.reference [ fhir:value "#pat" ]
]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
<List xmlns="http://hl7.org/fhir">
<id value="val1"/>
<contained>
<Patient>
<id value="pat"/>
</Patient>
</contained>
<status value="current"/>
<mode value="changes"/>
<subject>
<reference value="#pat"/>
</subject>
</List>

View File

@ -0,0 +1,9 @@
{
"resourceType": "List",
"id": "val1",
"status": "current",
"mode": "changes",
"entry": [
{}
]
}

View File

@ -0,0 +1,16 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"];
fhir:List.entry [ fhir:index 0]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,9 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<status value="current"/>
<mode value="changes"/>
<entry/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,8 @@
{
"resourceType": "List",
"id": "val1",
"status": "current",
"mode": "changes",
"entry": [
]
}

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<status value="current"/>
<mode value="changes"/>
<entry>
<!-- a comment -->
</entry>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,22 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [
fhir:value "current";
fhir:string.extension [
fhir:index 0;
fhir:Extension.url [ fhir:value "http://acme.com/some_url" ];
fhir:Extension.valueCode [ fhir:value "code" ]
]
];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<status value="current">
<extension url="http://acme.com/some_url">
<valueCode value="code"/>
</extension>
</status>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,22 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"status": "current",
"_status": {
"extension": [
{
"url": "http://acme.com/some_url",
"valueCode": "code"
}
]
},
"mode": "changes"
}

View File

@ -0,0 +1,22 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [
fhir:value "current";
fhir:string.extension [
fhir:index 0;
fhir:Extension.url [ fhir:value "http://acme.com/some_url" ];
fhir:Extension.valueCode [ fhir:value "code" ]
]
];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,22 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"status": "current",
"_status": {
"extension": [
{
"url": "http://acme.com/some_url",
"valueCodeX": "code"
}
]
},
"mode": "changes"
}

View File

@ -0,0 +1,21 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [
fhir:value "current";
fhir:string.extension [
fhir:index 0;
fhir:Extension.url [ fhir:value "http://acme.com/some_url" ]
]
];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1">some text</id>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1" other="nothing"/>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,9 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<status value="current"/>
<mode value="changes"/>
<mode1 value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"other" : "nothing",
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,6 @@
{
"resourceType": "List",
"id": "val1",
"status": "current1",
"mode": "changes"
}

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current1"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<status value="current1"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir1">
<!-- another comment -->
<id value="val1"/>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id xmlns="http://hl7.org/fhir1" value="val1"/>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
<!-- this is all valid -->
<f:List xmlns:f="http://hl7.org/fhir">
<!-- another comment -->
<f1:id xmlns:f1="http://hl7.org/fhir1" value="val1"/>
<f:status value="current"/>
<f:mode value="changes"/>
</f:List>
<!-- ending comment -->

View File

@ -0,0 +1,6 @@
{
"resourceType": "List",
"id": "val1",
"mode": "changes",
"status": "current"
}

View File

@ -0,0 +1,15 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,5 @@
<List xmlns="http://hl7.org/fhir">
<id value="val1"/>
<mode value="changes"/>
<status value="current"/>
</List>

View File

@ -0,0 +1,18 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <p onClick=\"check\">This is some narrative</p>\n </div>"
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,18 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p onClick="check">This is some narrative</p>
</div>
</text>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,18 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <p>This is some narrative</p>\n </div>"
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,18 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>This is some narrative</p>
</div>
</text>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,18 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"text": {
"status": "generated",
"div": "<n:div xmlns:n=\"http://www.w3.org/1999/xhtml\">\n <n:p>This is some narrative</n:p>\n </n:div>"
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,18 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<text>
<status value="generated"/>
<n:div xmlns:n="http://www.w3.org/1999/xhtml">
<n:p>This is some narrative</n:p>
</n:div>
</text>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,18 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <object value=\"false\"/> <p>This is some narrative</p>\n </div>"
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,18 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

View File

@ -0,0 +1,15 @@
<!-- this is all valid -->
<List xmlns="http://hl7.org/fhir">
<!-- another comment -->
<id value="val1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>This is some narrative</p>
<object value="false"/>
</div>
</text>
<status value="current"/>
<mode value="changes"/>
</List>
<!-- ending comment -->

View File

@ -0,0 +1,18 @@
{
"resourceType": "List",
"fhir_comments": [
" this is all valid "
],
"id": "val1",
"_id": {
"fhir_comments": [
" another comment "
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <p>This is some narrative</pa>\n </div>"
},
"status": "current",
"mode": "changes"
}

View File

@ -0,0 +1,18 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
[a fhir:List;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "val1"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ]
];
fhir:List.status [ fhir:value "current"];
fhir:List.mode [ fhir:value "changes"]].
# -------------------------------------------------------------------------------------

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