refactor FHIRPath package
This commit is contained in:
parent
516ec50afa
commit
18c4419b9e
|
@ -18,6 +18,7 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode;
|
import org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode;
|
||||||
import org.hl7.fhir.r4.utils.ToolingExtensions;
|
import org.hl7.fhir.r4.utils.ToolingExtensions;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathConstant;
|
||||||
import org.hl7.fhir.r5.model.BooleanType;
|
import org.hl7.fhir.r5.model.BooleanType;
|
||||||
import org.hl7.fhir.r5.model.DataType;
|
import org.hl7.fhir.r5.model.DataType;
|
||||||
import org.hl7.fhir.r5.model.DecimalType;
|
import org.hl7.fhir.r5.model.DecimalType;
|
||||||
|
@ -25,7 +26,6 @@ import org.hl7.fhir.r5.model.IdType;
|
||||||
import org.hl7.fhir.r5.model.IntegerType;
|
import org.hl7.fhir.r5.model.IntegerType;
|
||||||
import org.hl7.fhir.r5.model.StringType;
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathConstant;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4b.model.StructureMap.StructureMapGroupTypeMode;
|
import org.hl7.fhir.r4b.model.StructureMap.StructureMapGroupTypeMode;
|
||||||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathConstant;
|
||||||
import org.hl7.fhir.r5.model.BooleanType;
|
import org.hl7.fhir.r5.model.BooleanType;
|
||||||
import org.hl7.fhir.r5.model.DataType;
|
import org.hl7.fhir.r5.model.DataType;
|
||||||
import org.hl7.fhir.r5.model.DecimalType;
|
import org.hl7.fhir.r5.model.DecimalType;
|
||||||
|
@ -25,7 +26,6 @@ import org.hl7.fhir.r5.model.IdType;
|
||||||
import org.hl7.fhir.r5.model.IntegerType;
|
import org.hl7.fhir.r5.model.IntegerType;
|
||||||
import org.hl7.fhir.r5.model.StringType;
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathConstant;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -37,13 +37,13 @@ import java.util.List;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
|
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.dstu3.formats.FormatUtilities;
|
import org.hl7.fhir.dstu3.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.dstu3.model.ElementDefinition;
|
import org.hl7.fhir.dstu3.model.ElementDefinition;
|
||||||
import org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation;
|
import org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation;
|
||||||
import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||||
import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.dstu3.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.dstu3.utils.ToolingExtensions;
|
import org.hl7.fhir.dstu3.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,586 @@
|
||||||
|
package org.hl7.fhir.dstu3.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class ExpressionNode {
|
||||||
|
|
||||||
|
public enum Kind {
|
||||||
|
Name, Function, Constant, Group
|
||||||
|
}
|
||||||
|
public static class SourceLocation {
|
||||||
|
private int line;
|
||||||
|
private int column;
|
||||||
|
public SourceLocation(int line, int column) {
|
||||||
|
super();
|
||||||
|
this.line = line;
|
||||||
|
this.column = column;
|
||||||
|
}
|
||||||
|
public int getLine() {
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
public int getColumn() {
|
||||||
|
return column;
|
||||||
|
}
|
||||||
|
public void setLine(int line) {
|
||||||
|
this.line = line;
|
||||||
|
}
|
||||||
|
public void setColumn(int column) {
|
||||||
|
this.column = column;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return Integer.toString(line)+", "+Integer.toString(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public enum Function {
|
||||||
|
Custom,
|
||||||
|
|
||||||
|
Empty, Not, Exists, SubsetOf, SupersetOf, IsDistinct, Distinct, Count, Where, Select, All, Repeat, Item /*implicit from name[]*/, As, Is, Single,
|
||||||
|
First, Last, Tail, Skip, Take, Iif, ToInteger, ToDecimal, ToString, Substring, StartsWith, EndsWith, Matches, ReplaceMatches, Contains, Replace, Length,
|
||||||
|
Children, Descendants, MemberOf, Trace, Today, Now, Resolve, Extension, HasValue, AliasAs, Alias;
|
||||||
|
|
||||||
|
public static Function fromCode(String name) {
|
||||||
|
if (name.equals("empty")) return Function.Empty;
|
||||||
|
if (name.equals("not")) return Function.Not;
|
||||||
|
if (name.equals("exists")) return Function.Exists;
|
||||||
|
if (name.equals("subsetOf")) return Function.SubsetOf;
|
||||||
|
if (name.equals("supersetOf")) return Function.SupersetOf;
|
||||||
|
if (name.equals("isDistinct")) return Function.IsDistinct;
|
||||||
|
if (name.equals("distinct")) return Function.Distinct;
|
||||||
|
if (name.equals("count")) return Function.Count;
|
||||||
|
if (name.equals("where")) return Function.Where;
|
||||||
|
if (name.equals("select")) return Function.Select;
|
||||||
|
if (name.equals("all")) return Function.All;
|
||||||
|
if (name.equals("repeat")) return Function.Repeat;
|
||||||
|
if (name.equals("item")) return Function.Item;
|
||||||
|
if (name.equals("as")) return Function.As;
|
||||||
|
if (name.equals("is")) return Function.Is;
|
||||||
|
if (name.equals("single")) return Function.Single;
|
||||||
|
if (name.equals("first")) return Function.First;
|
||||||
|
if (name.equals("last")) return Function.Last;
|
||||||
|
if (name.equals("tail")) return Function.Tail;
|
||||||
|
if (name.equals("skip")) return Function.Skip;
|
||||||
|
if (name.equals("take")) return Function.Take;
|
||||||
|
if (name.equals("iif")) return Function.Iif;
|
||||||
|
if (name.equals("toInteger")) return Function.ToInteger;
|
||||||
|
if (name.equals("toDecimal")) return Function.ToDecimal;
|
||||||
|
if (name.equals("toString")) return Function.ToString;
|
||||||
|
if (name.equals("substring")) return Function.Substring;
|
||||||
|
if (name.equals("startsWith")) return Function.StartsWith;
|
||||||
|
if (name.equals("endsWith")) return Function.EndsWith;
|
||||||
|
if (name.equals("matches")) return Function.Matches;
|
||||||
|
if (name.equals("replaceMatches")) return Function.ReplaceMatches;
|
||||||
|
if (name.equals("contains")) return Function.Contains;
|
||||||
|
if (name.equals("replace")) return Function.Replace;
|
||||||
|
if (name.equals("length")) return Function.Length;
|
||||||
|
if (name.equals("children")) return Function.Children;
|
||||||
|
if (name.equals("descendants")) return Function.Descendants;
|
||||||
|
if (name.equals("memberOf")) return Function.MemberOf;
|
||||||
|
if (name.equals("trace")) return Function.Trace;
|
||||||
|
if (name.equals("today")) return Function.Today;
|
||||||
|
if (name.equals("now")) return Function.Now;
|
||||||
|
if (name.equals("resolve")) return Function.Resolve;
|
||||||
|
if (name.equals("extension")) return Function.Extension;
|
||||||
|
if (name.equals("hasValue")) return Function.HasValue;
|
||||||
|
if (name.equals("alias")) return Function.Alias;
|
||||||
|
if (name.equals("aliasAs")) return Function.AliasAs;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Empty : return "empty";
|
||||||
|
case Not : return "not";
|
||||||
|
case Exists : return "exists";
|
||||||
|
case SubsetOf : return "subsetOf";
|
||||||
|
case SupersetOf : return "supersetOf";
|
||||||
|
case IsDistinct : return "isDistinct";
|
||||||
|
case Distinct : return "distinct";
|
||||||
|
case Count : return "count";
|
||||||
|
case Where : return "where";
|
||||||
|
case Select : return "select";
|
||||||
|
case All : return "all";
|
||||||
|
case Repeat : return "repeat";
|
||||||
|
case Item : return "item";
|
||||||
|
case As : return "as";
|
||||||
|
case Is : return "is";
|
||||||
|
case Single : return "single";
|
||||||
|
case First : return "first";
|
||||||
|
case Last : return "last";
|
||||||
|
case Tail : return "tail";
|
||||||
|
case Skip : return "skip";
|
||||||
|
case Take : return "take";
|
||||||
|
case Iif : return "iif";
|
||||||
|
case ToInteger : return "toInteger";
|
||||||
|
case ToDecimal : return "toDecimal";
|
||||||
|
case ToString : return "toString";
|
||||||
|
case Substring : return "substring";
|
||||||
|
case StartsWith : return "startsWith";
|
||||||
|
case EndsWith : return "endsWith";
|
||||||
|
case Matches : return "matches";
|
||||||
|
case ReplaceMatches : return "replaceMatches";
|
||||||
|
case Contains : return "contains";
|
||||||
|
case Replace : return "replace";
|
||||||
|
case Length : return "length";
|
||||||
|
case Children : return "children";
|
||||||
|
case Descendants : return "descendants";
|
||||||
|
case MemberOf : return "memberOf";
|
||||||
|
case Trace : return "trace";
|
||||||
|
case Today : return "today";
|
||||||
|
case Now : return "now";
|
||||||
|
case Resolve : return "resolve";
|
||||||
|
case Extension : return "extension";
|
||||||
|
case HasValue : return "hasValue";
|
||||||
|
case Alias : return "alias";
|
||||||
|
case AliasAs : return "aliasAs";
|
||||||
|
default: return "??";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Operation {
|
||||||
|
Equals, Equivalent, NotEquals, NotEquivalent, LessThen, Greater, LessOrEqual, GreaterOrEqual, Is, As, Union, Or, And, Xor, Implies,
|
||||||
|
Times, DivideBy, Plus, Minus, Concatenate, Div, Mod, In, Contains;
|
||||||
|
|
||||||
|
public static Operation fromCode(String name) {
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return null;
|
||||||
|
if (name.equals("="))
|
||||||
|
return Operation.Equals;
|
||||||
|
if (name.equals("~"))
|
||||||
|
return Operation.Equivalent;
|
||||||
|
if (name.equals("!="))
|
||||||
|
return Operation.NotEquals;
|
||||||
|
if (name.equals("!~"))
|
||||||
|
return Operation.NotEquivalent;
|
||||||
|
if (name.equals(">"))
|
||||||
|
return Operation.Greater;
|
||||||
|
if (name.equals("<"))
|
||||||
|
return Operation.LessThen;
|
||||||
|
if (name.equals(">="))
|
||||||
|
return Operation.GreaterOrEqual;
|
||||||
|
if (name.equals("<="))
|
||||||
|
return Operation.LessOrEqual;
|
||||||
|
if (name.equals("|"))
|
||||||
|
return Operation.Union;
|
||||||
|
if (name.equals("or"))
|
||||||
|
return Operation.Or;
|
||||||
|
if (name.equals("and"))
|
||||||
|
return Operation.And;
|
||||||
|
if (name.equals("xor"))
|
||||||
|
return Operation.Xor;
|
||||||
|
if (name.equals("is"))
|
||||||
|
return Operation.Is;
|
||||||
|
if (name.equals("as"))
|
||||||
|
return Operation.As;
|
||||||
|
if (name.equals("*"))
|
||||||
|
return Operation.Times;
|
||||||
|
if (name.equals("/"))
|
||||||
|
return Operation.DivideBy;
|
||||||
|
if (name.equals("+"))
|
||||||
|
return Operation.Plus;
|
||||||
|
if (name.equals("-"))
|
||||||
|
return Operation.Minus;
|
||||||
|
if (name.equals("&"))
|
||||||
|
return Operation.Concatenate;
|
||||||
|
if (name.equals("implies"))
|
||||||
|
return Operation.Implies;
|
||||||
|
if (name.equals("div"))
|
||||||
|
return Operation.Div;
|
||||||
|
if (name.equals("mod"))
|
||||||
|
return Operation.Mod;
|
||||||
|
if (name.equals("in"))
|
||||||
|
return Operation.In;
|
||||||
|
if (name.equals("contains"))
|
||||||
|
return Operation.Contains;
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Equals : return "=";
|
||||||
|
case Equivalent : return "~";
|
||||||
|
case NotEquals : return "!=";
|
||||||
|
case NotEquivalent : return "!~";
|
||||||
|
case Greater : return ">";
|
||||||
|
case LessThen : return "<";
|
||||||
|
case GreaterOrEqual : return ">=";
|
||||||
|
case LessOrEqual : return "<=";
|
||||||
|
case Union : return "|";
|
||||||
|
case Or : return "or";
|
||||||
|
case And : return "and";
|
||||||
|
case Xor : return "xor";
|
||||||
|
case Times : return "*";
|
||||||
|
case DivideBy : return "/";
|
||||||
|
case Plus : return "+";
|
||||||
|
case Minus : return "-";
|
||||||
|
case Concatenate : return "&";
|
||||||
|
case Implies : return "implies";
|
||||||
|
case Is : return "is";
|
||||||
|
case As : return "as";
|
||||||
|
case Div : return "div";
|
||||||
|
case Mod : return "mod";
|
||||||
|
case In : return "in";
|
||||||
|
case Contains : return "contains";
|
||||||
|
default: return "??";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CollectionStatus {
|
||||||
|
SINGLETON, ORDERED, UNORDERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//the expression will have one of either name or constant
|
||||||
|
private String uniqueId;
|
||||||
|
private Kind kind;
|
||||||
|
private String name;
|
||||||
|
private String constant;
|
||||||
|
private Function function;
|
||||||
|
private List<ExpressionNode> parameters; // will be created if there is a function
|
||||||
|
private ExpressionNode inner;
|
||||||
|
private ExpressionNode group;
|
||||||
|
private Operation operation;
|
||||||
|
private boolean proximal; // a proximal operation is the first in the sequence of operations. This is significant when evaluating the outcomes
|
||||||
|
private ExpressionNode opNext;
|
||||||
|
private SourceLocation start;
|
||||||
|
private SourceLocation end;
|
||||||
|
private SourceLocation opStart;
|
||||||
|
private SourceLocation opEnd;
|
||||||
|
private TypeDetails types;
|
||||||
|
private TypeDetails opTypes;
|
||||||
|
|
||||||
|
|
||||||
|
public ExpressionNode(int uniqueId) {
|
||||||
|
super();
|
||||||
|
this.uniqueId = Integer.toString(uniqueId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
if (function == Function.Item)
|
||||||
|
b.append("[");
|
||||||
|
else {
|
||||||
|
b.append(name);
|
||||||
|
b.append("(");
|
||||||
|
}
|
||||||
|
boolean first = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
b.append(n.toString());
|
||||||
|
}
|
||||||
|
if (function == Function.Item)
|
||||||
|
b.append("]");
|
||||||
|
else {
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
b.append(Utilities.escapeJava(constant));
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append("(");
|
||||||
|
b.append(group.toString());
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
b.append(".");
|
||||||
|
b.append(inner.toString());
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(" ");
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(" ");
|
||||||
|
b.append(opNext.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getConstant() {
|
||||||
|
return constant;
|
||||||
|
}
|
||||||
|
public void setConstant(String constant) {
|
||||||
|
this.constant = constant;
|
||||||
|
}
|
||||||
|
public Function getFunction() {
|
||||||
|
return function;
|
||||||
|
}
|
||||||
|
public void setFunction(Function function) {
|
||||||
|
this.function = function;
|
||||||
|
if (parameters == null)
|
||||||
|
parameters = new ArrayList<ExpressionNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isProximal() {
|
||||||
|
return proximal;
|
||||||
|
}
|
||||||
|
public void setProximal(boolean proximal) {
|
||||||
|
this.proximal = proximal;
|
||||||
|
}
|
||||||
|
public Operation getOperation() {
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
public void setOperation(Operation operation) {
|
||||||
|
this.operation = operation;
|
||||||
|
}
|
||||||
|
public ExpressionNode getInner() {
|
||||||
|
return inner;
|
||||||
|
}
|
||||||
|
public void setInner(ExpressionNode value) {
|
||||||
|
this.inner = value;
|
||||||
|
}
|
||||||
|
public ExpressionNode getOpNext() {
|
||||||
|
return opNext;
|
||||||
|
}
|
||||||
|
public void setOpNext(ExpressionNode value) {
|
||||||
|
this.opNext = value;
|
||||||
|
}
|
||||||
|
public List<ExpressionNode> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
public boolean checkName() {
|
||||||
|
if (!name.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return name.equals("$this");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kind getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKind(Kind kind) {
|
||||||
|
this.kind = kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroup(ExpressionNode group) {
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(SourceLocation start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(SourceLocation end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpStart() {
|
||||||
|
return opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpStart(SourceLocation opStart) {
|
||||||
|
this.opStart = opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpEnd() {
|
||||||
|
return opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpEnd(SourceLocation opEnd) {
|
||||||
|
this.opEnd = opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int parameterCount() {
|
||||||
|
if (parameters == null)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return parameters.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Canonical() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
write(b);
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String summary() {
|
||||||
|
switch (kind) {
|
||||||
|
case Name: return uniqueId+": "+name;
|
||||||
|
case Function: return uniqueId+": "+function.toString()+"()";
|
||||||
|
case Constant: return uniqueId+": "+constant;
|
||||||
|
case Group: return uniqueId+": (Group)";
|
||||||
|
}
|
||||||
|
return "??";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(StringBuilder b) {
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
b.append(constant);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
b.append(function.toCode());
|
||||||
|
b.append('(');
|
||||||
|
boolean f = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (f)
|
||||||
|
f = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
n.write(b);
|
||||||
|
}
|
||||||
|
b.append(')');
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append('(');
|
||||||
|
group.write(b);
|
||||||
|
b.append(')');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inner != null) {
|
||||||
|
b.append('.');
|
||||||
|
inner.write(b);
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(' ');
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(' ');
|
||||||
|
opNext.write(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String check() {
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return "No Name provided @ "+location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Function:
|
||||||
|
if (function == null)
|
||||||
|
return "No Function id provided @ "+location();
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
String msg = n.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Constant:
|
||||||
|
if (Utilities.noString(constant))
|
||||||
|
return "No Constant provided @ "+location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Group:
|
||||||
|
if (group == null)
|
||||||
|
return "No Group provided @ "+location();
|
||||||
|
else {
|
||||||
|
String msg = group.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
String msg = inner.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (operation == null) {
|
||||||
|
|
||||||
|
if (opNext != null)
|
||||||
|
return "Next provided when it shouldn't be @ "+location();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (opNext == null)
|
||||||
|
return "No Next provided @ "+location();
|
||||||
|
else
|
||||||
|
opNext.check();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String location() {
|
||||||
|
return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypes(TypeDetails types) {
|
||||||
|
this.types = types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getOpTypes() {
|
||||||
|
return opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpTypes(TypeDetails opTypes) {
|
||||||
|
this.opTypes = opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,342 @@
|
||||||
|
package org.hl7.fhir.dstu3.fhirpath;
|
||||||
|
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode.SourceLocation;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
// shared lexer for concrete syntaxes
|
||||||
|
// - FluentPath
|
||||||
|
// - Mapping language
|
||||||
|
|
||||||
|
public class FHIRLexer {
|
||||||
|
public class FHIRLexerException extends FHIRException {
|
||||||
|
|
||||||
|
public FHIRLexerException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private String source;
|
||||||
|
private int cursor;
|
||||||
|
private int currentStart;
|
||||||
|
private String current;
|
||||||
|
private SourceLocation currentLocation;
|
||||||
|
private SourceLocation currentStartLocation;
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
public FHIRLexer(String source) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public String getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
public SourceLocation getCurrentLocation() {
|
||||||
|
return currentLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConstant(boolean incDoubleQuotes) {
|
||||||
|
return current.charAt(0) == '\'' || (incDoubleQuotes && current.charAt(0) == '"') || current.charAt(0) == '@' || current.charAt(0) == '%' ||
|
||||||
|
current.charAt(0) == '-' || current.charAt(0) == '+' || (current.charAt(0) >= '0' && current.charAt(0) <= '9') ||
|
||||||
|
current.equals("true") || current.equals("false") || current.equals("{}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStringConstant() {
|
||||||
|
return current.charAt(0) == '\'' || current.charAt(0) == '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
public String take() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
next();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int takeInt() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
if (!Utilities.isInteger(s))
|
||||||
|
throw error("Found "+current+" expecting an integer");
|
||||||
|
next();
|
||||||
|
return Integer.parseInt(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToken() {
|
||||||
|
if (Utilities.noString(current))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (current.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (current.equals("*") || current.equals("**"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((current.charAt(0) >= 'A' && current.charAt(0) <= 'Z') || (current.charAt(0) >= 'a' && current.charAt(0) <= 'z')) {
|
||||||
|
for (int i = 1; i < current.length(); i++)
|
||||||
|
if (!( (current.charAt(1) >= 'A' && current.charAt(1) <= 'Z') || (current.charAt(1) >= 'a' && current.charAt(1) <= 'z') ||
|
||||||
|
(current.charAt(1) >= '0' && current.charAt(1) <= '9')))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg) {
|
||||||
|
return error(msg, currentLocation.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg, String location) {
|
||||||
|
return new FHIRLexerException("Error at "+location+": "+msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void next() throws FHIRLexerException {
|
||||||
|
current = null;
|
||||||
|
boolean last13 = false;
|
||||||
|
while (cursor < source.length() && Character.isWhitespace(source.charAt(cursor))) {
|
||||||
|
if (source.charAt(cursor) == '\r') {
|
||||||
|
currentLocation.setLine(currentLocation.getLine() + 1);
|
||||||
|
currentLocation.setColumn(1);
|
||||||
|
last13 = true;
|
||||||
|
} else if (!last13 && (source.charAt(cursor) == '\n')) {
|
||||||
|
currentLocation.setLine(currentLocation.getLine() + 1);
|
||||||
|
currentLocation.setColumn(1);
|
||||||
|
last13 = false;
|
||||||
|
} else {
|
||||||
|
last13 = false;
|
||||||
|
currentLocation.setColumn(currentLocation.getColumn() + 1);
|
||||||
|
}
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
currentStart = cursor;
|
||||||
|
currentStartLocation = currentLocation;
|
||||||
|
if (cursor < source.length()) {
|
||||||
|
char ch = source.charAt(cursor);
|
||||||
|
if (ch == '!' || ch == '>' || ch == '<' || ch == ':' || ch == '-' || ch == '=') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '=' || source.charAt(cursor) == '~' || source.charAt(cursor) == '-'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '.' ) {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '.'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch >= '0' && ch <= '9') {
|
||||||
|
cursor++;
|
||||||
|
boolean dotted = false;
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || (source.charAt(cursor) == '.') && !dotted)) {
|
||||||
|
if (source.charAt(cursor) == '.')
|
||||||
|
dotted = true;
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (source.charAt(cursor-1) == '.')
|
||||||
|
cursor--;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z') || (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z') ||
|
||||||
|
(source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == '_'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '%') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '"')) {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) != '"'))
|
||||||
|
cursor++;
|
||||||
|
cursor++;
|
||||||
|
} else
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z') || (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z') ||
|
||||||
|
(source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == ':' || source.charAt(cursor) == '-'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '/') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '/')) {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && !((source.charAt(cursor) == '\r') || source.charAt(cursor) == '\n'))
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '$') {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '{') {
|
||||||
|
cursor++;
|
||||||
|
ch = source.charAt(cursor);
|
||||||
|
if (ch == '}')
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '"'){
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '"')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "\""+source.substring(currentStart+1, cursor-1)+"\"";
|
||||||
|
} else if (ch == '\''){
|
||||||
|
cursor++;
|
||||||
|
char ech = ch;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != ech)) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
if (ech == '\'')
|
||||||
|
current = "\'"+current.substring(1, current.length() - 1)+"\'";
|
||||||
|
} else if (ch == '@'){
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && isDateChar(source.charAt(cursor)))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else { // if CharInSet(ch, ['.', ',', '(', ')', '=', '$']) then
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isDateChar(char ch) {
|
||||||
|
return ch == '-' || ch == ':' || ch == 'T' || ch == '+' || ch == 'Z' || Character.isDigit(ch);
|
||||||
|
}
|
||||||
|
public boolean isOp() {
|
||||||
|
return ExpressionNode.Operation.fromCode(current) != null;
|
||||||
|
}
|
||||||
|
public boolean done() {
|
||||||
|
return currentStart >= source.length();
|
||||||
|
}
|
||||||
|
public int nextId() {
|
||||||
|
id++;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public SourceLocation getCurrentStartLocation() {
|
||||||
|
return currentStartLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special case use
|
||||||
|
public void setCurrent(String current) {
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasComment() {
|
||||||
|
return !done() && current.startsWith("//");
|
||||||
|
}
|
||||||
|
public boolean hasToken(String kw) {
|
||||||
|
return !done() && kw.equals(current);
|
||||||
|
}
|
||||||
|
public boolean hasToken(String... names) {
|
||||||
|
if (done())
|
||||||
|
return false;
|
||||||
|
for (String s : names)
|
||||||
|
if (s.equals(current))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void token(String kw) throws FHIRLexerException {
|
||||||
|
if (!kw.equals(current))
|
||||||
|
throw error("Found \""+current+"\" expecting \""+kw+"\"");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readConstant(String desc) throws FHIRLexerException {
|
||||||
|
if (!isStringConstant())
|
||||||
|
throw error("Found "+current+" expecting \"["+desc+"]\"");
|
||||||
|
|
||||||
|
return processConstant(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processConstant(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length()-1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i+4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown character escape \\"+s.charAt(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void skipToken(String token) throws FHIRLexerException {
|
||||||
|
if (getCurrent().equals(token))
|
||||||
|
next();
|
||||||
|
|
||||||
|
}
|
||||||
|
public String takeDottedToken() throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append(take());
|
||||||
|
while (!done() && getCurrent().equals(".")) {
|
||||||
|
b.append(take());
|
||||||
|
b.append(take());
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skipComments() throws FHIRLexerException {
|
||||||
|
while (!done() && hasComment())
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,109 @@
|
||||||
|
package org.hl7.fhir.dstu3.fhirpath;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hl7.fhir.dstu3.model.Base;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
|
public class FHIRPathUtilityClasses {
|
||||||
|
|
||||||
|
|
||||||
|
public static class ExecutionContext {
|
||||||
|
private Object appInfo;
|
||||||
|
private Base resource;
|
||||||
|
private Base context;
|
||||||
|
private Base thisItem;
|
||||||
|
private Map<String, Base> aliases;
|
||||||
|
|
||||||
|
public ExecutionContext(Object appInfo, Base resource, Base context, Map<String, Base> aliases, Base thisItem) {
|
||||||
|
this.appInfo = appInfo;
|
||||||
|
this.context = context;
|
||||||
|
this.resource = resource;
|
||||||
|
this.aliases = aliases;
|
||||||
|
this.thisItem = thisItem;
|
||||||
|
}
|
||||||
|
public Base getResource() {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
public Base getThisItem() {
|
||||||
|
return thisItem;
|
||||||
|
}
|
||||||
|
public void addAlias(String name, List<Base> focus) throws FHIRException {
|
||||||
|
if (aliases == null)
|
||||||
|
aliases = new HashMap<String, Base>();
|
||||||
|
else
|
||||||
|
aliases = new HashMap<String, Base>(aliases); // clone it, since it's going to change
|
||||||
|
if (focus.size() > 1)
|
||||||
|
throw new FHIRException("Attempt to alias a collection, not a singleton");
|
||||||
|
aliases.put(name, focus.size() == 0 ? null : focus.get(0));
|
||||||
|
}
|
||||||
|
public Base getAlias(String name) {
|
||||||
|
return aliases == null ? null : aliases.get(name);
|
||||||
|
}
|
||||||
|
public Object getAppInfo() {
|
||||||
|
return appInfo;
|
||||||
|
}
|
||||||
|
public Base getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
public Map<String, Base> getAliases() {
|
||||||
|
return aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExecutionTypeContext {
|
||||||
|
private Object appInfo;
|
||||||
|
private String resource;
|
||||||
|
private String context;
|
||||||
|
private TypeDetails thisItem;
|
||||||
|
|
||||||
|
|
||||||
|
public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) {
|
||||||
|
super();
|
||||||
|
this.appInfo = appInfo;
|
||||||
|
this.resource = resource;
|
||||||
|
this.context = context;
|
||||||
|
this.thisItem = thisItem;
|
||||||
|
|
||||||
|
}
|
||||||
|
public String getResource() {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
public TypeDetails getThisItem() {
|
||||||
|
return thisItem;
|
||||||
|
}
|
||||||
|
public Object getAppInfo() {
|
||||||
|
return appInfo;
|
||||||
|
}
|
||||||
|
public String getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FunctionDetails {
|
||||||
|
private String description;
|
||||||
|
private int minParameters;
|
||||||
|
private int maxParameters;
|
||||||
|
public FunctionDetails(String description, int minParameters, int maxParameters) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.minParameters = minParameters;
|
||||||
|
this.maxParameters = maxParameters;
|
||||||
|
}
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public int getMinParameters() {
|
||||||
|
return minParameters;
|
||||||
|
}
|
||||||
|
public int getMaxParameters() {
|
||||||
|
return maxParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,281 @@
|
||||||
|
package org.hl7.fhir.dstu3.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
|
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class TypeDetails {
|
||||||
|
public static class ProfiledType {
|
||||||
|
private String uri;
|
||||||
|
private List<String> profiles; // or, not and
|
||||||
|
private List<ElementDefinitionBindingComponent> bindings;
|
||||||
|
|
||||||
|
public ProfiledType(String n) {
|
||||||
|
uri = ns(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProfiles() {
|
||||||
|
return profiles != null && profiles.size() > 0;
|
||||||
|
}
|
||||||
|
public List<String> getProfiles() {
|
||||||
|
return profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBindings() {
|
||||||
|
return bindings != null && bindings.size() > 0;
|
||||||
|
}
|
||||||
|
public List<ElementDefinitionBindingComponent> getBindings() {
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String ns(String n) {
|
||||||
|
return Utilities.isAbsoluteUrl(n) ? n : "http://hl7.org/fhir/StructureDefinition/"+n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfile(String profile) {
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
profiles.add(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBinding(ElementDefinitionBindingComponent binding) {
|
||||||
|
bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
bindings.add(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBinding(ElementDefinitionBindingComponent b) {
|
||||||
|
return false; // todo: do we need to do this?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProfiledType> types = new ArrayList<ProfiledType>();
|
||||||
|
private CollectionStatus collectionStatus;
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, String... names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
this.types.add(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, Set<String> names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, ProfiledType pt) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
this.types.add(pt);
|
||||||
|
}
|
||||||
|
public String addType(String n) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public String addType(String n, String p) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
pt.addProfile(p);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public void addType(ProfiledType pt) {
|
||||||
|
for (ProfiledType et : types) {
|
||||||
|
if (et.uri.equals(pt.uri)) {
|
||||||
|
if (pt.profiles != null) {
|
||||||
|
for (String p : pt.profiles) {
|
||||||
|
if (et.profiles == null)
|
||||||
|
et.profiles = new ArrayList<String>();
|
||||||
|
if (!et.profiles.contains(p))
|
||||||
|
et.profiles.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pt.bindings != null) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.bindings) {
|
||||||
|
if (et.bindings == null)
|
||||||
|
et.bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
if (!et.hasBinding(b))
|
||||||
|
et.bindings.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTypes(Collection<String> names) {
|
||||||
|
for (String n : names)
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(IWorkerContext context, String... tn) {
|
||||||
|
for (String n: tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (String n: tn) {
|
||||||
|
String id = n.contains("#") ? n.substring(0, n.indexOf("#")) : n;
|
||||||
|
String tail = null;
|
||||||
|
if (n.contains("#")) {
|
||||||
|
tail = n.substring( n.indexOf("#")+1);
|
||||||
|
tail = tail.substring(tail.indexOf("."));
|
||||||
|
}
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
StructureDefinition sd = context.fetchResource(StructureDefinition.class, t);
|
||||||
|
while (sd != null) {
|
||||||
|
if (tail == null && typesContains(sd.getUrl()))
|
||||||
|
return true;
|
||||||
|
if (tail != null && typesContains(sd.getUrl()+"#"+sd.getType()+tail))
|
||||||
|
return true;
|
||||||
|
if (sd.hasBaseDefinition())
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
||||||
|
else
|
||||||
|
sd = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean typesContains(String t) {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.equals(t))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(TypeDetails source) {
|
||||||
|
for (ProfiledType pt : source.types)
|
||||||
|
addType(pt);
|
||||||
|
if (collectionStatus == null)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else if (source.collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else
|
||||||
|
collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
}
|
||||||
|
public TypeDetails union(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
result.addType(pt);
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNoTypes() {
|
||||||
|
return types.isEmpty();
|
||||||
|
}
|
||||||
|
public Set<String> getTypes() {
|
||||||
|
Set<String> res = new HashSet<String>();
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
res.add(pt.uri);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public TypeDetails toSingleton() {
|
||||||
|
TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
|
||||||
|
result.types.addAll(types);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public CollectionStatus getCollectionStatus() {
|
||||||
|
return collectionStatus;
|
||||||
|
}
|
||||||
|
public boolean hasType(Set<String> tn) {
|
||||||
|
for (String n: tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public String describe() {
|
||||||
|
return getTypes().toString();
|
||||||
|
}
|
||||||
|
public String getType() {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return (collectionStatus == null ? collectionStatus.SINGLETON.toString() : collectionStatus.toString()) + getTypes().toString();
|
||||||
|
}
|
||||||
|
public String getTypeCode() throws DefinitionException {
|
||||||
|
if (types.size() != 1)
|
||||||
|
throw new DefinitionException("Multiple types? ("+types.toString()+")");
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.startsWith("http://hl7.org/fhir/StructureDefinition/"))
|
||||||
|
return pt.uri.substring(40);
|
||||||
|
else
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public List<ProfiledType> getProfiledTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
public boolean hasBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
if (pt.hasBindings())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public ElementDefinitionBindingComponent getBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.getBindings())
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine;
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2011+, HL7, Inc.
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
@ -44,7 +45,6 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||||
import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent;
|
import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent;
|
||||||
import org.hl7.fhir.dstu3.model.DomainResource;
|
import org.hl7.fhir.dstu3.model.DomainResource;
|
||||||
import org.hl7.fhir.dstu3.model.Element;
|
import org.hl7.fhir.dstu3.model.Element;
|
||||||
import org.hl7.fhir.dstu3.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.dstu3.model.IntegerType;
|
import org.hl7.fhir.dstu3.model.IntegerType;
|
||||||
import org.hl7.fhir.dstu3.model.Property;
|
import org.hl7.fhir.dstu3.model.Property;
|
||||||
import org.hl7.fhir.dstu3.model.Reference;
|
import org.hl7.fhir.dstu3.model.Reference;
|
||||||
|
|
|
@ -50,6 +50,15 @@ import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||||
import org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult;
|
import org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult;
|
||||||
import org.hl7.fhir.dstu3.elementmodel.Element;
|
import org.hl7.fhir.dstu3.elementmodel.Element;
|
||||||
import org.hl7.fhir.dstu3.elementmodel.Property;
|
import org.hl7.fhir.dstu3.elementmodel.Property;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRLexer.FHIRLexerException;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.TypeDetails.ProfiledType;
|
||||||
import org.hl7.fhir.dstu3.model.Base;
|
import org.hl7.fhir.dstu3.model.Base;
|
||||||
import org.hl7.fhir.dstu3.model.BooleanType;
|
import org.hl7.fhir.dstu3.model.BooleanType;
|
||||||
import org.hl7.fhir.dstu3.model.CodeType;
|
import org.hl7.fhir.dstu3.model.CodeType;
|
||||||
|
@ -70,8 +79,6 @@ import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.dstu3.model.Enumeration;
|
import org.hl7.fhir.dstu3.model.Enumeration;
|
||||||
import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
|
import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
|
||||||
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.dstu3.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.dstu3.model.IdType;
|
import org.hl7.fhir.dstu3.model.IdType;
|
||||||
import org.hl7.fhir.dstu3.model.IntegerType;
|
import org.hl7.fhir.dstu3.model.IntegerType;
|
||||||
import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus;
|
import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus;
|
||||||
|
@ -100,15 +107,10 @@ import org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent;
|
||||||
import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode;
|
import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode;
|
||||||
import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform;
|
import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform;
|
||||||
import org.hl7.fhir.dstu3.model.Type;
|
import org.hl7.fhir.dstu3.model.Type;
|
||||||
import org.hl7.fhir.dstu3.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.dstu3.model.TypeDetails.ProfiledType;
|
|
||||||
import org.hl7.fhir.dstu3.model.UriType;
|
import org.hl7.fhir.dstu3.model.UriType;
|
||||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||||
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.dstu3.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
import org.hl7.fhir.dstu3.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException;
|
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
|
|
|
@ -9,14 +9,14 @@ import java.util.stream.Stream;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||||
import org.hl7.fhir.dstu3.model.Base;
|
import org.hl7.fhir.dstu3.model.Base;
|
||||||
import org.hl7.fhir.dstu3.model.BooleanType;
|
import org.hl7.fhir.dstu3.model.BooleanType;
|
||||||
import org.hl7.fhir.dstu3.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.dstu3.model.PrimitiveType;
|
import org.hl7.fhir.dstu3.model.PrimitiveType;
|
||||||
import org.hl7.fhir.dstu3.model.Resource;
|
import org.hl7.fhir.dstu3.model.Resource;
|
||||||
import org.hl7.fhir.dstu3.test.support.TestingUtilities;
|
import org.hl7.fhir.dstu3.test.support.TestingUtilities;
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||||
|
|
|
@ -14,10 +14,14 @@ import org.apache.commons.codec.Charsets;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
|
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
|
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||||
import org.hl7.fhir.dstu3.model.Base;
|
import org.hl7.fhir.dstu3.model.Base;
|
||||||
import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.dstu3.model.MetadataResource;
|
import org.hl7.fhir.dstu3.model.MetadataResource;
|
||||||
import org.hl7.fhir.dstu3.model.Resource;
|
import org.hl7.fhir.dstu3.model.Resource;
|
||||||
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
import org.hl7.fhir.dstu3.model.StructureDefinition;
|
||||||
|
@ -26,12 +30,8 @@ import org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent;
|
||||||
import org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent;
|
import org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent;
|
||||||
import org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent;
|
import org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent;
|
||||||
import org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent;
|
import org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent;
|
||||||
import org.hl7.fhir.dstu3.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.dstu3.test.support.TestingUtilities;
|
import org.hl7.fhir.dstu3.test.support.TestingUtilities;
|
||||||
import org.hl7.fhir.dstu3.utils.CodingUtilities;
|
import org.hl7.fhir.dstu3.utils.CodingUtilities;
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.dstu3.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
|
|
|
@ -8,8 +8,9 @@ import static org.mockito.Mockito.times;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.dstu3.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.dstu3.model.Base;
|
import org.hl7.fhir.dstu3.model.Base;
|
||||||
import org.hl7.fhir.dstu3.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.dstu3.model.StringType;
|
import org.hl7.fhir.dstu3.model.StringType;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
|
@ -36,13 +36,13 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext;
|
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.r4.formats.FormatUtilities;
|
import org.hl7.fhir.r4.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.r4.model.ElementDefinition;
|
import org.hl7.fhir.r4.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation;
|
import org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation;
|
||||||
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition;
|
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r4.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4.utils.ToolingExtensions;
|
import org.hl7.fhir.r4.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r4.utils.TypesUtilities;
|
import org.hl7.fhir.r4.utils.TypesUtilities;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
|
@ -0,0 +1,948 @@
|
||||||
|
package org.hl7.fhir.r4.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r4.model.Base;
|
||||||
|
import org.hl7.fhir.r4.model.Quantity;
|
||||||
|
import org.hl7.fhir.r4.model.StringType;
|
||||||
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class ExpressionNode {
|
||||||
|
|
||||||
|
public enum Kind {
|
||||||
|
Name, Function, Constant, Group, Unary
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Function {
|
||||||
|
Custom,
|
||||||
|
|
||||||
|
Empty, Not, Exists, SubsetOf, SupersetOf, IsDistinct, Distinct, Count, Where, Select, All, Repeat, Aggregate,
|
||||||
|
Item /* implicit from name[] */, As, Is, Single, First, Last, Tail, Skip, Take, Union, Combine, Intersect, Exclude,
|
||||||
|
Iif, Upper, Lower, ToChars, IndexOf, Substring, StartsWith, EndsWith, Matches, MatchesFull, ReplaceMatches,
|
||||||
|
Contains, Replace, Length, Children, Descendants, MemberOf, Trace, Check, Today, Now, Resolve, Extension, AllFalse,
|
||||||
|
AnyFalse, AllTrue, AnyTrue, HasValue, OfType, Type, ConvertsToBoolean, ConvertsToInteger, ConvertsToString,
|
||||||
|
ConvertsToDecimal, ConvertsToQuantity, ConvertsToDateTime, ConvertsToDate, ConvertsToTime, ToBoolean, ToInteger,
|
||||||
|
ToString, ToDecimal, ToQuantity, ToDateTime, ToTime, ConformsTo, Round, Sqrt, Abs, Ceiling, Exp, Floor, Ln, Log,
|
||||||
|
Power, Truncate,
|
||||||
|
|
||||||
|
// R3 functions
|
||||||
|
Encode, Decode, Escape, Unescape, Trim, Split, Join, LowBoundary, HighBoundary, Precision,
|
||||||
|
|
||||||
|
// Local extensions to FHIRPath
|
||||||
|
HtmlChecks1, HtmlChecks2, AliasAs, Alias, Comparable;
|
||||||
|
|
||||||
|
public static Function fromCode(String name) {
|
||||||
|
if (name.equals("empty"))
|
||||||
|
return Function.Empty;
|
||||||
|
if (name.equals("not"))
|
||||||
|
return Function.Not;
|
||||||
|
if (name.equals("exists"))
|
||||||
|
return Function.Exists;
|
||||||
|
if (name.equals("subsetOf"))
|
||||||
|
return Function.SubsetOf;
|
||||||
|
if (name.equals("supersetOf"))
|
||||||
|
return Function.SupersetOf;
|
||||||
|
if (name.equals("isDistinct"))
|
||||||
|
return Function.IsDistinct;
|
||||||
|
if (name.equals("distinct"))
|
||||||
|
return Function.Distinct;
|
||||||
|
if (name.equals("count"))
|
||||||
|
return Function.Count;
|
||||||
|
if (name.equals("where"))
|
||||||
|
return Function.Where;
|
||||||
|
if (name.equals("select"))
|
||||||
|
return Function.Select;
|
||||||
|
if (name.equals("all"))
|
||||||
|
return Function.All;
|
||||||
|
if (name.equals("repeat"))
|
||||||
|
return Function.Repeat;
|
||||||
|
if (name.equals("aggregate"))
|
||||||
|
return Function.Aggregate;
|
||||||
|
if (name.equals("item"))
|
||||||
|
return Function.Item;
|
||||||
|
if (name.equals("as"))
|
||||||
|
return Function.As;
|
||||||
|
if (name.equals("is"))
|
||||||
|
return Function.Is;
|
||||||
|
if (name.equals("single"))
|
||||||
|
return Function.Single;
|
||||||
|
if (name.equals("first"))
|
||||||
|
return Function.First;
|
||||||
|
if (name.equals("last"))
|
||||||
|
return Function.Last;
|
||||||
|
if (name.equals("tail"))
|
||||||
|
return Function.Tail;
|
||||||
|
if (name.equals("skip"))
|
||||||
|
return Function.Skip;
|
||||||
|
if (name.equals("take"))
|
||||||
|
return Function.Take;
|
||||||
|
if (name.equals("union"))
|
||||||
|
return Function.Union;
|
||||||
|
if (name.equals("combine"))
|
||||||
|
return Function.Combine;
|
||||||
|
if (name.equals("intersect"))
|
||||||
|
return Function.Intersect;
|
||||||
|
if (name.equals("exclude"))
|
||||||
|
return Function.Exclude;
|
||||||
|
if (name.equals("iif"))
|
||||||
|
return Function.Iif;
|
||||||
|
if (name.equals("lower"))
|
||||||
|
return Function.Lower;
|
||||||
|
if (name.equals("upper"))
|
||||||
|
return Function.Upper;
|
||||||
|
if (name.equals("toChars"))
|
||||||
|
return Function.ToChars;
|
||||||
|
if (name.equals("indexOf"))
|
||||||
|
return Function.IndexOf;
|
||||||
|
if (name.equals("substring"))
|
||||||
|
return Function.Substring;
|
||||||
|
if (name.equals("startsWith"))
|
||||||
|
return Function.StartsWith;
|
||||||
|
if (name.equals("endsWith"))
|
||||||
|
return Function.EndsWith;
|
||||||
|
if (name.equals("matches"))
|
||||||
|
return Function.Matches;
|
||||||
|
if (name.equals("matchesFull"))
|
||||||
|
return Function.MatchesFull;
|
||||||
|
if (name.equals("replaceMatches"))
|
||||||
|
return Function.ReplaceMatches;
|
||||||
|
if (name.equals("contains"))
|
||||||
|
return Function.Contains;
|
||||||
|
if (name.equals("replace"))
|
||||||
|
return Function.Replace;
|
||||||
|
if (name.equals("length"))
|
||||||
|
return Function.Length;
|
||||||
|
if (name.equals("children"))
|
||||||
|
return Function.Children;
|
||||||
|
if (name.equals("descendants"))
|
||||||
|
return Function.Descendants;
|
||||||
|
if (name.equals("memberOf"))
|
||||||
|
return Function.MemberOf;
|
||||||
|
if (name.equals("trace"))
|
||||||
|
return Function.Trace;
|
||||||
|
if (name.equals("check"))
|
||||||
|
return Function.Check;
|
||||||
|
if (name.equals("today"))
|
||||||
|
return Function.Today;
|
||||||
|
if (name.equals("now"))
|
||||||
|
return Function.Now;
|
||||||
|
if (name.equals("resolve"))
|
||||||
|
return Function.Resolve;
|
||||||
|
if (name.equals("extension"))
|
||||||
|
return Function.Extension;
|
||||||
|
if (name.equals("allFalse"))
|
||||||
|
return Function.AllFalse;
|
||||||
|
if (name.equals("anyFalse"))
|
||||||
|
return Function.AnyFalse;
|
||||||
|
if (name.equals("allTrue"))
|
||||||
|
return Function.AllTrue;
|
||||||
|
if (name.equals("anyTrue"))
|
||||||
|
return Function.AnyTrue;
|
||||||
|
if (name.equals("hasValue"))
|
||||||
|
return Function.HasValue;
|
||||||
|
if (name.equals("alias"))
|
||||||
|
return Function.Alias;
|
||||||
|
if (name.equals("aliasAs"))
|
||||||
|
return Function.AliasAs;
|
||||||
|
if (name.equals("htmlChecks"))
|
||||||
|
return Function.HtmlChecks1;
|
||||||
|
if (name.equals("htmlchecks"))
|
||||||
|
return Function.HtmlChecks1; // support change of care from R3
|
||||||
|
if (name.equals("htmlChecks2"))
|
||||||
|
return Function.HtmlChecks2;
|
||||||
|
if (name.equals("comparable"))
|
||||||
|
return Function.Comparable;
|
||||||
|
if (name.equals("encode"))
|
||||||
|
return Function.Encode;
|
||||||
|
if (name.equals("decode"))
|
||||||
|
return Function.Decode;
|
||||||
|
if (name.equals("escape"))
|
||||||
|
return Function.Escape;
|
||||||
|
if (name.equals("unescape"))
|
||||||
|
return Function.Unescape;
|
||||||
|
if (name.equals("trim"))
|
||||||
|
return Function.Trim;
|
||||||
|
if (name.equals("split"))
|
||||||
|
return Function.Split;
|
||||||
|
if (name.equals("join"))
|
||||||
|
return Function.Join;
|
||||||
|
if (name.equals("ofType"))
|
||||||
|
return Function.OfType;
|
||||||
|
if (name.equals("type"))
|
||||||
|
return Function.Type;
|
||||||
|
if (name.equals("toInteger"))
|
||||||
|
return Function.ToInteger;
|
||||||
|
if (name.equals("toDecimal"))
|
||||||
|
return Function.ToDecimal;
|
||||||
|
if (name.equals("toString"))
|
||||||
|
return Function.ToString;
|
||||||
|
if (name.equals("toQuantity"))
|
||||||
|
return Function.ToQuantity;
|
||||||
|
if (name.equals("toBoolean"))
|
||||||
|
return Function.ToBoolean;
|
||||||
|
if (name.equals("toDateTime"))
|
||||||
|
return Function.ToDateTime;
|
||||||
|
if (name.equals("toTime"))
|
||||||
|
return Function.ToTime;
|
||||||
|
if (name.equals("convertsToInteger"))
|
||||||
|
return Function.ConvertsToInteger;
|
||||||
|
if (name.equals("convertsToDecimal"))
|
||||||
|
return Function.ConvertsToDecimal;
|
||||||
|
if (name.equals("convertsToString"))
|
||||||
|
return Function.ConvertsToString;
|
||||||
|
if (name.equals("convertsToQuantity"))
|
||||||
|
return Function.ConvertsToQuantity;
|
||||||
|
if (name.equals("convertsToBoolean"))
|
||||||
|
return Function.ConvertsToBoolean;
|
||||||
|
if (name.equals("convertsToDateTime"))
|
||||||
|
return Function.ConvertsToDateTime;
|
||||||
|
if (name.equals("convertsToDate"))
|
||||||
|
return Function.ConvertsToDate;
|
||||||
|
if (name.equals("convertsToTime"))
|
||||||
|
return Function.ConvertsToTime;
|
||||||
|
if (name.equals("conformsTo"))
|
||||||
|
return Function.ConformsTo;
|
||||||
|
if (name.equals("round"))
|
||||||
|
return Function.Round;
|
||||||
|
if (name.equals("sqrt"))
|
||||||
|
return Function.Sqrt;
|
||||||
|
if (name.equals("abs"))
|
||||||
|
return Function.Abs;
|
||||||
|
if (name.equals("ceiling"))
|
||||||
|
return Function.Ceiling;
|
||||||
|
if (name.equals("exp"))
|
||||||
|
return Function.Exp;
|
||||||
|
if (name.equals("floor"))
|
||||||
|
return Function.Floor;
|
||||||
|
if (name.equals("ln"))
|
||||||
|
return Function.Ln;
|
||||||
|
if (name.equals("log"))
|
||||||
|
return Function.Log;
|
||||||
|
if (name.equals("power"))
|
||||||
|
return Function.Power;
|
||||||
|
if (name.equals("truncate"))
|
||||||
|
return Function.Truncate;
|
||||||
|
if (name.equals("lowBoundary"))
|
||||||
|
return Function.LowBoundary;
|
||||||
|
if (name.equals("highBoundary"))
|
||||||
|
return Function.HighBoundary;
|
||||||
|
if (name.equals("precision"))
|
||||||
|
return Function.Precision;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Empty:
|
||||||
|
return "empty";
|
||||||
|
case Not:
|
||||||
|
return "not";
|
||||||
|
case Exists:
|
||||||
|
return "exists";
|
||||||
|
case SubsetOf:
|
||||||
|
return "subsetOf";
|
||||||
|
case SupersetOf:
|
||||||
|
return "supersetOf";
|
||||||
|
case IsDistinct:
|
||||||
|
return "isDistinct";
|
||||||
|
case Distinct:
|
||||||
|
return "distinct";
|
||||||
|
case Count:
|
||||||
|
return "count";
|
||||||
|
case Where:
|
||||||
|
return "where";
|
||||||
|
case Select:
|
||||||
|
return "select";
|
||||||
|
case All:
|
||||||
|
return "all";
|
||||||
|
case Repeat:
|
||||||
|
return "repeat";
|
||||||
|
case Aggregate:
|
||||||
|
return "aggregate";
|
||||||
|
case Item:
|
||||||
|
return "item";
|
||||||
|
case As:
|
||||||
|
return "as";
|
||||||
|
case Is:
|
||||||
|
return "is";
|
||||||
|
case Single:
|
||||||
|
return "single";
|
||||||
|
case First:
|
||||||
|
return "first";
|
||||||
|
case Last:
|
||||||
|
return "last";
|
||||||
|
case Tail:
|
||||||
|
return "tail";
|
||||||
|
case Skip:
|
||||||
|
return "skip";
|
||||||
|
case Take:
|
||||||
|
return "take";
|
||||||
|
case Union:
|
||||||
|
return "union";
|
||||||
|
case Combine:
|
||||||
|
return "combine";
|
||||||
|
case Intersect:
|
||||||
|
return "intersect";
|
||||||
|
case Exclude:
|
||||||
|
return "exclude";
|
||||||
|
case Iif:
|
||||||
|
return "iif";
|
||||||
|
case ToChars:
|
||||||
|
return "toChars";
|
||||||
|
case Lower:
|
||||||
|
return "lower";
|
||||||
|
case Upper:
|
||||||
|
return "upper";
|
||||||
|
case IndexOf:
|
||||||
|
return "indexOf";
|
||||||
|
case Substring:
|
||||||
|
return "substring";
|
||||||
|
case StartsWith:
|
||||||
|
return "startsWith";
|
||||||
|
case EndsWith:
|
||||||
|
return "endsWith";
|
||||||
|
case Matches:
|
||||||
|
return "matches";
|
||||||
|
case MatchesFull:
|
||||||
|
return "matchesFull";
|
||||||
|
case ReplaceMatches:
|
||||||
|
return "replaceMatches";
|
||||||
|
case Contains:
|
||||||
|
return "contains";
|
||||||
|
case Replace:
|
||||||
|
return "replace";
|
||||||
|
case Length:
|
||||||
|
return "length";
|
||||||
|
case Children:
|
||||||
|
return "children";
|
||||||
|
case Descendants:
|
||||||
|
return "descendants";
|
||||||
|
case MemberOf:
|
||||||
|
return "memberOf";
|
||||||
|
case Trace:
|
||||||
|
return "trace";
|
||||||
|
case Check:
|
||||||
|
return "check";
|
||||||
|
case Today:
|
||||||
|
return "today";
|
||||||
|
case Now:
|
||||||
|
return "now";
|
||||||
|
case Resolve:
|
||||||
|
return "resolve";
|
||||||
|
case Extension:
|
||||||
|
return "extension";
|
||||||
|
case AllFalse:
|
||||||
|
return "allFalse";
|
||||||
|
case AnyFalse:
|
||||||
|
return "anyFalse";
|
||||||
|
case AllTrue:
|
||||||
|
return "allTrue";
|
||||||
|
case AnyTrue:
|
||||||
|
return "anyTrue";
|
||||||
|
case HasValue:
|
||||||
|
return "hasValue";
|
||||||
|
case Alias:
|
||||||
|
return "alias";
|
||||||
|
case AliasAs:
|
||||||
|
return "aliasAs";
|
||||||
|
case Encode:
|
||||||
|
return "encode";
|
||||||
|
case Decode:
|
||||||
|
return "decode";
|
||||||
|
case Escape:
|
||||||
|
return "escape";
|
||||||
|
case Unescape:
|
||||||
|
return "unescape";
|
||||||
|
case Trim:
|
||||||
|
return "trim";
|
||||||
|
case Split:
|
||||||
|
return "split";
|
||||||
|
case Join:
|
||||||
|
return "join";
|
||||||
|
case HtmlChecks1:
|
||||||
|
return "htmlChecks";
|
||||||
|
case HtmlChecks2:
|
||||||
|
return "htmlChecks2";
|
||||||
|
case Comparable:
|
||||||
|
return "comparable";
|
||||||
|
case OfType:
|
||||||
|
return "ofType";
|
||||||
|
case Type:
|
||||||
|
return "type";
|
||||||
|
case ToInteger:
|
||||||
|
return "toInteger";
|
||||||
|
case ToDecimal:
|
||||||
|
return "toDecimal";
|
||||||
|
case ToString:
|
||||||
|
return "toString";
|
||||||
|
case ToBoolean:
|
||||||
|
return "toBoolean";
|
||||||
|
case ToQuantity:
|
||||||
|
return "toQuantity";
|
||||||
|
case ToDateTime:
|
||||||
|
return "toDateTime";
|
||||||
|
case ToTime:
|
||||||
|
return "toTime";
|
||||||
|
case ConvertsToInteger:
|
||||||
|
return "convertsToInteger";
|
||||||
|
case ConvertsToDecimal:
|
||||||
|
return "convertsToDecimal";
|
||||||
|
case ConvertsToString:
|
||||||
|
return "convertsToString";
|
||||||
|
case ConvertsToBoolean:
|
||||||
|
return "convertsToBoolean";
|
||||||
|
case ConvertsToQuantity:
|
||||||
|
return "convertsToQuantity";
|
||||||
|
case ConvertsToDateTime:
|
||||||
|
return "convertsToDateTime";
|
||||||
|
case ConvertsToDate:
|
||||||
|
return "convertsToDate";
|
||||||
|
case ConvertsToTime:
|
||||||
|
return "isTime";
|
||||||
|
case ConformsTo:
|
||||||
|
return "conformsTo";
|
||||||
|
case Round:
|
||||||
|
return "round";
|
||||||
|
case Sqrt:
|
||||||
|
return "sqrt";
|
||||||
|
case Abs:
|
||||||
|
return "abs";
|
||||||
|
case Ceiling:
|
||||||
|
return "ceiling";
|
||||||
|
case Exp:
|
||||||
|
return "exp";
|
||||||
|
case Floor:
|
||||||
|
return "floor";
|
||||||
|
case Ln:
|
||||||
|
return "ln";
|
||||||
|
case Log:
|
||||||
|
return "log";
|
||||||
|
case Power:
|
||||||
|
return "power";
|
||||||
|
case Truncate:
|
||||||
|
return "truncate";
|
||||||
|
case LowBoundary:
|
||||||
|
return "lowBoundary";
|
||||||
|
case HighBoundary:
|
||||||
|
return "highBoundary";
|
||||||
|
case Precision:
|
||||||
|
return "precision";
|
||||||
|
default:
|
||||||
|
return "?custom?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Operation {
|
||||||
|
Equals, Equivalent, NotEquals, NotEquivalent, LessThan, Greater, LessOrEqual, GreaterOrEqual, Is, As, Union, Or,
|
||||||
|
And, Xor, Implies, Times, DivideBy, Plus, Minus, Concatenate, Div, Mod, In, Contains, MemberOf;
|
||||||
|
|
||||||
|
public static Operation fromCode(String name) {
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return null;
|
||||||
|
if (name.equals("="))
|
||||||
|
return Operation.Equals;
|
||||||
|
if (name.equals("~"))
|
||||||
|
return Operation.Equivalent;
|
||||||
|
if (name.equals("!="))
|
||||||
|
return Operation.NotEquals;
|
||||||
|
if (name.equals("!~"))
|
||||||
|
return Operation.NotEquivalent;
|
||||||
|
if (name.equals(">"))
|
||||||
|
return Operation.Greater;
|
||||||
|
if (name.equals("<"))
|
||||||
|
return Operation.LessThan;
|
||||||
|
if (name.equals(">="))
|
||||||
|
return Operation.GreaterOrEqual;
|
||||||
|
if (name.equals("<="))
|
||||||
|
return Operation.LessOrEqual;
|
||||||
|
if (name.equals("|"))
|
||||||
|
return Operation.Union;
|
||||||
|
if (name.equals("or"))
|
||||||
|
return Operation.Or;
|
||||||
|
if (name.equals("and"))
|
||||||
|
return Operation.And;
|
||||||
|
if (name.equals("xor"))
|
||||||
|
return Operation.Xor;
|
||||||
|
if (name.equals("is"))
|
||||||
|
return Operation.Is;
|
||||||
|
if (name.equals("as"))
|
||||||
|
return Operation.As;
|
||||||
|
if (name.equals("*"))
|
||||||
|
return Operation.Times;
|
||||||
|
if (name.equals("/"))
|
||||||
|
return Operation.DivideBy;
|
||||||
|
if (name.equals("+"))
|
||||||
|
return Operation.Plus;
|
||||||
|
if (name.equals("-"))
|
||||||
|
return Operation.Minus;
|
||||||
|
if (name.equals("&"))
|
||||||
|
return Operation.Concatenate;
|
||||||
|
if (name.equals("implies"))
|
||||||
|
return Operation.Implies;
|
||||||
|
if (name.equals("div"))
|
||||||
|
return Operation.Div;
|
||||||
|
if (name.equals("mod"))
|
||||||
|
return Operation.Mod;
|
||||||
|
if (name.equals("in"))
|
||||||
|
return Operation.In;
|
||||||
|
if (name.equals("contains"))
|
||||||
|
return Operation.Contains;
|
||||||
|
if (name.equals("memberOf"))
|
||||||
|
return Operation.MemberOf;
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Equals:
|
||||||
|
return "=";
|
||||||
|
case Equivalent:
|
||||||
|
return "~";
|
||||||
|
case NotEquals:
|
||||||
|
return "!=";
|
||||||
|
case NotEquivalent:
|
||||||
|
return "!~";
|
||||||
|
case Greater:
|
||||||
|
return ">";
|
||||||
|
case LessThan:
|
||||||
|
return "<";
|
||||||
|
case GreaterOrEqual:
|
||||||
|
return ">=";
|
||||||
|
case LessOrEqual:
|
||||||
|
return "<=";
|
||||||
|
case Union:
|
||||||
|
return "|";
|
||||||
|
case Or:
|
||||||
|
return "or";
|
||||||
|
case And:
|
||||||
|
return "and";
|
||||||
|
case Xor:
|
||||||
|
return "xor";
|
||||||
|
case Times:
|
||||||
|
return "*";
|
||||||
|
case DivideBy:
|
||||||
|
return "/";
|
||||||
|
case Plus:
|
||||||
|
return "+";
|
||||||
|
case Minus:
|
||||||
|
return "-";
|
||||||
|
case Concatenate:
|
||||||
|
return "&";
|
||||||
|
case Implies:
|
||||||
|
return "implies";
|
||||||
|
case Is:
|
||||||
|
return "is";
|
||||||
|
case As:
|
||||||
|
return "as";
|
||||||
|
case Div:
|
||||||
|
return "div";
|
||||||
|
case Mod:
|
||||||
|
return "mod";
|
||||||
|
case In:
|
||||||
|
return "in";
|
||||||
|
case Contains:
|
||||||
|
return "contains";
|
||||||
|
case MemberOf:
|
||||||
|
return "memberOf";
|
||||||
|
default:
|
||||||
|
return "?custom?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CollectionStatus {
|
||||||
|
SINGLETON, ORDERED, UNORDERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the expression will have one of either name or constant
|
||||||
|
private String uniqueId;
|
||||||
|
private Kind kind;
|
||||||
|
private String name;
|
||||||
|
private Base constant;
|
||||||
|
private Function function;
|
||||||
|
private List<ExpressionNode> parameters; // will be created if there is a function
|
||||||
|
private ExpressionNode inner;
|
||||||
|
private ExpressionNode group;
|
||||||
|
private Operation operation;
|
||||||
|
private boolean proximal; // a proximal operation is the first in the sequence of operations. This is
|
||||||
|
// significant when evaluating the outcomes
|
||||||
|
private ExpressionNode opNext;
|
||||||
|
private SourceLocation start;
|
||||||
|
private SourceLocation end;
|
||||||
|
private SourceLocation opStart;
|
||||||
|
private SourceLocation opEnd;
|
||||||
|
private TypeDetails types;
|
||||||
|
private TypeDetails opTypes;
|
||||||
|
|
||||||
|
public ExpressionNode(int uniqueId) {
|
||||||
|
super();
|
||||||
|
this.uniqueId = Integer.toString(uniqueId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
if (function == Function.Item)
|
||||||
|
b.append("[");
|
||||||
|
else {
|
||||||
|
b.append(name);
|
||||||
|
b.append("(");
|
||||||
|
}
|
||||||
|
boolean first = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
b.append(n.toString());
|
||||||
|
}
|
||||||
|
if (function == Function.Item) {
|
||||||
|
b.append("]");
|
||||||
|
} else {
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
if (constant == null) {
|
||||||
|
b.append("{}");
|
||||||
|
} else if (constant instanceof StringType) {
|
||||||
|
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
|
||||||
|
} else if (constant instanceof Quantity) {
|
||||||
|
Quantity q = (Quantity) constant;
|
||||||
|
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
||||||
|
b.append(" '");
|
||||||
|
b.append(Utilities.escapeJson(q.getUnit()));
|
||||||
|
b.append("'");
|
||||||
|
} else if (constant.primitiveValue() != null) {
|
||||||
|
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
||||||
|
} else {
|
||||||
|
b.append(Utilities.escapeJson(constant.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append("(");
|
||||||
|
b.append(group.toString());
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
if (!((ExpressionNode.Kind.Function == inner.getKind())
|
||||||
|
&& (ExpressionNode.Function.Item == inner.getFunction()))) {
|
||||||
|
b.append(".");
|
||||||
|
}
|
||||||
|
b.append(inner.toString());
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(" ");
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(" ");
|
||||||
|
b.append(opNext.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base getConstant() {
|
||||||
|
return constant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConstant(Base constant) {
|
||||||
|
this.constant = constant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Function getFunction() {
|
||||||
|
return function;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFunction(Function function) {
|
||||||
|
this.function = function;
|
||||||
|
if (parameters == null)
|
||||||
|
parameters = new ArrayList<ExpressionNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isProximal() {
|
||||||
|
return proximal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProximal(boolean proximal) {
|
||||||
|
this.proximal = proximal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Operation getOperation() {
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperation(Operation operation) {
|
||||||
|
this.operation = operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getInner() {
|
||||||
|
return inner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInner(ExpressionNode value) {
|
||||||
|
this.inner = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getOpNext() {
|
||||||
|
return opNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpNext(ExpressionNode value) {
|
||||||
|
this.opNext = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ExpressionNode> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkName() {
|
||||||
|
if (!name.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return Utilities.existsInList(name, "$this", "$total", "$index");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kind getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKind(Kind kind) {
|
||||||
|
this.kind = kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroup(ExpressionNode group) {
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(SourceLocation start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(SourceLocation end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpStart() {
|
||||||
|
return opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpStart(SourceLocation opStart) {
|
||||||
|
this.opStart = opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpEnd() {
|
||||||
|
return opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpEnd(SourceLocation opEnd) {
|
||||||
|
this.opEnd = opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int parameterCount() {
|
||||||
|
if (parameters == null)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return parameters.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Canonical() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
write(b);
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String summary() {
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
return uniqueId + ": " + name;
|
||||||
|
case Function:
|
||||||
|
return uniqueId + ": " + function.toString() + "()";
|
||||||
|
case Constant:
|
||||||
|
return uniqueId + ": " + constant;
|
||||||
|
case Group:
|
||||||
|
return uniqueId + ": (Group)";
|
||||||
|
}
|
||||||
|
return "?exp-kind?";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(StringBuilder b) {
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
b.append(constant);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
b.append(function.toCode());
|
||||||
|
b.append('(');
|
||||||
|
boolean f = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (f)
|
||||||
|
f = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
n.write(b);
|
||||||
|
}
|
||||||
|
b.append(')');
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append('(');
|
||||||
|
group.write(b);
|
||||||
|
b.append(')');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inner != null) {
|
||||||
|
b.append('.');
|
||||||
|
inner.write(b);
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(' ');
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(' ');
|
||||||
|
opNext.write(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String check() {
|
||||||
|
|
||||||
|
if (kind == null) {
|
||||||
|
return "Error in expression - node has no kind";
|
||||||
|
}
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return "No Name provided @ " + location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Function:
|
||||||
|
if (function == null)
|
||||||
|
return "No Function id provided @ " + location();
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
String msg = n.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Unary:
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
if (constant == null)
|
||||||
|
return "No Constant provided @ " + location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Group:
|
||||||
|
if (group == null)
|
||||||
|
return "No Group provided @ " + location();
|
||||||
|
else {
|
||||||
|
String msg = group.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
String msg = inner.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (operation == null) {
|
||||||
|
|
||||||
|
if (opNext != null)
|
||||||
|
return "Next provided when it shouldn't be @ " + location();
|
||||||
|
} else {
|
||||||
|
if (opNext == null)
|
||||||
|
return "No Next provided @ " + location();
|
||||||
|
else
|
||||||
|
opNext.check();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String location() {
|
||||||
|
return Integer.toString(start.getLine()) + ", " + Integer.toString(start.getColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypes(TypeDetails types) {
|
||||||
|
this.types = types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getOpTypes() {
|
||||||
|
return opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpTypes(TypeDetails opTypes) {
|
||||||
|
this.opTypes = opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,482 @@
|
||||||
|
package org.hl7.fhir.r4.fhirpath;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
// shared lexer for concrete syntaxes
|
||||||
|
// - FluentPath
|
||||||
|
// - Mapping language
|
||||||
|
|
||||||
|
public class FHIRLexer {
|
||||||
|
public class FHIRLexerException extends FHIRException {
|
||||||
|
|
||||||
|
public FHIRLexerException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String source;
|
||||||
|
private int cursor;
|
||||||
|
private int currentStart;
|
||||||
|
private String current;
|
||||||
|
private SourceLocation currentLocation;
|
||||||
|
private SourceLocation currentStartLocation;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public FHIRLexer(String source, String name) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
this.name = name == null ? "??" : name;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexer(String source, int i) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
this.cursor = i;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getCurrentLocation() {
|
||||||
|
return currentLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConstant() {
|
||||||
|
return current != null && (current.charAt(0) == '\'' || current.charAt(0) == '"') || current.charAt(0) == '@'
|
||||||
|
|| current.charAt(0) == '%' || current.charAt(0) == '-' || current.charAt(0) == '+'
|
||||||
|
|| (current.charAt(0) >= '0' && current.charAt(0) <= '9') || current.equals("true") || current.equals("false")
|
||||||
|
|| current.equals("{}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFixedName() {
|
||||||
|
return current != null && (current.charAt(0) == '`');
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStringConstant() {
|
||||||
|
return current.charAt(0) == '\'' || current.charAt(0) == '"' || current.charAt(0) == '`';
|
||||||
|
}
|
||||||
|
|
||||||
|
public String take() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
next();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int takeInt() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
if (!Utilities.isInteger(s))
|
||||||
|
throw error("Found " + current + " expecting an integer");
|
||||||
|
next();
|
||||||
|
return Integer.parseInt(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToken() {
|
||||||
|
if (Utilities.noString(current))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (current.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (current.equals("*") || current.equals("**"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((current.charAt(0) >= 'A' && current.charAt(0) <= 'Z')
|
||||||
|
|| (current.charAt(0) >= 'a' && current.charAt(0) <= 'z')) {
|
||||||
|
for (int i = 1; i < current.length(); i++)
|
||||||
|
if (!((current.charAt(1) >= 'A' && current.charAt(1) <= 'Z')
|
||||||
|
|| (current.charAt(1) >= 'a' && current.charAt(1) <= 'z')
|
||||||
|
|| (current.charAt(1) >= '0' && current.charAt(1) <= '9')))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg) {
|
||||||
|
return error(msg, currentLocation.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg, String location) {
|
||||||
|
return new FHIRLexerException("Error in " + name + " at " + location + ": " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void next() throws FHIRLexerException {
|
||||||
|
skipWhitespaceAndComments();
|
||||||
|
current = null;
|
||||||
|
currentStart = cursor;
|
||||||
|
currentStartLocation = currentLocation;
|
||||||
|
if (cursor < source.length()) {
|
||||||
|
char ch = source.charAt(cursor);
|
||||||
|
if (ch == '!' || ch == '>' || ch == '<' || ch == ':' || ch == '-' || ch == '=') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length()
|
||||||
|
&& (source.charAt(cursor) == '=' || source.charAt(cursor) == '~' || source.charAt(cursor) == '-')
|
||||||
|
|| (ch == '-' && source.charAt(cursor) == '>'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '.') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '.'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch >= '0' && ch <= '9') {
|
||||||
|
cursor++;
|
||||||
|
boolean dotted = false;
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9')
|
||||||
|
|| (source.charAt(cursor) == '.') && !dotted)) {
|
||||||
|
if (source.charAt(cursor) == '.')
|
||||||
|
dotted = true;
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (source.charAt(cursor - 1) == '.')
|
||||||
|
cursor--;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z')
|
||||||
|
|| (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z')
|
||||||
|
|| (source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == '_'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '%') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '`')) {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) != '`'))
|
||||||
|
cursor++;
|
||||||
|
cursor++;
|
||||||
|
} else
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z')
|
||||||
|
|| (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z')
|
||||||
|
|| (source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == ':'
|
||||||
|
|| source.charAt(cursor) == '-'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '/') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '/')) {
|
||||||
|
// this is en error - should already have been skipped
|
||||||
|
error("This shoudn't happen?");
|
||||||
|
}
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '$') {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '{') {
|
||||||
|
cursor++;
|
||||||
|
ch = source.charAt(cursor);
|
||||||
|
if (ch == '}')
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '"') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '"')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "\"" + source.substring(currentStart + 1, cursor - 1) + "\"";
|
||||||
|
} else if (ch == '`') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '`')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "`" + source.substring(currentStart + 1, cursor - 1) + "`";
|
||||||
|
} else if (ch == '\'') {
|
||||||
|
cursor++;
|
||||||
|
char ech = ch;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != ech)) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
if (ech == '\'')
|
||||||
|
current = "\'" + current.substring(1, current.length() - 1) + "\'";
|
||||||
|
} else if (ch == '`') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '`')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "`" + source.substring(currentStart + 1, cursor - 1) + "`";
|
||||||
|
} else if (ch == '@') {
|
||||||
|
int start = cursor;
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && isDateChar(source.charAt(cursor), start))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else { // if CharInSet(ch, ['.', ',', '(', ')', '=', '$']) then
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void skipWhitespaceAndComments() {
|
||||||
|
boolean last13 = false;
|
||||||
|
boolean done = false;
|
||||||
|
while (cursor < source.length() && !done) {
|
||||||
|
if (cursor < source.length() - 1 && "//".equals(source.substring(cursor, cursor + 2))) {
|
||||||
|
while (cursor < source.length() && !((source.charAt(cursor) == '\r') || source.charAt(cursor) == '\n'))
|
||||||
|
cursor++;
|
||||||
|
} else if (cursor < source.length() - 1 && "/*".equals(source.substring(cursor, cursor + 2))) {
|
||||||
|
while (cursor < source.length() - 1 && !"*/".equals(source.substring(cursor, cursor + 2))) {
|
||||||
|
last13 = currentLocation.checkChar(source.charAt(cursor), last13);
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor >= source.length() - 1) {
|
||||||
|
error("Unfinished comment");
|
||||||
|
} else {
|
||||||
|
cursor = cursor + 2;
|
||||||
|
}
|
||||||
|
} else if (Character.isWhitespace(source.charAt(cursor))) {
|
||||||
|
last13 = currentLocation.checkChar(source.charAt(cursor), last13);
|
||||||
|
cursor++;
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDateChar(char ch, int start) {
|
||||||
|
int eot = source.charAt(start + 1) == 'T' ? 10 : 20;
|
||||||
|
|
||||||
|
return ch == '-' || ch == ':' || ch == 'T' || ch == '+' || ch == 'Z' || Character.isDigit(ch)
|
||||||
|
|| (cursor - start == eot && ch == '.' && cursor < source.length() - 1
|
||||||
|
&& Character.isDigit(source.charAt(cursor + 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOp() {
|
||||||
|
return ExpressionNode.Operation.fromCode(current) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean done() {
|
||||||
|
return currentStart >= source.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextId() {
|
||||||
|
id++;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getCurrentStartLocation() {
|
||||||
|
return currentStartLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special case use
|
||||||
|
public void setCurrent(String current) {
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasComment() {
|
||||||
|
return !done() && current.startsWith("//");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasToken(String kw) {
|
||||||
|
return !done() && kw.equals(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasToken(String... names) {
|
||||||
|
if (done())
|
||||||
|
return false;
|
||||||
|
for (String s : names)
|
||||||
|
if (s.equals(current))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void token(String kw) throws FHIRLexerException {
|
||||||
|
if (!kw.equals(current))
|
||||||
|
throw error("Found \"" + current + "\" expecting \"" + kw + "\"");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readConstant(String desc) throws FHIRLexerException {
|
||||||
|
if (!isStringConstant())
|
||||||
|
throw error("Found " + current + " expecting \"[" + desc + "]\"");
|
||||||
|
|
||||||
|
return processConstant(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readFixedName(String desc) throws FHIRLexerException {
|
||||||
|
if (!isFixedName())
|
||||||
|
throw error("Found " + current + " expecting \"[" + desc + "]\"");
|
||||||
|
|
||||||
|
return processFixedName(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processConstant(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length() - 1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
b.append('"');
|
||||||
|
break;
|
||||||
|
case '`':
|
||||||
|
b.append('`');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('/');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i + 4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown character escape \\" + s.charAt(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processFixedName(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length() - 1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
b.append('"');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('/');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i + 4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown character escape \\" + s.charAt(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skipToken(String token) throws FHIRLexerException {
|
||||||
|
if (getCurrent().equals(token))
|
||||||
|
next();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String takeDottedToken() throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append(take());
|
||||||
|
while (!done() && getCurrent().equals(".")) {
|
||||||
|
b.append(take());
|
||||||
|
b.append(take());
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skipComments() throws FHIRLexerException {
|
||||||
|
while (!done() && hasComment())
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentStart() {
|
||||||
|
return currentStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.hl7.fhir.r4.fhirpath;
|
||||||
|
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class FHIRPathConstant {
|
||||||
|
|
||||||
|
public static boolean isFHIRPathConstant(String string) {
|
||||||
|
return !Utilities.noString(string) && ((string.charAt(0) == '\'' || string.charAt(0) == '"')
|
||||||
|
|| string.charAt(0) == '@' || string.charAt(0) == '%' || string.charAt(0) == '-' || string.charAt(0) == '+'
|
||||||
|
|| (string.charAt(0) >= '0' && string.charAt(0) <= '9') || string.equals("true") || string.equals("false")
|
||||||
|
|| string.equals("{}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFHIRPathFixedName(String string) {
|
||||||
|
return string != null && (string.charAt(0) == '`');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFHIRPathStringConstant(String string) {
|
||||||
|
return string.charAt(0) == '\'' || string.charAt(0) == '"' || string.charAt(0) == '`';
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,205 @@
|
||||||
|
package org.hl7.fhir.r4.fhirpath;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r4.model.Base;
|
||||||
|
import org.hl7.fhir.r4.model.Element;
|
||||||
|
import org.hl7.fhir.r4.model.ElementDefinition;
|
||||||
|
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
|
||||||
|
import org.hl7.fhir.r4.model.Property;
|
||||||
|
import org.hl7.fhir.r4.model.Resource;
|
||||||
|
import org.hl7.fhir.r4.model.StringType;
|
||||||
|
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class FHIRPathUtilityClasses {
|
||||||
|
|
||||||
|
|
||||||
|
public static class FHIRConstant extends Base {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8933773658248269439L;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public FHIRConstant(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fhirType() {
|
||||||
|
return "%constant";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void listChildren(List<Property> result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdBase() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdBase(String value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String primitiveValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Base copy() {
|
||||||
|
throw new Error("Not Implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ClassTypeInfo extends Base {
|
||||||
|
private static final long serialVersionUID = 4909223114071029317L;
|
||||||
|
private Base instance;
|
||||||
|
|
||||||
|
public ClassTypeInfo(Base instance) {
|
||||||
|
super();
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fhirType() {
|
||||||
|
return "ClassInfo";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void listChildren(List<Property> result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdBase() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdBase(String value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||||
|
if (name.equals("name")) {
|
||||||
|
return new Base[] { new StringType(getName()) };
|
||||||
|
} else if (name.equals("namespace")) {
|
||||||
|
return new Base[] { new StringType(getNamespace()) };
|
||||||
|
} else {
|
||||||
|
return super.getProperty(hash, name, checkValid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getNamespace() {
|
||||||
|
if ((instance instanceof Resource)) {
|
||||||
|
return "FHIR";
|
||||||
|
} else if (!(instance instanceof Element) || ((Element) instance).isDisallowExtensions()) {
|
||||||
|
return "System";
|
||||||
|
} else {
|
||||||
|
return "FHIR";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getName() {
|
||||||
|
if ((instance instanceof Resource)) {
|
||||||
|
return instance.fhirType();
|
||||||
|
} else if (!(instance instanceof Element) || ((Element) instance).isDisallowExtensions()) {
|
||||||
|
return Utilities.capitalize(instance.fhirType());
|
||||||
|
} else {
|
||||||
|
return instance.fhirType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Base copy() {
|
||||||
|
throw new Error("Not Implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TypedElementDefinition {
|
||||||
|
private ElementDefinition element;
|
||||||
|
private String type;
|
||||||
|
private StructureDefinition src;
|
||||||
|
|
||||||
|
public TypedElementDefinition(StructureDefinition src, ElementDefinition element, String type) {
|
||||||
|
super();
|
||||||
|
this.element = element;
|
||||||
|
this.type = type;
|
||||||
|
this.src = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypedElementDefinition(ElementDefinition element) {
|
||||||
|
super();
|
||||||
|
this.element = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinition getElement() {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TypeRefComponent> getTypes() {
|
||||||
|
List<TypeRefComponent> res = new ArrayList<ElementDefinition.TypeRefComponent>();
|
||||||
|
for (TypeRefComponent tr : element.getType()) {
|
||||||
|
if (type == null || type.equals(tr.getCode())) {
|
||||||
|
res.add(tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(String tn) {
|
||||||
|
if (type != null) {
|
||||||
|
return tn.equals(type);
|
||||||
|
} else {
|
||||||
|
for (TypeRefComponent t : element.getType()) {
|
||||||
|
if (tn.equals(t.getCode())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public StructureDefinition getSrc() {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FunctionDetails {
|
||||||
|
private String description;
|
||||||
|
private int minParameters;
|
||||||
|
private int maxParameters;
|
||||||
|
|
||||||
|
public FunctionDetails(String description, int minParameters, int maxParameters) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.minParameters = minParameters;
|
||||||
|
this.maxParameters = maxParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinParameters() {
|
||||||
|
return minParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxParameters() {
|
||||||
|
return maxParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,386 @@
|
||||||
|
package org.hl7.fhir.r4.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
|
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
|
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r4.model.UriType;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class TypeDetails {
|
||||||
|
public static final String FHIR_NS = "http://hl7.org/fhir/StructureDefinition/";
|
||||||
|
public static final String FP_NS = "http://hl7.org/fhirpath/";
|
||||||
|
public static final String FP_String = "http://hl7.org/fhirpath/String";
|
||||||
|
public static final String FP_Boolean = "http://hl7.org/fhirpath/Boolean";
|
||||||
|
public static final String FP_Integer = "http://hl7.org/fhirpath/Integer";
|
||||||
|
public static final String FP_Decimal = "http://hl7.org/fhirpath/Decimal";
|
||||||
|
public static final String FP_Quantity = "http://hl7.org/fhirpath/Quantity";
|
||||||
|
public static final String FP_DateTime = "http://hl7.org/fhirpath/DateTime";
|
||||||
|
public static final String FP_Time = "http://hl7.org/fhirpath/Time";
|
||||||
|
public static final String FP_SimpleTypeInfo = "http://hl7.org/fhirpath/SimpleTypeInfo";
|
||||||
|
public static final String FP_ClassInfo = "http://hl7.org/fhirpath/ClassInfo";
|
||||||
|
public static final Set<String> FP_NUMBERS = new HashSet<String>(Arrays.asList(FP_Integer, FP_Decimal));
|
||||||
|
|
||||||
|
public static class ProfiledType {
|
||||||
|
private String uri;
|
||||||
|
private List<String> profiles; // or, not and
|
||||||
|
private List<ElementDefinitionBindingComponent> bindings;
|
||||||
|
|
||||||
|
public ProfiledType(String n) {
|
||||||
|
uri = ns(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProfiles() {
|
||||||
|
return profiles != null && profiles.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getProfiles() {
|
||||||
|
return profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBindings() {
|
||||||
|
return bindings != null && bindings.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ElementDefinitionBindingComponent> getBindings() {
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String ns(String n) {
|
||||||
|
return Utilities.isAbsoluteUrl(n) ? n : FHIR_NS + n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfile(String profile) {
|
||||||
|
if (profiles == null)
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
profiles.add(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBinding(ElementDefinitionBindingComponent binding) {
|
||||||
|
bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
bindings.add(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBinding(ElementDefinitionBindingComponent b) {
|
||||||
|
return false; // todo: do we need to do this?
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfiles(List<CanonicalType> list) {
|
||||||
|
if (profiles == null)
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
for (UriType u : list)
|
||||||
|
profiles.add(u.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSystemType() {
|
||||||
|
return uri.startsWith(FP_NS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProfiledType> types = new ArrayList<ProfiledType>();
|
||||||
|
private CollectionStatus collectionStatus;
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, String... names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
this.types.add(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, Set<String> names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, ProfiledType pt) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
this.types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addType(String n) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addType(String n, String p) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
pt.addProfile(p);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addType(ProfiledType pt) {
|
||||||
|
for (ProfiledType et : types) {
|
||||||
|
if (et.uri.equals(pt.uri)) {
|
||||||
|
if (pt.profiles != null) {
|
||||||
|
for (String p : pt.profiles) {
|
||||||
|
if (et.profiles == null)
|
||||||
|
et.profiles = new ArrayList<String>();
|
||||||
|
if (!et.profiles.contains(p))
|
||||||
|
et.profiles.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pt.bindings != null) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.bindings) {
|
||||||
|
if (et.bindings == null)
|
||||||
|
et.bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
if (!et.hasBinding(b))
|
||||||
|
et.bindings.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTypes(Collection<String> names) {
|
||||||
|
for (String n : names)
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(IWorkerContext context, String... tn) {
|
||||||
|
for (String n : tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time",
|
||||||
|
"ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS + Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String n : tn) {
|
||||||
|
String id = n.contains("#") ? n.substring(0, n.indexOf("#")) : n;
|
||||||
|
String tail = null;
|
||||||
|
if (n.contains("#")) {
|
||||||
|
tail = n.substring(n.indexOf("#") + 1);
|
||||||
|
tail = tail.substring(tail.indexOf("."));
|
||||||
|
}
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
StructureDefinition sd = context.fetchResource(StructureDefinition.class, t);
|
||||||
|
while (sd != null) {
|
||||||
|
if (tail == null && typesContains(sd.getUrl()))
|
||||||
|
return true;
|
||||||
|
if (tail == null && getSystemType(sd.getUrl()) != null && typesContains(getSystemType(sd.getUrl())))
|
||||||
|
return true;
|
||||||
|
if (tail != null && typesContains(sd.getUrl() + "#" + sd.getType() + tail))
|
||||||
|
return true;
|
||||||
|
if (sd.hasBaseDefinition()) {
|
||||||
|
if (sd.getType().equals("uri"))
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/string");
|
||||||
|
else
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
||||||
|
} else
|
||||||
|
sd = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSystemType(String url) {
|
||||||
|
if (url.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
||||||
|
String code = url.substring(40);
|
||||||
|
if (Utilities.existsInList(code, "string", "boolean", "integer", "decimal", "dateTime", "time", "Quantity"))
|
||||||
|
return FP_NS + Utilities.capitalize(code);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean typesContains(String t) {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.equals(t))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(TypeDetails source) {
|
||||||
|
for (ProfiledType pt : source.types)
|
||||||
|
addType(pt);
|
||||||
|
if (collectionStatus == null)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else if (source.collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else
|
||||||
|
collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails union(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
result.addType(pt);
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails intersect(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
boolean found = false;
|
||||||
|
for (ProfiledType r : right.types)
|
||||||
|
found = found || pt.uri.equals(r.uri);
|
||||||
|
if (found)
|
||||||
|
result.addType(pt);
|
||||||
|
}
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNoTypes() {
|
||||||
|
return types.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getTypes() {
|
||||||
|
Set<String> res = new HashSet<String>();
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
res.add(pt.uri);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails toSingleton() {
|
||||||
|
TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
|
||||||
|
result.types.addAll(types);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CollectionStatus getCollectionStatus() {
|
||||||
|
return collectionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(String n) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "date", "dateTime", "time",
|
||||||
|
"ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS + Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(Set<String> tn) {
|
||||||
|
for (String n : tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time",
|
||||||
|
"ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS + Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String describe() {
|
||||||
|
return getTypes().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return (collectionStatus == null ? collectionStatus.SINGLETON.toString() : collectionStatus.toString())
|
||||||
|
+ getTypes().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeCode() throws DefinitionException {
|
||||||
|
if (types.size() != 1)
|
||||||
|
throw new DefinitionException("Multiple types? (" + types.toString() + ")");
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.startsWith("http://hl7.org/fhir/StructureDefinition/"))
|
||||||
|
return pt.uri.substring(40);
|
||||||
|
else
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProfiledType> getProfiledTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
if (pt.hasBindings())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinitionBindingComponent getBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.getBindings())
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,7 +31,8 @@ package org.hl7.fhir.r4.model;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine;
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the base class for Profile classes - whether generated or
|
* This class is the base class for Profile classes - whether generated or
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext;
|
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4.model.Base;
|
import org.hl7.fhir.r4.model.Base;
|
||||||
import org.hl7.fhir.r4.model.CanonicalType;
|
import org.hl7.fhir.r4.model.CanonicalType;
|
||||||
import org.hl7.fhir.r4.model.ElementDefinition;
|
import org.hl7.fhir.r4.model.ElementDefinition;
|
||||||
|
@ -47,7 +48,6 @@ import org.hl7.fhir.r4.model.Resource;
|
||||||
import org.hl7.fhir.r4.model.ResourceFactory;
|
import org.hl7.fhir.r4.model.ResourceFactory;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition;
|
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4.context.SimpleWorkerContext;
|
import org.hl7.fhir.r4.context.SimpleWorkerContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4.formats.JsonParser;
|
import org.hl7.fhir.r4.formats.JsonParser;
|
||||||
import org.hl7.fhir.r4.formats.XmlParser;
|
import org.hl7.fhir.r4.formats.XmlParser;
|
||||||
|
|
|
@ -39,6 +39,8 @@ import java.util.Map;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext;
|
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4.model.BackboneElement;
|
import org.hl7.fhir.r4.model.BackboneElement;
|
||||||
import org.hl7.fhir.r4.model.Base;
|
import org.hl7.fhir.r4.model.Base;
|
||||||
import org.hl7.fhir.r4.model.Bundle;
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
|
@ -47,7 +49,6 @@ import org.hl7.fhir.r4.model.Bundle.BundleLinkComponent;
|
||||||
import org.hl7.fhir.r4.model.CanonicalType;
|
import org.hl7.fhir.r4.model.CanonicalType;
|
||||||
import org.hl7.fhir.r4.model.DomainResource;
|
import org.hl7.fhir.r4.model.DomainResource;
|
||||||
import org.hl7.fhir.r4.model.Element;
|
import org.hl7.fhir.r4.model.Element;
|
||||||
import org.hl7.fhir.r4.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4.model.IntegerType;
|
import org.hl7.fhir.r4.model.IntegerType;
|
||||||
import org.hl7.fhir.r4.model.Property;
|
import org.hl7.fhir.r4.model.Property;
|
||||||
import org.hl7.fhir.r4.model.Reference;
|
import org.hl7.fhir.r4.model.Reference;
|
||||||
|
|
|
@ -38,15 +38,16 @@ import java.util.Map;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext;
|
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine.ExpressionNodeWithOffset;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4.model.Base;
|
import org.hl7.fhir.r4.model.Base;
|
||||||
import org.hl7.fhir.r4.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4.model.Resource;
|
import org.hl7.fhir.r4.model.Resource;
|
||||||
import org.hl7.fhir.r4.model.Tuple;
|
import org.hl7.fhir.r4.model.Tuple;
|
||||||
import org.hl7.fhir.r4.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine.ExpressionNodeWithOffset;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
public class LiquidEngine implements IEvaluationContext {
|
public class LiquidEngine implements IEvaluationContext {
|
||||||
|
|
|
@ -54,6 +54,7 @@ import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
import org.hl7.fhir.r4.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext;
|
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
|
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
import org.hl7.fhir.r4.formats.FormatUtilities;
|
import org.hl7.fhir.r4.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4.formats.XmlParser;
|
import org.hl7.fhir.r4.formats.XmlParser;
|
||||||
|
@ -154,7 +155,6 @@ import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent;
|
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent;
|
||||||
import org.hl7.fhir.r4.terminologies.CodeSystemUtilities;
|
import org.hl7.fhir.r4.terminologies.CodeSystemUtilities;
|
||||||
import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4.utils.LiquidEngine.LiquidDocument;
|
import org.hl7.fhir.r4.utils.LiquidEngine.LiquidDocument;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
|
|
|
@ -53,6 +53,15 @@ import org.hl7.fhir.r4.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
|
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
|
||||||
import org.hl7.fhir.r4.elementmodel.Element;
|
import org.hl7.fhir.r4.elementmodel.Element;
|
||||||
import org.hl7.fhir.r4.elementmodel.Property;
|
import org.hl7.fhir.r4.elementmodel.Property;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRLexer.FHIRLexerException;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.TypeDetails.ProfiledType;
|
||||||
import org.hl7.fhir.r4.model.Base;
|
import org.hl7.fhir.r4.model.Base;
|
||||||
import org.hl7.fhir.r4.model.BooleanType;
|
import org.hl7.fhir.r4.model.BooleanType;
|
||||||
import org.hl7.fhir.r4.model.CanonicalType;
|
import org.hl7.fhir.r4.model.CanonicalType;
|
||||||
|
@ -75,8 +84,6 @@ import org.hl7.fhir.r4.model.Enumeration;
|
||||||
import org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence;
|
import org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence;
|
||||||
import org.hl7.fhir.r4.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r4.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r4.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r4.model.IdType;
|
import org.hl7.fhir.r4.model.IdType;
|
||||||
import org.hl7.fhir.r4.model.IntegerType;
|
import org.hl7.fhir.r4.model.IntegerType;
|
||||||
import org.hl7.fhir.r4.model.Narrative;
|
import org.hl7.fhir.r4.model.Narrative;
|
||||||
|
@ -106,15 +113,10 @@ import org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent;
|
||||||
import org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode;
|
import org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode;
|
||||||
import org.hl7.fhir.r4.model.StructureMap.StructureMapTransform;
|
import org.hl7.fhir.r4.model.StructureMap.StructureMapTransform;
|
||||||
import org.hl7.fhir.r4.model.Type;
|
import org.hl7.fhir.r4.model.Type;
|
||||||
import org.hl7.fhir.r4.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4.model.TypeDetails.ProfiledType;
|
|
||||||
import org.hl7.fhir.r4.model.UriType;
|
import org.hl7.fhir.r4.model.UriType;
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r4.utils.FHIRLexer.FHIRLexerException;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r4.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r4.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
|
|
|
@ -18,23 +18,23 @@ import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.fhir.ucum.UcumException;
|
import org.fhir.ucum.UcumException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4.formats.JsonParser;
|
import org.hl7.fhir.r4.formats.JsonParser;
|
||||||
import org.hl7.fhir.r4.formats.XmlParser;
|
import org.hl7.fhir.r4.formats.XmlParser;
|
||||||
import org.hl7.fhir.r4.model.Base;
|
import org.hl7.fhir.r4.model.Base;
|
||||||
import org.hl7.fhir.r4.model.BooleanType;
|
import org.hl7.fhir.r4.model.BooleanType;
|
||||||
import org.hl7.fhir.r4.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4.model.IdType;
|
import org.hl7.fhir.r4.model.IdType;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
import org.hl7.fhir.r4.model.PrimitiveType;
|
import org.hl7.fhir.r4.model.PrimitiveType;
|
||||||
import org.hl7.fhir.r4.model.Quantity;
|
import org.hl7.fhir.r4.model.Quantity;
|
||||||
import org.hl7.fhir.r4.model.Resource;
|
import org.hl7.fhir.r4.model.Resource;
|
||||||
import org.hl7.fhir.r4.model.StringType;
|
import org.hl7.fhir.r4.model.StringType;
|
||||||
import org.hl7.fhir.r4.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
|
@ -18,22 +18,22 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
import org.hl7.fhir.r4.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4.formats.JsonParser;
|
import org.hl7.fhir.r4.formats.JsonParser;
|
||||||
import org.hl7.fhir.r4.formats.XmlParser;
|
import org.hl7.fhir.r4.formats.XmlParser;
|
||||||
import org.hl7.fhir.r4.model.Base;
|
import org.hl7.fhir.r4.model.Base;
|
||||||
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r4.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r4.model.Resource;
|
import org.hl7.fhir.r4.model.Resource;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition;
|
import org.hl7.fhir.r4.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r4.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r4.utils.NarrativeGenerator;
|
import org.hl7.fhir.r4.utils.NarrativeGenerator;
|
||||||
import org.hl7.fhir.r4.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r4.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.comparison.CodeSystemComparer.CodeSystemComparison;
|
import org.hl7.fhir.r4b.comparison.CodeSystemComparer.CodeSystemComparison;
|
||||||
import org.hl7.fhir.r4b.comparison.ProfileComparer.ProfileComparison;
|
import org.hl7.fhir.r4b.comparison.ProfileComparer.ProfileComparison;
|
||||||
import org.hl7.fhir.r4b.comparison.ResourceComparer.PlaceHolderComparison;
|
import org.hl7.fhir.r4b.comparison.ResourceComparer.PlaceHolderComparison;
|
||||||
|
@ -23,16 +22,16 @@ import org.hl7.fhir.r4b.comparison.ValueSetComparer.ValueSetComparison;
|
||||||
|
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r4b.model.StringType;
|
import org.hl7.fhir.r4b.model.StringType;
|
||||||
import org.hl7.fhir.r4b.model.Tuple;
|
import org.hl7.fhir.r4b.model.Tuple;
|
||||||
|
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4b.model.ValueSet;
|
import org.hl7.fhir.r4b.model.ValueSet;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r4b.utils.LiquidEngine;
|
import org.hl7.fhir.r4b.utils.LiquidEngine;
|
||||||
import org.hl7.fhir.r4b.utils.LiquidEngine.LiquidDocument;
|
import org.hl7.fhir.r4b.utils.LiquidEngine.LiquidDocument;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
|
|
|
@ -55,6 +55,11 @@ import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext.ValidationResult;
|
import org.hl7.fhir.r4b.context.IWorkerContext.ValidationResult;
|
||||||
import org.hl7.fhir.r4b.elementmodel.ObjectConverter;
|
import org.hl7.fhir.r4b.elementmodel.ObjectConverter;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Property;
|
import org.hl7.fhir.r4b.elementmodel.Property;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode.Kind;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode.Operation;
|
||||||
import org.hl7.fhir.r4b.formats.IParser;
|
import org.hl7.fhir.r4b.formats.IParser;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.BooleanType;
|
import org.hl7.fhir.r4b.model.BooleanType;
|
||||||
|
@ -81,9 +86,6 @@ import org.hl7.fhir.r4b.model.Enumeration;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.BindingStrength;
|
import org.hl7.fhir.r4b.model.Enumerations.BindingStrength;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r4b.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode.Kind;
|
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode.Operation;
|
|
||||||
import org.hl7.fhir.r4b.model.Extension;
|
import org.hl7.fhir.r4b.model.Extension;
|
||||||
import org.hl7.fhir.r4b.model.IdType;
|
import org.hl7.fhir.r4b.model.IdType;
|
||||||
import org.hl7.fhir.r4b.model.IntegerType;
|
import org.hl7.fhir.r4b.model.IntegerType;
|
||||||
|
@ -107,8 +109,6 @@ import org.hl7.fhir.r4b.renderers.TerminologyRenderer;
|
||||||
import org.hl7.fhir.r4b.renderers.spreadsheets.SpreadsheetGenerator;
|
import org.hl7.fhir.r4b.renderers.spreadsheets.SpreadsheetGenerator;
|
||||||
import org.hl7.fhir.r4b.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r4b.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRLexer;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.utils.PublicationHacker;
|
import org.hl7.fhir.r4b.utils.PublicationHacker;
|
||||||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r4b.utils.TranslatingUtilities;
|
import org.hl7.fhir.r4b.utils.TranslatingUtilities;
|
||||||
|
|
|
@ -47,12 +47,12 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Element.SpecialElement;
|
import org.hl7.fhir.r4b.elementmodel.Element.SpecialElement;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4b.formats.JsonCreator;
|
import org.hl7.fhir.r4b.formats.JsonCreator;
|
||||||
import org.hl7.fhir.r4b.formats.JsonCreatorCanonical;
|
import org.hl7.fhir.r4b.formats.JsonCreatorCanonical;
|
||||||
import org.hl7.fhir.r4b.formats.JsonCreatorGson;
|
import org.hl7.fhir.r4b.formats.JsonCreatorGson;
|
||||||
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition;
|
import org.hl7.fhir.r4b.model.StructureDefinition;
|
||||||
import org.hl7.fhir.utilities.StringPair;
|
import org.hl7.fhir.utilities.StringPair;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
|
|
|
@ -36,13 +36,13 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.r4b.formats.FormatUtilities;
|
import org.hl7.fhir.r4b.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.r4b.model.ElementDefinition;
|
import org.hl7.fhir.r4b.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r4b.model.ElementDefinition.PropertyRepresentation;
|
import org.hl7.fhir.r4b.model.ElementDefinition.PropertyRepresentation;
|
||||||
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition;
|
import org.hl7.fhir.r4b.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r4b.utils.TypesUtilities;
|
import org.hl7.fhir.r4b.utils.TypesUtilities;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
|
@ -0,0 +1,948 @@
|
||||||
|
package org.hl7.fhir.r4b.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
|
import org.hl7.fhir.r4b.model.Quantity;
|
||||||
|
import org.hl7.fhir.r4b.model.StringType;
|
||||||
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class ExpressionNode {
|
||||||
|
|
||||||
|
public enum Kind {
|
||||||
|
Name, Function, Constant, Group, Unary
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Function {
|
||||||
|
Custom,
|
||||||
|
|
||||||
|
Empty, Not, Exists, SubsetOf, SupersetOf, IsDistinct, Distinct, Count, Where, Select, All, Repeat, Aggregate,
|
||||||
|
Item /* implicit from name[] */, As, Is, Single, First, Last, Tail, Skip, Take, Union, Combine, Intersect, Exclude,
|
||||||
|
Iif, Upper, Lower, ToChars, IndexOf, Substring, StartsWith, EndsWith, Matches, MatchesFull, ReplaceMatches,
|
||||||
|
Contains, Replace, Length, Children, Descendants, MemberOf, Trace, Check, Today, Now, Resolve, Extension, AllFalse,
|
||||||
|
AnyFalse, AllTrue, AnyTrue, HasValue, OfType, Type, ConvertsToBoolean, ConvertsToInteger, ConvertsToString,
|
||||||
|
ConvertsToDecimal, ConvertsToQuantity, ConvertsToDateTime, ConvertsToDate, ConvertsToTime, ToBoolean, ToInteger,
|
||||||
|
ToString, ToDecimal, ToQuantity, ToDateTime, ToTime, ConformsTo, Round, Sqrt, Abs, Ceiling, Exp, Floor, Ln, Log,
|
||||||
|
Power, Truncate,
|
||||||
|
|
||||||
|
// R3 functions
|
||||||
|
Encode, Decode, Escape, Unescape, Trim, Split, Join, LowBoundary, HighBoundary, Precision,
|
||||||
|
|
||||||
|
// Local extensions to FHIRPath
|
||||||
|
HtmlChecks1, HtmlChecks2, AliasAs, Alias, Comparable;
|
||||||
|
|
||||||
|
public static Function fromCode(String name) {
|
||||||
|
if (name.equals("empty"))
|
||||||
|
return Function.Empty;
|
||||||
|
if (name.equals("not"))
|
||||||
|
return Function.Not;
|
||||||
|
if (name.equals("exists"))
|
||||||
|
return Function.Exists;
|
||||||
|
if (name.equals("subsetOf"))
|
||||||
|
return Function.SubsetOf;
|
||||||
|
if (name.equals("supersetOf"))
|
||||||
|
return Function.SupersetOf;
|
||||||
|
if (name.equals("isDistinct"))
|
||||||
|
return Function.IsDistinct;
|
||||||
|
if (name.equals("distinct"))
|
||||||
|
return Function.Distinct;
|
||||||
|
if (name.equals("count"))
|
||||||
|
return Function.Count;
|
||||||
|
if (name.equals("where"))
|
||||||
|
return Function.Where;
|
||||||
|
if (name.equals("select"))
|
||||||
|
return Function.Select;
|
||||||
|
if (name.equals("all"))
|
||||||
|
return Function.All;
|
||||||
|
if (name.equals("repeat"))
|
||||||
|
return Function.Repeat;
|
||||||
|
if (name.equals("aggregate"))
|
||||||
|
return Function.Aggregate;
|
||||||
|
if (name.equals("item"))
|
||||||
|
return Function.Item;
|
||||||
|
if (name.equals("as"))
|
||||||
|
return Function.As;
|
||||||
|
if (name.equals("is"))
|
||||||
|
return Function.Is;
|
||||||
|
if (name.equals("single"))
|
||||||
|
return Function.Single;
|
||||||
|
if (name.equals("first"))
|
||||||
|
return Function.First;
|
||||||
|
if (name.equals("last"))
|
||||||
|
return Function.Last;
|
||||||
|
if (name.equals("tail"))
|
||||||
|
return Function.Tail;
|
||||||
|
if (name.equals("skip"))
|
||||||
|
return Function.Skip;
|
||||||
|
if (name.equals("take"))
|
||||||
|
return Function.Take;
|
||||||
|
if (name.equals("union"))
|
||||||
|
return Function.Union;
|
||||||
|
if (name.equals("combine"))
|
||||||
|
return Function.Combine;
|
||||||
|
if (name.equals("intersect"))
|
||||||
|
return Function.Intersect;
|
||||||
|
if (name.equals("exclude"))
|
||||||
|
return Function.Exclude;
|
||||||
|
if (name.equals("iif"))
|
||||||
|
return Function.Iif;
|
||||||
|
if (name.equals("lower"))
|
||||||
|
return Function.Lower;
|
||||||
|
if (name.equals("upper"))
|
||||||
|
return Function.Upper;
|
||||||
|
if (name.equals("toChars"))
|
||||||
|
return Function.ToChars;
|
||||||
|
if (name.equals("indexOf"))
|
||||||
|
return Function.IndexOf;
|
||||||
|
if (name.equals("substring"))
|
||||||
|
return Function.Substring;
|
||||||
|
if (name.equals("startsWith"))
|
||||||
|
return Function.StartsWith;
|
||||||
|
if (name.equals("endsWith"))
|
||||||
|
return Function.EndsWith;
|
||||||
|
if (name.equals("matches"))
|
||||||
|
return Function.Matches;
|
||||||
|
if (name.equals("matchesFull"))
|
||||||
|
return Function.MatchesFull;
|
||||||
|
if (name.equals("replaceMatches"))
|
||||||
|
return Function.ReplaceMatches;
|
||||||
|
if (name.equals("contains"))
|
||||||
|
return Function.Contains;
|
||||||
|
if (name.equals("replace"))
|
||||||
|
return Function.Replace;
|
||||||
|
if (name.equals("length"))
|
||||||
|
return Function.Length;
|
||||||
|
if (name.equals("children"))
|
||||||
|
return Function.Children;
|
||||||
|
if (name.equals("descendants"))
|
||||||
|
return Function.Descendants;
|
||||||
|
if (name.equals("memberOf"))
|
||||||
|
return Function.MemberOf;
|
||||||
|
if (name.equals("trace"))
|
||||||
|
return Function.Trace;
|
||||||
|
if (name.equals("check"))
|
||||||
|
return Function.Check;
|
||||||
|
if (name.equals("today"))
|
||||||
|
return Function.Today;
|
||||||
|
if (name.equals("now"))
|
||||||
|
return Function.Now;
|
||||||
|
if (name.equals("resolve"))
|
||||||
|
return Function.Resolve;
|
||||||
|
if (name.equals("extension"))
|
||||||
|
return Function.Extension;
|
||||||
|
if (name.equals("allFalse"))
|
||||||
|
return Function.AllFalse;
|
||||||
|
if (name.equals("anyFalse"))
|
||||||
|
return Function.AnyFalse;
|
||||||
|
if (name.equals("allTrue"))
|
||||||
|
return Function.AllTrue;
|
||||||
|
if (name.equals("anyTrue"))
|
||||||
|
return Function.AnyTrue;
|
||||||
|
if (name.equals("hasValue"))
|
||||||
|
return Function.HasValue;
|
||||||
|
if (name.equals("alias"))
|
||||||
|
return Function.Alias;
|
||||||
|
if (name.equals("aliasAs"))
|
||||||
|
return Function.AliasAs;
|
||||||
|
if (name.equals("htmlChecks"))
|
||||||
|
return Function.HtmlChecks1;
|
||||||
|
if (name.equals("htmlchecks"))
|
||||||
|
return Function.HtmlChecks1; // support change of care from R3
|
||||||
|
if (name.equals("htmlChecks2"))
|
||||||
|
return Function.HtmlChecks2;
|
||||||
|
if (name.equals("comparable"))
|
||||||
|
return Function.Comparable;
|
||||||
|
if (name.equals("encode"))
|
||||||
|
return Function.Encode;
|
||||||
|
if (name.equals("decode"))
|
||||||
|
return Function.Decode;
|
||||||
|
if (name.equals("escape"))
|
||||||
|
return Function.Escape;
|
||||||
|
if (name.equals("unescape"))
|
||||||
|
return Function.Unescape;
|
||||||
|
if (name.equals("trim"))
|
||||||
|
return Function.Trim;
|
||||||
|
if (name.equals("split"))
|
||||||
|
return Function.Split;
|
||||||
|
if (name.equals("join"))
|
||||||
|
return Function.Join;
|
||||||
|
if (name.equals("ofType"))
|
||||||
|
return Function.OfType;
|
||||||
|
if (name.equals("type"))
|
||||||
|
return Function.Type;
|
||||||
|
if (name.equals("toInteger"))
|
||||||
|
return Function.ToInteger;
|
||||||
|
if (name.equals("toDecimal"))
|
||||||
|
return Function.ToDecimal;
|
||||||
|
if (name.equals("toString"))
|
||||||
|
return Function.ToString;
|
||||||
|
if (name.equals("toQuantity"))
|
||||||
|
return Function.ToQuantity;
|
||||||
|
if (name.equals("toBoolean"))
|
||||||
|
return Function.ToBoolean;
|
||||||
|
if (name.equals("toDateTime"))
|
||||||
|
return Function.ToDateTime;
|
||||||
|
if (name.equals("toTime"))
|
||||||
|
return Function.ToTime;
|
||||||
|
if (name.equals("convertsToInteger"))
|
||||||
|
return Function.ConvertsToInteger;
|
||||||
|
if (name.equals("convertsToDecimal"))
|
||||||
|
return Function.ConvertsToDecimal;
|
||||||
|
if (name.equals("convertsToString"))
|
||||||
|
return Function.ConvertsToString;
|
||||||
|
if (name.equals("convertsToQuantity"))
|
||||||
|
return Function.ConvertsToQuantity;
|
||||||
|
if (name.equals("convertsToBoolean"))
|
||||||
|
return Function.ConvertsToBoolean;
|
||||||
|
if (name.equals("convertsToDateTime"))
|
||||||
|
return Function.ConvertsToDateTime;
|
||||||
|
if (name.equals("convertsToDate"))
|
||||||
|
return Function.ConvertsToDate;
|
||||||
|
if (name.equals("convertsToTime"))
|
||||||
|
return Function.ConvertsToTime;
|
||||||
|
if (name.equals("conformsTo"))
|
||||||
|
return Function.ConformsTo;
|
||||||
|
if (name.equals("round"))
|
||||||
|
return Function.Round;
|
||||||
|
if (name.equals("sqrt"))
|
||||||
|
return Function.Sqrt;
|
||||||
|
if (name.equals("abs"))
|
||||||
|
return Function.Abs;
|
||||||
|
if (name.equals("ceiling"))
|
||||||
|
return Function.Ceiling;
|
||||||
|
if (name.equals("exp"))
|
||||||
|
return Function.Exp;
|
||||||
|
if (name.equals("floor"))
|
||||||
|
return Function.Floor;
|
||||||
|
if (name.equals("ln"))
|
||||||
|
return Function.Ln;
|
||||||
|
if (name.equals("log"))
|
||||||
|
return Function.Log;
|
||||||
|
if (name.equals("power"))
|
||||||
|
return Function.Power;
|
||||||
|
if (name.equals("truncate"))
|
||||||
|
return Function.Truncate;
|
||||||
|
if (name.equals("lowBoundary"))
|
||||||
|
return Function.LowBoundary;
|
||||||
|
if (name.equals("highBoundary"))
|
||||||
|
return Function.HighBoundary;
|
||||||
|
if (name.equals("precision"))
|
||||||
|
return Function.Precision;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Empty:
|
||||||
|
return "empty";
|
||||||
|
case Not:
|
||||||
|
return "not";
|
||||||
|
case Exists:
|
||||||
|
return "exists";
|
||||||
|
case SubsetOf:
|
||||||
|
return "subsetOf";
|
||||||
|
case SupersetOf:
|
||||||
|
return "supersetOf";
|
||||||
|
case IsDistinct:
|
||||||
|
return "isDistinct";
|
||||||
|
case Distinct:
|
||||||
|
return "distinct";
|
||||||
|
case Count:
|
||||||
|
return "count";
|
||||||
|
case Where:
|
||||||
|
return "where";
|
||||||
|
case Select:
|
||||||
|
return "select";
|
||||||
|
case All:
|
||||||
|
return "all";
|
||||||
|
case Repeat:
|
||||||
|
return "repeat";
|
||||||
|
case Aggregate:
|
||||||
|
return "aggregate";
|
||||||
|
case Item:
|
||||||
|
return "item";
|
||||||
|
case As:
|
||||||
|
return "as";
|
||||||
|
case Is:
|
||||||
|
return "is";
|
||||||
|
case Single:
|
||||||
|
return "single";
|
||||||
|
case First:
|
||||||
|
return "first";
|
||||||
|
case Last:
|
||||||
|
return "last";
|
||||||
|
case Tail:
|
||||||
|
return "tail";
|
||||||
|
case Skip:
|
||||||
|
return "skip";
|
||||||
|
case Take:
|
||||||
|
return "take";
|
||||||
|
case Union:
|
||||||
|
return "union";
|
||||||
|
case Combine:
|
||||||
|
return "combine";
|
||||||
|
case Intersect:
|
||||||
|
return "intersect";
|
||||||
|
case Exclude:
|
||||||
|
return "exclude";
|
||||||
|
case Iif:
|
||||||
|
return "iif";
|
||||||
|
case ToChars:
|
||||||
|
return "toChars";
|
||||||
|
case Lower:
|
||||||
|
return "lower";
|
||||||
|
case Upper:
|
||||||
|
return "upper";
|
||||||
|
case IndexOf:
|
||||||
|
return "indexOf";
|
||||||
|
case Substring:
|
||||||
|
return "substring";
|
||||||
|
case StartsWith:
|
||||||
|
return "startsWith";
|
||||||
|
case EndsWith:
|
||||||
|
return "endsWith";
|
||||||
|
case Matches:
|
||||||
|
return "matches";
|
||||||
|
case MatchesFull:
|
||||||
|
return "matchesFull";
|
||||||
|
case ReplaceMatches:
|
||||||
|
return "replaceMatches";
|
||||||
|
case Contains:
|
||||||
|
return "contains";
|
||||||
|
case Replace:
|
||||||
|
return "replace";
|
||||||
|
case Length:
|
||||||
|
return "length";
|
||||||
|
case Children:
|
||||||
|
return "children";
|
||||||
|
case Descendants:
|
||||||
|
return "descendants";
|
||||||
|
case MemberOf:
|
||||||
|
return "memberOf";
|
||||||
|
case Trace:
|
||||||
|
return "trace";
|
||||||
|
case Check:
|
||||||
|
return "check";
|
||||||
|
case Today:
|
||||||
|
return "today";
|
||||||
|
case Now:
|
||||||
|
return "now";
|
||||||
|
case Resolve:
|
||||||
|
return "resolve";
|
||||||
|
case Extension:
|
||||||
|
return "extension";
|
||||||
|
case AllFalse:
|
||||||
|
return "allFalse";
|
||||||
|
case AnyFalse:
|
||||||
|
return "anyFalse";
|
||||||
|
case AllTrue:
|
||||||
|
return "allTrue";
|
||||||
|
case AnyTrue:
|
||||||
|
return "anyTrue";
|
||||||
|
case HasValue:
|
||||||
|
return "hasValue";
|
||||||
|
case Alias:
|
||||||
|
return "alias";
|
||||||
|
case AliasAs:
|
||||||
|
return "aliasAs";
|
||||||
|
case Encode:
|
||||||
|
return "encode";
|
||||||
|
case Decode:
|
||||||
|
return "decode";
|
||||||
|
case Escape:
|
||||||
|
return "escape";
|
||||||
|
case Unescape:
|
||||||
|
return "unescape";
|
||||||
|
case Trim:
|
||||||
|
return "trim";
|
||||||
|
case Split:
|
||||||
|
return "split";
|
||||||
|
case Join:
|
||||||
|
return "join";
|
||||||
|
case HtmlChecks1:
|
||||||
|
return "htmlChecks";
|
||||||
|
case HtmlChecks2:
|
||||||
|
return "htmlChecks2";
|
||||||
|
case Comparable:
|
||||||
|
return "comparable";
|
||||||
|
case OfType:
|
||||||
|
return "ofType";
|
||||||
|
case Type:
|
||||||
|
return "type";
|
||||||
|
case ToInteger:
|
||||||
|
return "toInteger";
|
||||||
|
case ToDecimal:
|
||||||
|
return "toDecimal";
|
||||||
|
case ToString:
|
||||||
|
return "toString";
|
||||||
|
case ToBoolean:
|
||||||
|
return "toBoolean";
|
||||||
|
case ToQuantity:
|
||||||
|
return "toQuantity";
|
||||||
|
case ToDateTime:
|
||||||
|
return "toDateTime";
|
||||||
|
case ToTime:
|
||||||
|
return "toTime";
|
||||||
|
case ConvertsToInteger:
|
||||||
|
return "convertsToInteger";
|
||||||
|
case ConvertsToDecimal:
|
||||||
|
return "convertsToDecimal";
|
||||||
|
case ConvertsToString:
|
||||||
|
return "convertsToString";
|
||||||
|
case ConvertsToBoolean:
|
||||||
|
return "convertsToBoolean";
|
||||||
|
case ConvertsToQuantity:
|
||||||
|
return "convertsToQuantity";
|
||||||
|
case ConvertsToDateTime:
|
||||||
|
return "convertsToDateTime";
|
||||||
|
case ConvertsToDate:
|
||||||
|
return "convertsToDate";
|
||||||
|
case ConvertsToTime:
|
||||||
|
return "isTime";
|
||||||
|
case ConformsTo:
|
||||||
|
return "conformsTo";
|
||||||
|
case Round:
|
||||||
|
return "round";
|
||||||
|
case Sqrt:
|
||||||
|
return "sqrt";
|
||||||
|
case Abs:
|
||||||
|
return "abs";
|
||||||
|
case Ceiling:
|
||||||
|
return "ceiling";
|
||||||
|
case Exp:
|
||||||
|
return "exp";
|
||||||
|
case Floor:
|
||||||
|
return "floor";
|
||||||
|
case Ln:
|
||||||
|
return "ln";
|
||||||
|
case Log:
|
||||||
|
return "log";
|
||||||
|
case Power:
|
||||||
|
return "power";
|
||||||
|
case Truncate:
|
||||||
|
return "truncate";
|
||||||
|
case LowBoundary:
|
||||||
|
return "lowBoundary";
|
||||||
|
case HighBoundary:
|
||||||
|
return "highBoundary";
|
||||||
|
case Precision:
|
||||||
|
return "precision";
|
||||||
|
default:
|
||||||
|
return "?custom?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Operation {
|
||||||
|
Equals, Equivalent, NotEquals, NotEquivalent, LessThan, Greater, LessOrEqual, GreaterOrEqual, Is, As, Union, Or,
|
||||||
|
And, Xor, Implies, Times, DivideBy, Plus, Minus, Concatenate, Div, Mod, In, Contains, MemberOf;
|
||||||
|
|
||||||
|
public static Operation fromCode(String name) {
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return null;
|
||||||
|
if (name.equals("="))
|
||||||
|
return Operation.Equals;
|
||||||
|
if (name.equals("~"))
|
||||||
|
return Operation.Equivalent;
|
||||||
|
if (name.equals("!="))
|
||||||
|
return Operation.NotEquals;
|
||||||
|
if (name.equals("!~"))
|
||||||
|
return Operation.NotEquivalent;
|
||||||
|
if (name.equals(">"))
|
||||||
|
return Operation.Greater;
|
||||||
|
if (name.equals("<"))
|
||||||
|
return Operation.LessThan;
|
||||||
|
if (name.equals(">="))
|
||||||
|
return Operation.GreaterOrEqual;
|
||||||
|
if (name.equals("<="))
|
||||||
|
return Operation.LessOrEqual;
|
||||||
|
if (name.equals("|"))
|
||||||
|
return Operation.Union;
|
||||||
|
if (name.equals("or"))
|
||||||
|
return Operation.Or;
|
||||||
|
if (name.equals("and"))
|
||||||
|
return Operation.And;
|
||||||
|
if (name.equals("xor"))
|
||||||
|
return Operation.Xor;
|
||||||
|
if (name.equals("is"))
|
||||||
|
return Operation.Is;
|
||||||
|
if (name.equals("as"))
|
||||||
|
return Operation.As;
|
||||||
|
if (name.equals("*"))
|
||||||
|
return Operation.Times;
|
||||||
|
if (name.equals("/"))
|
||||||
|
return Operation.DivideBy;
|
||||||
|
if (name.equals("+"))
|
||||||
|
return Operation.Plus;
|
||||||
|
if (name.equals("-"))
|
||||||
|
return Operation.Minus;
|
||||||
|
if (name.equals("&"))
|
||||||
|
return Operation.Concatenate;
|
||||||
|
if (name.equals("implies"))
|
||||||
|
return Operation.Implies;
|
||||||
|
if (name.equals("div"))
|
||||||
|
return Operation.Div;
|
||||||
|
if (name.equals("mod"))
|
||||||
|
return Operation.Mod;
|
||||||
|
if (name.equals("in"))
|
||||||
|
return Operation.In;
|
||||||
|
if (name.equals("contains"))
|
||||||
|
return Operation.Contains;
|
||||||
|
if (name.equals("memberOf"))
|
||||||
|
return Operation.MemberOf;
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Equals:
|
||||||
|
return "=";
|
||||||
|
case Equivalent:
|
||||||
|
return "~";
|
||||||
|
case NotEquals:
|
||||||
|
return "!=";
|
||||||
|
case NotEquivalent:
|
||||||
|
return "!~";
|
||||||
|
case Greater:
|
||||||
|
return ">";
|
||||||
|
case LessThan:
|
||||||
|
return "<";
|
||||||
|
case GreaterOrEqual:
|
||||||
|
return ">=";
|
||||||
|
case LessOrEqual:
|
||||||
|
return "<=";
|
||||||
|
case Union:
|
||||||
|
return "|";
|
||||||
|
case Or:
|
||||||
|
return "or";
|
||||||
|
case And:
|
||||||
|
return "and";
|
||||||
|
case Xor:
|
||||||
|
return "xor";
|
||||||
|
case Times:
|
||||||
|
return "*";
|
||||||
|
case DivideBy:
|
||||||
|
return "/";
|
||||||
|
case Plus:
|
||||||
|
return "+";
|
||||||
|
case Minus:
|
||||||
|
return "-";
|
||||||
|
case Concatenate:
|
||||||
|
return "&";
|
||||||
|
case Implies:
|
||||||
|
return "implies";
|
||||||
|
case Is:
|
||||||
|
return "is";
|
||||||
|
case As:
|
||||||
|
return "as";
|
||||||
|
case Div:
|
||||||
|
return "div";
|
||||||
|
case Mod:
|
||||||
|
return "mod";
|
||||||
|
case In:
|
||||||
|
return "in";
|
||||||
|
case Contains:
|
||||||
|
return "contains";
|
||||||
|
case MemberOf:
|
||||||
|
return "memberOf";
|
||||||
|
default:
|
||||||
|
return "?custom?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CollectionStatus {
|
||||||
|
SINGLETON, ORDERED, UNORDERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the expression will have one of either name or constant
|
||||||
|
private String uniqueId;
|
||||||
|
private Kind kind;
|
||||||
|
private String name;
|
||||||
|
private Base constant;
|
||||||
|
private Function function;
|
||||||
|
private List<ExpressionNode> parameters; // will be created if there is a function
|
||||||
|
private ExpressionNode inner;
|
||||||
|
private ExpressionNode group;
|
||||||
|
private Operation operation;
|
||||||
|
private boolean proximal; // a proximal operation is the first in the sequence of operations. This is
|
||||||
|
// significant when evaluating the outcomes
|
||||||
|
private ExpressionNode opNext;
|
||||||
|
private SourceLocation start;
|
||||||
|
private SourceLocation end;
|
||||||
|
private SourceLocation opStart;
|
||||||
|
private SourceLocation opEnd;
|
||||||
|
private TypeDetails types;
|
||||||
|
private TypeDetails opTypes;
|
||||||
|
|
||||||
|
public ExpressionNode(int uniqueId) {
|
||||||
|
super();
|
||||||
|
this.uniqueId = Integer.toString(uniqueId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
if (function == Function.Item)
|
||||||
|
b.append("[");
|
||||||
|
else {
|
||||||
|
b.append(name);
|
||||||
|
b.append("(");
|
||||||
|
}
|
||||||
|
boolean first = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
b.append(n.toString());
|
||||||
|
}
|
||||||
|
if (function == Function.Item) {
|
||||||
|
b.append("]");
|
||||||
|
} else {
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
if (constant == null) {
|
||||||
|
b.append("{}");
|
||||||
|
} else if (constant instanceof StringType) {
|
||||||
|
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
|
||||||
|
} else if (constant instanceof Quantity) {
|
||||||
|
Quantity q = (Quantity) constant;
|
||||||
|
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
||||||
|
b.append(" '");
|
||||||
|
b.append(Utilities.escapeJson(q.getUnit()));
|
||||||
|
b.append("'");
|
||||||
|
} else if (constant.primitiveValue() != null) {
|
||||||
|
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
||||||
|
} else {
|
||||||
|
b.append(Utilities.escapeJson(constant.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append("(");
|
||||||
|
b.append(group.toString());
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
if (!((ExpressionNode.Kind.Function == inner.getKind())
|
||||||
|
&& (ExpressionNode.Function.Item == inner.getFunction()))) {
|
||||||
|
b.append(".");
|
||||||
|
}
|
||||||
|
b.append(inner.toString());
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(" ");
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(" ");
|
||||||
|
b.append(opNext.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base getConstant() {
|
||||||
|
return constant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConstant(Base constant) {
|
||||||
|
this.constant = constant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Function getFunction() {
|
||||||
|
return function;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFunction(Function function) {
|
||||||
|
this.function = function;
|
||||||
|
if (parameters == null)
|
||||||
|
parameters = new ArrayList<ExpressionNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isProximal() {
|
||||||
|
return proximal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProximal(boolean proximal) {
|
||||||
|
this.proximal = proximal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Operation getOperation() {
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperation(Operation operation) {
|
||||||
|
this.operation = operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getInner() {
|
||||||
|
return inner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInner(ExpressionNode value) {
|
||||||
|
this.inner = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getOpNext() {
|
||||||
|
return opNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpNext(ExpressionNode value) {
|
||||||
|
this.opNext = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ExpressionNode> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkName() {
|
||||||
|
if (!name.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return Utilities.existsInList(name, "$this", "$total", "$index");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kind getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKind(Kind kind) {
|
||||||
|
this.kind = kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroup(ExpressionNode group) {
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(SourceLocation start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(SourceLocation end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpStart() {
|
||||||
|
return opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpStart(SourceLocation opStart) {
|
||||||
|
this.opStart = opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpEnd() {
|
||||||
|
return opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpEnd(SourceLocation opEnd) {
|
||||||
|
this.opEnd = opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int parameterCount() {
|
||||||
|
if (parameters == null)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return parameters.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Canonical() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
write(b);
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String summary() {
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
return uniqueId + ": " + name;
|
||||||
|
case Function:
|
||||||
|
return uniqueId + ": " + function.toString() + "()";
|
||||||
|
case Constant:
|
||||||
|
return uniqueId + ": " + constant;
|
||||||
|
case Group:
|
||||||
|
return uniqueId + ": (Group)";
|
||||||
|
}
|
||||||
|
return "?exp-kind?";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(StringBuilder b) {
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
b.append(constant);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
b.append(function.toCode());
|
||||||
|
b.append('(');
|
||||||
|
boolean f = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (f)
|
||||||
|
f = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
n.write(b);
|
||||||
|
}
|
||||||
|
b.append(')');
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append('(');
|
||||||
|
group.write(b);
|
||||||
|
b.append(')');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inner != null) {
|
||||||
|
b.append('.');
|
||||||
|
inner.write(b);
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(' ');
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(' ');
|
||||||
|
opNext.write(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String check() {
|
||||||
|
|
||||||
|
if (kind == null) {
|
||||||
|
return "Error in expression - node has no kind";
|
||||||
|
}
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return "No Name provided @ " + location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Function:
|
||||||
|
if (function == null)
|
||||||
|
return "No Function id provided @ " + location();
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
String msg = n.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Unary:
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
if (constant == null)
|
||||||
|
return "No Constant provided @ " + location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Group:
|
||||||
|
if (group == null)
|
||||||
|
return "No Group provided @ " + location();
|
||||||
|
else {
|
||||||
|
String msg = group.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
String msg = inner.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (operation == null) {
|
||||||
|
|
||||||
|
if (opNext != null)
|
||||||
|
return "Next provided when it shouldn't be @ " + location();
|
||||||
|
} else {
|
||||||
|
if (opNext == null)
|
||||||
|
return "No Next provided @ " + location();
|
||||||
|
else
|
||||||
|
opNext.check();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String location() {
|
||||||
|
return Integer.toString(start.getLine()) + ", " + Integer.toString(start.getColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypes(TypeDetails types) {
|
||||||
|
this.types = types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getOpTypes() {
|
||||||
|
return opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpTypes(TypeDetails opTypes) {
|
||||||
|
this.opTypes = opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,570 @@
|
||||||
|
package org.hl7.fhir.r4b.fhirpath;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
// shared lexer for concrete syntaxes
|
||||||
|
// - FluentPath
|
||||||
|
// - Mapping language
|
||||||
|
|
||||||
|
public class FHIRLexer {
|
||||||
|
public class FHIRLexerException extends FHIRException {
|
||||||
|
|
||||||
|
private SourceLocation location;
|
||||||
|
|
||||||
|
// public FHIRLexerException() {
|
||||||
|
// super();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public FHIRLexerException(String message, Throwable cause) {
|
||||||
|
// super(message, cause);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public FHIRLexerException(String message) {
|
||||||
|
// super(message);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public FHIRLexerException(Throwable cause) {
|
||||||
|
// super(cause);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public FHIRLexerException(String message, SourceLocation location) {
|
||||||
|
super(message);
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private String source;
|
||||||
|
private int cursor;
|
||||||
|
private int currentStart;
|
||||||
|
private String current;
|
||||||
|
private List<String> comments = new ArrayList<>();
|
||||||
|
private SourceLocation currentLocation;
|
||||||
|
private SourceLocation currentStartLocation;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private boolean liquidMode; // in liquid mode, || terminates the expression and hands the parser back to the host
|
||||||
|
private SourceLocation commentLocation;
|
||||||
|
private boolean metadataFormat;
|
||||||
|
private boolean allowDoubleQuotes;
|
||||||
|
|
||||||
|
public FHIRLexer(String source, String name) throws FHIRLexerException {
|
||||||
|
this.source = source == null ? "" : source;
|
||||||
|
this.name = name == null ? "??" : name;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public FHIRLexer(String source, int i) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
this.cursor = i;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public FHIRLexer(String source, int i, boolean allowDoubleQuotes) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
this.cursor = i;
|
||||||
|
this.allowDoubleQuotes = allowDoubleQuotes;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public FHIRLexer(String source, String name, boolean metadataFormat, boolean allowDoubleQuotes) throws FHIRLexerException {
|
||||||
|
this.source = source == null ? "" : source;
|
||||||
|
this.name = name == null ? "??" : name;
|
||||||
|
this.metadataFormat = metadataFormat;
|
||||||
|
this.allowDoubleQuotes = allowDoubleQuotes;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public String getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
public SourceLocation getCurrentLocation() {
|
||||||
|
return currentLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConstant() {
|
||||||
|
return FHIRPathConstant.isFHIRPathConstant(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFixedName() {
|
||||||
|
return FHIRPathConstant.isFHIRPathFixedName(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStringConstant() {
|
||||||
|
return FHIRPathConstant.isFHIRPathStringConstant(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String take() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
next();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int takeInt() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
if (!Utilities.isInteger(s))
|
||||||
|
throw error("Found "+current+" expecting an integer");
|
||||||
|
next();
|
||||||
|
return Integer.parseInt(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToken() {
|
||||||
|
if (Utilities.noString(current))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (current.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (current.equals("*") || current.equals("**"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((current.charAt(0) >= 'A' && current.charAt(0) <= 'Z') || (current.charAt(0) >= 'a' && current.charAt(0) <= 'z')) {
|
||||||
|
for (int i = 1; i < current.length(); i++)
|
||||||
|
if (!( (current.charAt(1) >= 'A' && current.charAt(1) <= 'Z') || (current.charAt(1) >= 'a' && current.charAt(1) <= 'z') ||
|
||||||
|
(current.charAt(1) >= '0' && current.charAt(1) <= '9')))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg) {
|
||||||
|
return error(msg, currentLocation.toString(), currentLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg, String location, SourceLocation loc) {
|
||||||
|
return new FHIRLexerException("Error @"+location+": "+msg, loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void next() throws FHIRLexerException {
|
||||||
|
skipWhitespaceAndComments();
|
||||||
|
current = null;
|
||||||
|
currentStart = cursor;
|
||||||
|
currentStartLocation = currentLocation;
|
||||||
|
if (cursor < source.length()) {
|
||||||
|
char ch = source.charAt(cursor);
|
||||||
|
if (ch == '!' || ch == '>' || ch == '<' || ch == ':' || ch == '-' || ch == '=') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '=' || source.charAt(cursor) == '~' || source.charAt(cursor) == '-') || (ch == '-' && source.charAt(cursor) == '>'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '.' ) {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '.'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch >= '0' && ch <= '9') {
|
||||||
|
cursor++;
|
||||||
|
boolean dotted = false;
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || (source.charAt(cursor) == '.') && !dotted)) {
|
||||||
|
if (source.charAt(cursor) == '.')
|
||||||
|
dotted = true;
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (source.charAt(cursor-1) == '.')
|
||||||
|
cursor--;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z') || (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z') ||
|
||||||
|
(source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == '_'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '%') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '`')) {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) != '`'))
|
||||||
|
cursor++;
|
||||||
|
cursor++;
|
||||||
|
} else
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z') || (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z') ||
|
||||||
|
(source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == ':' || source.charAt(cursor) == '-'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '/') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '/')) {
|
||||||
|
// we've run into metadata
|
||||||
|
cursor++;
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else {
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
}
|
||||||
|
} else if (ch == '$') {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '{') {
|
||||||
|
cursor++;
|
||||||
|
ch = source.charAt(cursor);
|
||||||
|
if (ch == '}')
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '"' && allowDoubleQuotes) {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '"')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "\""+source.substring(currentStart+1, cursor-1)+"\"";
|
||||||
|
} else if (ch == '`') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '`')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "`"+source.substring(currentStart+1, cursor-1)+"`";
|
||||||
|
} else if (ch == '\''){
|
||||||
|
cursor++;
|
||||||
|
char ech = ch;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != ech)) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
if (ech == '\'')
|
||||||
|
current = "\'"+current.substring(1, current.length() - 1)+"\'";
|
||||||
|
} else if (ch == '`') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '`')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "`"+source.substring(currentStart+1, cursor-1)+"`";
|
||||||
|
} else if (ch == '|' && liquidMode) {
|
||||||
|
cursor++;
|
||||||
|
ch = source.charAt(cursor);
|
||||||
|
if (ch == '|')
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '@'){
|
||||||
|
int start = cursor;
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && isDateChar(source.charAt(cursor), start))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else { // if CharInSet(ch, ['.', ',', '(', ')', '=', '$']) then
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void skipWhitespaceAndComments() {
|
||||||
|
comments.clear();
|
||||||
|
commentLocation = null;
|
||||||
|
boolean last13 = false;
|
||||||
|
boolean done = false;
|
||||||
|
while (cursor < source.length() && !done) {
|
||||||
|
if (cursor < source.length() -1 && "//".equals(source.substring(cursor, cursor+2)) && !isMetadataStart()) {
|
||||||
|
if (commentLocation == null) {
|
||||||
|
commentLocation = currentLocation.copy();
|
||||||
|
}
|
||||||
|
int start = cursor+2;
|
||||||
|
while (cursor < source.length() && !((source.charAt(cursor) == '\r') || source.charAt(cursor) == '\n')) {
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
comments.add(source.substring(start, cursor).trim());
|
||||||
|
} else if (cursor < source.length() - 1 && "/*".equals(source.substring(cursor, cursor+2))) {
|
||||||
|
if (commentLocation == null) {
|
||||||
|
commentLocation = currentLocation.copy();
|
||||||
|
}
|
||||||
|
int start = cursor+2;
|
||||||
|
while (cursor < source.length() - 1 && !"*/".equals(source.substring(cursor, cursor+2))) {
|
||||||
|
last13 = currentLocation.checkChar(source.charAt(cursor), last13);
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor >= source.length() -1) {
|
||||||
|
error("Unfinished comment");
|
||||||
|
} else {
|
||||||
|
comments.add(source.substring(start, cursor).trim());
|
||||||
|
cursor = cursor + 2;
|
||||||
|
}
|
||||||
|
} else if (Utilities.isWhitespace(source.charAt(cursor))) {
|
||||||
|
last13 = currentLocation.checkChar(source.charAt(cursor), last13);
|
||||||
|
cursor++;
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMetadataStart() {
|
||||||
|
return metadataFormat && cursor < source.length() - 2 && "///".equals(source.substring(cursor, cursor+3));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDateChar(char ch,int start) {
|
||||||
|
int eot = source.charAt(start+1) == 'T' ? 10 : 20;
|
||||||
|
|
||||||
|
return ch == '-' || ch == ':' || ch == 'T' || ch == '+' || ch == 'Z' || Character.isDigit(ch) || (cursor-start == eot && ch == '.' && cursor < source.length()-1&& Character.isDigit(source.charAt(cursor+1)));
|
||||||
|
}
|
||||||
|
public boolean isOp() {
|
||||||
|
return ExpressionNode.Operation.fromCode(current) != null;
|
||||||
|
}
|
||||||
|
public boolean done() {
|
||||||
|
return currentStart >= source.length();
|
||||||
|
}
|
||||||
|
public int nextId() {
|
||||||
|
id++;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public SourceLocation getCurrentStartLocation() {
|
||||||
|
return currentStartLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special case use
|
||||||
|
public void setCurrent(String current) {
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasComments() {
|
||||||
|
return comments.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getComments() {
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAllComments() {
|
||||||
|
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder("\r\n");
|
||||||
|
b.addAll(comments);
|
||||||
|
comments.clear();
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstComment() {
|
||||||
|
if (hasComments()) {
|
||||||
|
String s = comments.get(0);
|
||||||
|
comments.remove(0);
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasToken(String kw) {
|
||||||
|
return !done() && kw.equals(current);
|
||||||
|
}
|
||||||
|
public boolean hasToken(String... names) {
|
||||||
|
if (done())
|
||||||
|
return false;
|
||||||
|
for (String s : names)
|
||||||
|
if (s.equals(current))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void token(String kw) throws FHIRLexerException {
|
||||||
|
if (!kw.equals(current))
|
||||||
|
throw error("Found \""+current+"\" expecting \""+kw+"\"");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readConstant(String desc) throws FHIRLexerException {
|
||||||
|
if (!isStringConstant())
|
||||||
|
throw error("Found "+current+" expecting \"["+desc+"]\"");
|
||||||
|
|
||||||
|
return processConstant(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readFixedName(String desc) throws FHIRLexerException {
|
||||||
|
if (!isFixedName())
|
||||||
|
throw error("Found "+current+" expecting \"["+desc+"]\"");
|
||||||
|
|
||||||
|
return processFixedName(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processConstant(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length()-1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
b.append('"');
|
||||||
|
break;
|
||||||
|
case '`':
|
||||||
|
b.append('`');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('/');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i+4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown character escape \\"+s.charAt(i), currentLocation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processFixedName(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length()-1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
b.append('"');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('/');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i+4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown character escape \\"+s.charAt(i), currentLocation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skipToken(String token) throws FHIRLexerException {
|
||||||
|
if (getCurrent().equals(token))
|
||||||
|
next();
|
||||||
|
|
||||||
|
}
|
||||||
|
public String takeDottedToken() throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append(take());
|
||||||
|
while (!done() && getCurrent().equals(".")) {
|
||||||
|
b.append(take());
|
||||||
|
b.append(take());
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentStart() {
|
||||||
|
return currentStart;
|
||||||
|
}
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public boolean isLiquidMode() {
|
||||||
|
return liquidMode;
|
||||||
|
}
|
||||||
|
public void setLiquidMode(boolean liquidMode) {
|
||||||
|
this.liquidMode = liquidMode;
|
||||||
|
}
|
||||||
|
public SourceLocation getCommentLocation() {
|
||||||
|
return this.commentLocation;
|
||||||
|
}
|
||||||
|
public boolean isMetadataFormat() {
|
||||||
|
return metadataFormat;
|
||||||
|
}
|
||||||
|
public void setMetadataFormat(boolean metadataFormat) {
|
||||||
|
this.metadataFormat = metadataFormat;
|
||||||
|
}
|
||||||
|
public List<String> cloneComments() {
|
||||||
|
List<String> res = new ArrayList<>();
|
||||||
|
res.addAll(getComments());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public String tokenWithTrailingComment(String token) {
|
||||||
|
int line = getCurrentLocation().getLine();
|
||||||
|
token(token);
|
||||||
|
if (getComments().size() > 0 && getCommentLocation().getLine() == line) {
|
||||||
|
return getFirstComment();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isAllowDoubleQuotes() {
|
||||||
|
return allowDoubleQuotes;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.hl7.fhir.r4b.fhirpath;
|
||||||
|
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class FHIRPathConstant {
|
||||||
|
|
||||||
|
public static boolean isFHIRPathConstant(String string) {
|
||||||
|
return !Utilities.noString(string) && ((string.charAt(0) == '\'' || string.charAt(0) == '"') || string.charAt(0) == '@' || string.charAt(0) == '%' ||
|
||||||
|
string.charAt(0) == '-' || string.charAt(0) == '+' || (string.charAt(0) >= '0' && string.charAt(0) <= '9') ||
|
||||||
|
string.equals("true") || string.equals("false") || string.equals("{}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFHIRPathFixedName(String string) {
|
||||||
|
return string != null && (string.charAt(0) == '`');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFHIRPathStringConstant(String string) {
|
||||||
|
return string.charAt(0) == '\'' || string.charAt(0) == '"' || string.charAt(0) == '`';
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,198 @@
|
||||||
|
package org.hl7.fhir.r4b.fhirpath;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
|
import org.hl7.fhir.r4b.model.Element;
|
||||||
|
import org.hl7.fhir.r4b.model.ElementDefinition;
|
||||||
|
import org.hl7.fhir.r4b.model.Property;
|
||||||
|
import org.hl7.fhir.r4b.model.Resource;
|
||||||
|
import org.hl7.fhir.r4b.model.StringType;
|
||||||
|
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class FHIRPathUtilityClasses {
|
||||||
|
|
||||||
|
public static class FHIRConstant extends Base {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8933773658248269439L;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public FHIRConstant(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fhirType() {
|
||||||
|
return "%constant";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void listChildren(List<Property> result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdBase() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdBase(String value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String primitiveValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Base copy() {
|
||||||
|
throw new Error("Not Implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ClassTypeInfo extends Base {
|
||||||
|
private static final long serialVersionUID = 4909223114071029317L;
|
||||||
|
private Base instance;
|
||||||
|
|
||||||
|
public ClassTypeInfo(Base instance) {
|
||||||
|
super();
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fhirType() {
|
||||||
|
return "ClassInfo";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void listChildren(List<Property> result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdBase() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdBase(String value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||||
|
if (name.equals("name")) {
|
||||||
|
return new Base[] { new StringType(getName()) };
|
||||||
|
} else if (name.equals("namespace")) {
|
||||||
|
return new Base[] { new StringType(getNamespace()) };
|
||||||
|
} else {
|
||||||
|
return super.getProperty(hash, name, checkValid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getNamespace() {
|
||||||
|
if ((instance instanceof Resource)) {
|
||||||
|
return "FHIR";
|
||||||
|
} else if (!(instance instanceof Element) || ((Element) instance).isDisallowExtensions()) {
|
||||||
|
return "System";
|
||||||
|
} else {
|
||||||
|
return "FHIR";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getName() {
|
||||||
|
if ((instance instanceof Resource)) {
|
||||||
|
return instance.fhirType();
|
||||||
|
} else if (!(instance instanceof Element) || ((Element) instance).isDisallowExtensions()) {
|
||||||
|
return Utilities.capitalize(instance.fhirType());
|
||||||
|
} else {
|
||||||
|
return instance.fhirType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Base copy() {
|
||||||
|
throw new Error("Not Implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TypedElementDefinition {
|
||||||
|
private ElementDefinition element;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public TypedElementDefinition(ElementDefinition element, String type) {
|
||||||
|
super();
|
||||||
|
this.element = element;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypedElementDefinition(ElementDefinition element) {
|
||||||
|
super();
|
||||||
|
this.element = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinition getElement() {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TypeRefComponent> getTypes() {
|
||||||
|
List<TypeRefComponent> res = new ArrayList<ElementDefinition.TypeRefComponent>();
|
||||||
|
for (TypeRefComponent tr : element.getType()) {
|
||||||
|
if (type == null || type.equals(tr.getCode())) {
|
||||||
|
res.add(tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(String tn) {
|
||||||
|
if (type != null) {
|
||||||
|
return tn.equals(type);
|
||||||
|
} else {
|
||||||
|
for (TypeRefComponent t : element.getType()) {
|
||||||
|
if (tn.equals(t.getCode())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FunctionDetails {
|
||||||
|
private String description;
|
||||||
|
private int minParameters;
|
||||||
|
private int maxParameters;
|
||||||
|
|
||||||
|
public FunctionDetails(String description, int minParameters, int maxParameters) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.minParameters = minParameters;
|
||||||
|
this.maxParameters = maxParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinParameters() {
|
||||||
|
return minParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxParameters() {
|
||||||
|
return maxParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,386 @@
|
||||||
|
package org.hl7.fhir.r4b.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4b.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
|
import org.hl7.fhir.r4b.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r4b.model.UriType;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class TypeDetails {
|
||||||
|
public static final String FHIR_NS = "http://hl7.org/fhir/StructureDefinition/";
|
||||||
|
public static final String FP_NS = "http://hl7.org/fhirpath/";
|
||||||
|
public static final String FP_String = "http://hl7.org/fhirpath/String";
|
||||||
|
public static final String FP_Boolean = "http://hl7.org/fhirpath/Boolean";
|
||||||
|
public static final String FP_Integer = "http://hl7.org/fhirpath/Integer";
|
||||||
|
public static final String FP_Decimal = "http://hl7.org/fhirpath/Decimal";
|
||||||
|
public static final String FP_Quantity = "http://hl7.org/fhirpath/Quantity";
|
||||||
|
public static final String FP_DateTime = "http://hl7.org/fhirpath/DateTime";
|
||||||
|
public static final String FP_Time = "http://hl7.org/fhirpath/Time";
|
||||||
|
public static final String FP_SimpleTypeInfo = "http://hl7.org/fhirpath/SimpleTypeInfo";
|
||||||
|
public static final String FP_ClassInfo = "http://hl7.org/fhirpath/ClassInfo";
|
||||||
|
public static final Set<String> FP_NUMBERS = new HashSet<String>(Arrays.asList(FP_Integer, FP_Decimal));
|
||||||
|
|
||||||
|
public static class ProfiledType {
|
||||||
|
private String uri;
|
||||||
|
private List<String> profiles; // or, not and
|
||||||
|
private List<ElementDefinitionBindingComponent> bindings;
|
||||||
|
|
||||||
|
public ProfiledType(String n) {
|
||||||
|
uri = ns(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProfiles() {
|
||||||
|
return profiles != null && profiles.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getProfiles() {
|
||||||
|
return profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBindings() {
|
||||||
|
return bindings != null && bindings.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ElementDefinitionBindingComponent> getBindings() {
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String ns(String n) {
|
||||||
|
return Utilities.isAbsoluteUrl(n) ? n : FHIR_NS + n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfile(String profile) {
|
||||||
|
if (profiles == null)
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
profiles.add(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBinding(ElementDefinitionBindingComponent binding) {
|
||||||
|
bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
bindings.add(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBinding(ElementDefinitionBindingComponent b) {
|
||||||
|
return false; // todo: do we need to do this?
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfiles(List<CanonicalType> list) {
|
||||||
|
if (profiles == null)
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
for (UriType u : list)
|
||||||
|
profiles.add(u.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSystemType() {
|
||||||
|
return uri.startsWith(FP_NS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProfiledType> types = new ArrayList<ProfiledType>();
|
||||||
|
private CollectionStatus collectionStatus;
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, String... names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
this.types.add(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, Set<String> names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, ProfiledType pt) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
this.types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addType(String n) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addType(String n, String p) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
pt.addProfile(p);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addType(ProfiledType pt) {
|
||||||
|
for (ProfiledType et : types) {
|
||||||
|
if (et.uri.equals(pt.uri)) {
|
||||||
|
if (pt.profiles != null) {
|
||||||
|
for (String p : pt.profiles) {
|
||||||
|
if (et.profiles == null)
|
||||||
|
et.profiles = new ArrayList<String>();
|
||||||
|
if (!et.profiles.contains(p))
|
||||||
|
et.profiles.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pt.bindings != null) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.bindings) {
|
||||||
|
if (et.bindings == null)
|
||||||
|
et.bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
if (!et.hasBinding(b))
|
||||||
|
et.bindings.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTypes(Collection<String> names) {
|
||||||
|
for (String n : names)
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(IWorkerContext context, String... tn) {
|
||||||
|
for (String n : tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time",
|
||||||
|
"ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS + Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String n : tn) {
|
||||||
|
String id = n.contains("#") ? n.substring(0, n.indexOf("#")) : n;
|
||||||
|
String tail = null;
|
||||||
|
if (n.contains("#")) {
|
||||||
|
tail = n.substring(n.indexOf("#") + 1);
|
||||||
|
tail = tail.substring(tail.indexOf("."));
|
||||||
|
}
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
StructureDefinition sd = context.fetchResource(StructureDefinition.class, t);
|
||||||
|
while (sd != null) {
|
||||||
|
if (tail == null && typesContains(sd.getUrl()))
|
||||||
|
return true;
|
||||||
|
if (tail == null && getSystemType(sd.getUrl()) != null && typesContains(getSystemType(sd.getUrl())))
|
||||||
|
return true;
|
||||||
|
if (tail != null && typesContains(sd.getUrl() + "#" + sd.getType() + tail))
|
||||||
|
return true;
|
||||||
|
if (sd.hasBaseDefinition()) {
|
||||||
|
if (sd.getType().equals("uri"))
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/string");
|
||||||
|
else
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
||||||
|
} else
|
||||||
|
sd = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSystemType(String url) {
|
||||||
|
if (url.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
||||||
|
String code = url.substring(40);
|
||||||
|
if (Utilities.existsInList(code, "string", "boolean", "integer", "decimal", "dateTime", "time", "Quantity"))
|
||||||
|
return FP_NS + Utilities.capitalize(code);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean typesContains(String t) {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.equals(t))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(TypeDetails source) {
|
||||||
|
for (ProfiledType pt : source.types)
|
||||||
|
addType(pt);
|
||||||
|
if (collectionStatus == null)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else if (source.collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else
|
||||||
|
collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails union(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
result.addType(pt);
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails intersect(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
boolean found = false;
|
||||||
|
for (ProfiledType r : right.types)
|
||||||
|
found = found || pt.uri.equals(r.uri);
|
||||||
|
if (found)
|
||||||
|
result.addType(pt);
|
||||||
|
}
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNoTypes() {
|
||||||
|
return types.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getTypes() {
|
||||||
|
Set<String> res = new HashSet<String>();
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
res.add(pt.uri);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails toSingleton() {
|
||||||
|
TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
|
||||||
|
result.types.addAll(types);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CollectionStatus getCollectionStatus() {
|
||||||
|
return collectionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(String n) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "date", "dateTime", "time",
|
||||||
|
"ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS + Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(Set<String> tn) {
|
||||||
|
for (String n : tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time",
|
||||||
|
"ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS + Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String describe() {
|
||||||
|
return getTypes().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return (collectionStatus == null ? collectionStatus.SINGLETON.toString() : collectionStatus.toString())
|
||||||
|
+ getTypes().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeCode() throws DefinitionException {
|
||||||
|
if (types.size() != 1)
|
||||||
|
throw new DefinitionException("Multiple types? (" + types.toString() + ")");
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.startsWith("http://hl7.org/fhir/StructureDefinition/"))
|
||||||
|
return pt.uri.substring(40);
|
||||||
|
else
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProfiledType> getProfiledTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
if (pt.hasBindings())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinitionBindingComponent getBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.getBindings())
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,7 +31,8 @@ package org.hl7.fhir.r4b.model;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the base class for Profile classes - whether generated or
|
* This class is the base class for Profile classes - whether generated or
|
||||||
|
|
|
@ -15,12 +15,12 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.DomainResource;
|
import org.hl7.fhir.r4b.model.DomainResource;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r4b.renderers.utils.Resolver.IReferenceResolver;
|
import org.hl7.fhir.r4b.renderers.utils.Resolver.IReferenceResolver;
|
||||||
import org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceContext;
|
import org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceContext;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
||||||
|
|
|
@ -10,10 +10,11 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.Bundle;
|
import org.hl7.fhir.r4b.model.Bundle;
|
||||||
import org.hl7.fhir.r4b.model.Expression;
|
import org.hl7.fhir.r4b.model.Expression;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4b.model.Bundle.BundleEntryComponent;
|
import org.hl7.fhir.r4b.model.Bundle.BundleEntryComponent;
|
||||||
import org.hl7.fhir.r4b.model.GraphDefinition;
|
import org.hl7.fhir.r4b.model.GraphDefinition;
|
||||||
import org.hl7.fhir.r4b.model.GraphDefinition.GraphDefinitionLinkComponent;
|
import org.hl7.fhir.r4b.model.GraphDefinition.GraphDefinitionLinkComponent;
|
||||||
|
|
|
@ -39,6 +39,8 @@ import java.util.Map;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4b.model.BackboneElement;
|
import org.hl7.fhir.r4b.model.BackboneElement;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.Bundle;
|
import org.hl7.fhir.r4b.model.Bundle;
|
||||||
|
@ -47,7 +49,6 @@ import org.hl7.fhir.r4b.model.Bundle.BundleLinkComponent;
|
||||||
import org.hl7.fhir.r4b.model.CanonicalType;
|
import org.hl7.fhir.r4b.model.CanonicalType;
|
||||||
import org.hl7.fhir.r4b.model.DomainResource;
|
import org.hl7.fhir.r4b.model.DomainResource;
|
||||||
import org.hl7.fhir.r4b.model.Element;
|
import org.hl7.fhir.r4b.model.Element;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4b.model.IntegerType;
|
import org.hl7.fhir.r4b.model.IntegerType;
|
||||||
import org.hl7.fhir.r4b.model.Property;
|
import org.hl7.fhir.r4b.model.Property;
|
||||||
import org.hl7.fhir.r4b.model.Reference;
|
import org.hl7.fhir.r4b.model.Reference;
|
||||||
|
|
|
@ -41,15 +41,17 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.ExpressionNodeWithOffset;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r4b.model.Resource;
|
import org.hl7.fhir.r4b.model.Resource;
|
||||||
import org.hl7.fhir.r4b.model.Tuple;
|
import org.hl7.fhir.r4b.model.Tuple;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4b.model.ValueSet;
|
import org.hl7.fhir.r4b.model.ValueSet;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.ExpressionNodeWithOffset;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||||
|
|
|
@ -4,12 +4,12 @@ import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Element;
|
import org.hl7.fhir.r4b.elementmodel.Element;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.Resource;
|
import org.hl7.fhir.r4b.model.Resource;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4b.model.ValueSet;
|
import org.hl7.fhir.r4b.model.ValueSet;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.hl7.fhir.r4b.utils.structuremap;
|
package org.hl7.fhir.r4b.utils.structuremap;
|
||||||
|
|
||||||
import org.hl7.fhir.r4b.elementmodel.Property;
|
import org.hl7.fhir.r4b.elementmodel.Property;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
|
||||||
public class PropertyWithType {
|
public class PropertyWithType {
|
||||||
private String path;
|
private String path;
|
||||||
|
|
|
@ -44,6 +44,15 @@ import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext.ValidationResult;
|
import org.hl7.fhir.r4b.context.IWorkerContext.ValidationResult;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Element;
|
import org.hl7.fhir.r4b.elementmodel.Element;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Property;
|
import org.hl7.fhir.r4b.elementmodel.Property;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRLexer.FHIRLexerException;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails.ProfiledType;
|
||||||
import org.hl7.fhir.r4b.model.*;
|
import org.hl7.fhir.r4b.model.*;
|
||||||
import org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence;
|
import org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence;
|
||||||
import org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent;
|
import org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent;
|
||||||
|
@ -55,20 +64,13 @@ import org.hl7.fhir.r4b.model.Enumeration;
|
||||||
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r4b.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r4b.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r4b.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r4b.model.Narrative.NarrativeStatus;
|
import org.hl7.fhir.r4b.model.Narrative.NarrativeStatus;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionMappingComponent;
|
import org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionMappingComponent;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r4b.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r4b.model.StructureMap.*;
|
import org.hl7.fhir.r4b.model.StructureMap.*;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails.ProfiledType;
|
|
||||||
import org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r4b.renderers.TerminologyRenderer;
|
import org.hl7.fhir.r4b.renderers.TerminologyRenderer;
|
||||||
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRLexer;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRLexer.FHIRLexerException;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.hl7.fhir.r4b.utils.structuremap;
|
package org.hl7.fhir.r4b.utils.structuremap;
|
||||||
|
|
||||||
import org.hl7.fhir.r4b.elementmodel.Property;
|
import org.hl7.fhir.r4b.elementmodel.Property;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -11,14 +11,16 @@ import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.fhir.ucum.UcumException;
|
import org.fhir.ucum.UcumException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4b.formats.JsonParser;
|
import org.hl7.fhir.r4b.formats.JsonParser;
|
||||||
import org.hl7.fhir.r4b.formats.XmlParser;
|
import org.hl7.fhir.r4b.formats.XmlParser;
|
||||||
import org.hl7.fhir.r4b.model.*;
|
import org.hl7.fhir.r4b.model.*;
|
||||||
import org.hl7.fhir.r4b.test.FHIRPathTests.TestResultType;
|
import org.hl7.fhir.r4b.test.FHIRPathTests.TestResultType;
|
||||||
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
|
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
|
@ -20,13 +20,17 @@ import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
||||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
import org.hl7.fhir.r4b.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
||||||
import org.hl7.fhir.r4b.context.IWorkerContext.IContextResourceLoader;
|
import org.hl7.fhir.r4b.context.IWorkerContext.IContextResourceLoader;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4b.formats.JsonParser;
|
import org.hl7.fhir.r4b.formats.JsonParser;
|
||||||
import org.hl7.fhir.r4b.formats.XmlParser;
|
import org.hl7.fhir.r4b.formats.XmlParser;
|
||||||
import org.hl7.fhir.r4b.model.Base;
|
import org.hl7.fhir.r4b.model.Base;
|
||||||
import org.hl7.fhir.r4b.model.Bundle;
|
import org.hl7.fhir.r4b.model.Bundle;
|
||||||
import org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r4b.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r4b.model.Resource;
|
import org.hl7.fhir.r4b.model.Resource;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition;
|
import org.hl7.fhir.r4b.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionKind;
|
||||||
|
@ -34,12 +38,8 @@ import org.hl7.fhir.r4b.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r4b.renderers.RendererFactory;
|
import org.hl7.fhir.r4b.renderers.RendererFactory;
|
||||||
import org.hl7.fhir.r4b.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r4b.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r4b.renderers.utils.RenderingContext.ResourceRendererMode;
|
import org.hl7.fhir.r4b.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||||
import org.hl7.fhir.r4b.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r4b.model.ValueSet;
|
import org.hl7.fhir.r4b.model.ValueSet;
|
||||||
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
|
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.r4b.utils.XVerExtensionManager;
|
import org.hl7.fhir.r4b.utils.XVerExtensionManager;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
|
@ -7,10 +7,10 @@ import org.hl7.fhir.r4b.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Element;
|
import org.hl7.fhir.r4b.elementmodel.Element;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Manager;
|
import org.hl7.fhir.r4b.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r4b.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r4b.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r4b.model.StructureDefinition;
|
import org.hl7.fhir.r4b.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
|
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r4b.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||||
import org.hl7.fhir.utilities.npm.ToolsVersion;
|
import org.hl7.fhir.utilities.npm.ToolsVersion;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
|
@ -6,6 +6,8 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r4b.fhirpath.FHIRLexer;
|
||||||
|
|
||||||
class FHIRLexerTest {
|
class FHIRLexerTest {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Test that a 'null' current value returns 'false' when FHIRLexer.isConstant() is called, and not NPE.")
|
@DisplayName("Test that a 'null' current value returns 'false' when FHIRLexer.isConstant() is called, and not NPE.")
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison;
|
import org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison;
|
||||||
import org.hl7.fhir.r5.comparison.CodeSystemComparer.CodeSystemComparison;
|
import org.hl7.fhir.r5.comparison.CodeSystemComparer.CodeSystemComparison;
|
||||||
import org.hl7.fhir.r5.comparison.ResourceComparer.PlaceHolderComparison;
|
import org.hl7.fhir.r5.comparison.ResourceComparer.PlaceHolderComparison;
|
||||||
|
@ -23,15 +22,16 @@ import org.hl7.fhir.r5.comparison.StructureDefinitionComparer.ProfileComparison;
|
||||||
import org.hl7.fhir.r5.comparison.ValueSetComparer.ValueSetComparison;
|
import org.hl7.fhir.r5.comparison.ValueSetComparer.ValueSetComparison;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r5.model.StringType;
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
import org.hl7.fhir.r5.model.Tuple;
|
import org.hl7.fhir.r5.model.Tuple;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r5.utils.LiquidEngine;
|
import org.hl7.fhir.r5.utils.LiquidEngine;
|
||||||
import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument;
|
import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument;
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
|
|
|
@ -40,9 +40,10 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.*;
|
import org.hl7.fhir.r5.model.*;
|
||||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.stringtemplate.v4.ST;
|
import org.stringtemplate.v4.ST;
|
||||||
|
|
||||||
public class ShExGenerator {
|
public class ShExGenerator {
|
||||||
|
|
|
@ -53,6 +53,10 @@ import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.ElementDefinitionCou
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
||||||
import org.hl7.fhir.r5.elementmodel.Property;
|
import org.hl7.fhir.r5.elementmodel.Property;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.Kind;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.Operation;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.BooleanType;
|
import org.hl7.fhir.r5.model.BooleanType;
|
||||||
import org.hl7.fhir.r5.model.CanonicalType;
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
@ -74,9 +78,6 @@ import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.BindingStrength;
|
import org.hl7.fhir.r5.model.Enumerations.BindingStrength;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.Kind;
|
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.Operation;
|
|
||||||
import org.hl7.fhir.r5.model.Extension;
|
import org.hl7.fhir.r5.model.Extension;
|
||||||
import org.hl7.fhir.r5.model.IdType;
|
import org.hl7.fhir.r5.model.IdType;
|
||||||
import org.hl7.fhir.r5.model.MarkdownType;
|
import org.hl7.fhir.r5.model.MarkdownType;
|
||||||
|
@ -97,7 +98,6 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r5.utils.TranslatingUtilities;
|
import org.hl7.fhir.r5.utils.TranslatingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||||
|
|
|
@ -14,17 +14,17 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
|
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRLexer.FHIRLexerException;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode;
|
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
|
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapTransform;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapTransform;
|
||||||
import org.hl7.fhir.r5.utils.FHIRLexer;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
||||||
import org.hl7.fhir.utilities.SourceLocation;
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
|
|
|
@ -54,6 +54,7 @@ import org.hl7.fhir.r5.context.ContextUtilities;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
|
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.formats.JsonCreator;
|
import org.hl7.fhir.r5.formats.JsonCreator;
|
||||||
import org.hl7.fhir.r5.formats.JsonCreatorCanonical;
|
import org.hl7.fhir.r5.formats.JsonCreatorCanonical;
|
||||||
|
@ -61,7 +62,6 @@ import org.hl7.fhir.r5.formats.JsonCreatorDirect;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.StringPair;
|
import org.hl7.fhir.utilities.StringPair;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.SourcedChildDefinitions;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.SourcedChildDefinitions;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.r5.formats.FormatUtilities;
|
import org.hl7.fhir.r5.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation;
|
import org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation;
|
||||||
|
@ -46,7 +47,6 @@ import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.Extension;
|
import org.hl7.fhir.r5.model.Extension;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r5.utils.TypesUtilities;
|
import org.hl7.fhir.r5.utils.TypesUtilities;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
|
|
@ -0,0 +1,742 @@
|
||||||
|
package org.hl7.fhir.r5.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.model.Base;
|
||||||
|
import org.hl7.fhir.r5.model.Quantity;
|
||||||
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class ExpressionNode {
|
||||||
|
|
||||||
|
public enum Kind {
|
||||||
|
Name, Function, Constant, Group, Unary
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Function {
|
||||||
|
Custom,
|
||||||
|
|
||||||
|
Empty, Not, Exists, SubsetOf, SupersetOf, IsDistinct, Distinct, Count, Where, Select, All, Repeat, Aggregate, Item /*implicit from name[]*/, As, Is, Single,
|
||||||
|
First, Last, Tail, Skip, Take, Union, Combine, Intersect, Exclude, Iif, Upper, Lower, ToChars, IndexOf, Substring, StartsWith, EndsWith, Matches, MatchesFull, ReplaceMatches, Contains, Replace, Length,
|
||||||
|
Children, Descendants, MemberOf, Trace, Check, Today, Now, Resolve, Extension, AllFalse, AnyFalse, AllTrue, AnyTrue,
|
||||||
|
HasValue, OfType, Type, ConvertsToBoolean, ConvertsToInteger, ConvertsToString, ConvertsToDecimal, ConvertsToQuantity, ConvertsToDateTime, ConvertsToDate, ConvertsToTime, ToBoolean, ToInteger, ToString, ToDecimal, ToQuantity, ToDateTime, ToTime, ConformsTo,
|
||||||
|
Round, Sqrt, Abs, Ceiling, Exp, Floor, Ln, Log, Power, Truncate,
|
||||||
|
|
||||||
|
// R3 functions
|
||||||
|
Encode, Decode, Escape, Unescape, Trim, Split, Join, LowBoundary, HighBoundary, Precision,
|
||||||
|
|
||||||
|
// Local extensions to FHIRPath
|
||||||
|
HtmlChecks1, HtmlChecks2, AliasAs, Alias, Comparable, hasTemplateIdOf;
|
||||||
|
|
||||||
|
public static Function fromCode(String name) {
|
||||||
|
if (name.equals("empty")) return Function.Empty;
|
||||||
|
if (name.equals("not")) return Function.Not;
|
||||||
|
if (name.equals("exists")) return Function.Exists;
|
||||||
|
if (name.equals("subsetOf")) return Function.SubsetOf;
|
||||||
|
if (name.equals("supersetOf")) return Function.SupersetOf;
|
||||||
|
if (name.equals("isDistinct")) return Function.IsDistinct;
|
||||||
|
if (name.equals("distinct")) return Function.Distinct;
|
||||||
|
if (name.equals("count")) return Function.Count;
|
||||||
|
if (name.equals("where")) return Function.Where;
|
||||||
|
if (name.equals("select")) return Function.Select;
|
||||||
|
if (name.equals("all")) return Function.All;
|
||||||
|
if (name.equals("repeat")) return Function.Repeat;
|
||||||
|
if (name.equals("aggregate")) return Function.Aggregate;
|
||||||
|
if (name.equals("item")) return Function.Item;
|
||||||
|
if (name.equals("as")) return Function.As;
|
||||||
|
if (name.equals("is")) return Function.Is;
|
||||||
|
if (name.equals("single")) return Function.Single;
|
||||||
|
if (name.equals("first")) return Function.First;
|
||||||
|
if (name.equals("last")) return Function.Last;
|
||||||
|
if (name.equals("tail")) return Function.Tail;
|
||||||
|
if (name.equals("skip")) return Function.Skip;
|
||||||
|
if (name.equals("take")) return Function.Take;
|
||||||
|
if (name.equals("union")) return Function.Union;
|
||||||
|
if (name.equals("combine")) return Function.Combine;
|
||||||
|
if (name.equals("intersect")) return Function.Intersect;
|
||||||
|
if (name.equals("exclude")) return Function.Exclude;
|
||||||
|
if (name.equals("iif")) return Function.Iif;
|
||||||
|
if (name.equals("lower")) return Function.Lower;
|
||||||
|
if (name.equals("upper")) return Function.Upper;
|
||||||
|
if (name.equals("toChars")) return Function.ToChars;
|
||||||
|
if (name.equals("indexOf")) return Function.IndexOf;
|
||||||
|
if (name.equals("substring")) return Function.Substring;
|
||||||
|
if (name.equals("startsWith")) return Function.StartsWith;
|
||||||
|
if (name.equals("endsWith")) return Function.EndsWith;
|
||||||
|
if (name.equals("matches")) return Function.Matches;
|
||||||
|
if (name.equals("matchesFull")) return Function.MatchesFull;
|
||||||
|
if (name.equals("replaceMatches")) return Function.ReplaceMatches;
|
||||||
|
if (name.equals("contains")) return Function.Contains;
|
||||||
|
if (name.equals("replace")) return Function.Replace;
|
||||||
|
if (name.equals("length")) return Function.Length;
|
||||||
|
if (name.equals("children")) return Function.Children;
|
||||||
|
if (name.equals("descendants")) return Function.Descendants;
|
||||||
|
if (name.equals("memberOf")) return Function.MemberOf;
|
||||||
|
if (name.equals("trace")) return Function.Trace;
|
||||||
|
if (name.equals("check")) return Function.Check;
|
||||||
|
if (name.equals("today")) return Function.Today;
|
||||||
|
if (name.equals("now")) return Function.Now;
|
||||||
|
if (name.equals("resolve")) return Function.Resolve;
|
||||||
|
if (name.equals("extension")) return Function.Extension;
|
||||||
|
if (name.equals("allFalse")) return Function.AllFalse;
|
||||||
|
if (name.equals("anyFalse")) return Function.AnyFalse;
|
||||||
|
if (name.equals("allTrue")) return Function.AllTrue;
|
||||||
|
if (name.equals("anyTrue")) return Function.AnyTrue;
|
||||||
|
if (name.equals("hasValue")) return Function.HasValue;
|
||||||
|
if (name.equals("alias")) return Function.Alias;
|
||||||
|
if (name.equals("aliasAs")) return Function.AliasAs;
|
||||||
|
if (name.equals("htmlChecks")) return Function.HtmlChecks1;
|
||||||
|
if (name.equals("htmlchecks")) return Function.HtmlChecks1; // support change of care from R3
|
||||||
|
if (name.equals("htmlChecks2")) return Function.HtmlChecks2;
|
||||||
|
if (name.equals("comparable")) return Function.Comparable;
|
||||||
|
if (name.equals("encode")) return Function.Encode;
|
||||||
|
if (name.equals("decode")) return Function.Decode;
|
||||||
|
if (name.equals("escape")) return Function.Escape;
|
||||||
|
if (name.equals("unescape")) return Function.Unescape;
|
||||||
|
if (name.equals("trim")) return Function.Trim;
|
||||||
|
if (name.equals("split")) return Function.Split;
|
||||||
|
if (name.equals("join")) return Function.Join;
|
||||||
|
if (name.equals("ofType")) return Function.OfType;
|
||||||
|
if (name.equals("type")) return Function.Type;
|
||||||
|
if (name.equals("toInteger")) return Function.ToInteger;
|
||||||
|
if (name.equals("toDecimal")) return Function.ToDecimal;
|
||||||
|
if (name.equals("toString")) return Function.ToString;
|
||||||
|
if (name.equals("toQuantity")) return Function.ToQuantity;
|
||||||
|
if (name.equals("toBoolean")) return Function.ToBoolean;
|
||||||
|
if (name.equals("toDateTime")) return Function.ToDateTime;
|
||||||
|
if (name.equals("toTime")) return Function.ToTime;
|
||||||
|
if (name.equals("convertsToInteger")) return Function.ConvertsToInteger;
|
||||||
|
if (name.equals("convertsToDecimal")) return Function.ConvertsToDecimal;
|
||||||
|
if (name.equals("convertsToString")) return Function.ConvertsToString;
|
||||||
|
if (name.equals("convertsToQuantity")) return Function.ConvertsToQuantity;
|
||||||
|
if (name.equals("convertsToBoolean")) return Function.ConvertsToBoolean;
|
||||||
|
if (name.equals("convertsToDateTime")) return Function.ConvertsToDateTime;
|
||||||
|
if (name.equals("convertsToDate")) return Function.ConvertsToDate;
|
||||||
|
if (name.equals("convertsToTime")) return Function.ConvertsToTime;
|
||||||
|
if (name.equals("conformsTo")) return Function.ConformsTo;
|
||||||
|
if (name.equals("round")) return Function.Round;
|
||||||
|
if (name.equals("sqrt")) return Function.Sqrt;
|
||||||
|
if (name.equals("abs")) return Function.Abs;
|
||||||
|
if (name.equals("ceiling")) return Function.Ceiling;
|
||||||
|
if (name.equals("exp")) return Function.Exp;
|
||||||
|
if (name.equals("floor")) return Function.Floor;
|
||||||
|
if (name.equals("ln")) return Function.Ln;
|
||||||
|
if (name.equals("log")) return Function.Log;
|
||||||
|
if (name.equals("power")) return Function.Power;
|
||||||
|
if (name.equals("truncate")) return Function.Truncate;
|
||||||
|
if (name.equals("lowBoundary")) return Function.LowBoundary;
|
||||||
|
if (name.equals("highBoundary")) return Function.HighBoundary;
|
||||||
|
if (name.equals("precision")) return Function.Precision;
|
||||||
|
if (name.equals("hasTemplateIdOf")) return Function.hasTemplateIdOf;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Empty : return "empty";
|
||||||
|
case Not : return "not";
|
||||||
|
case Exists : return "exists";
|
||||||
|
case SubsetOf : return "subsetOf";
|
||||||
|
case SupersetOf : return "supersetOf";
|
||||||
|
case IsDistinct : return "isDistinct";
|
||||||
|
case Distinct : return "distinct";
|
||||||
|
case Count : return "count";
|
||||||
|
case Where : return "where";
|
||||||
|
case Select : return "select";
|
||||||
|
case All : return "all";
|
||||||
|
case Repeat : return "repeat";
|
||||||
|
case Aggregate : return "aggregate";
|
||||||
|
case Item : return "item";
|
||||||
|
case As : return "as";
|
||||||
|
case Is : return "is";
|
||||||
|
case Single : return "single";
|
||||||
|
case First : return "first";
|
||||||
|
case Last : return "last";
|
||||||
|
case Tail : return "tail";
|
||||||
|
case Skip : return "skip";
|
||||||
|
case Take : return "take";
|
||||||
|
case Union : return "union";
|
||||||
|
case Combine : return "combine";
|
||||||
|
case Intersect : return "intersect";
|
||||||
|
case Exclude : return "exclude";
|
||||||
|
case Iif : return "iif";
|
||||||
|
case ToChars : return "toChars";
|
||||||
|
case Lower : return "lower";
|
||||||
|
case Upper : return "upper";
|
||||||
|
case IndexOf : return "indexOf";
|
||||||
|
case Substring : return "substring";
|
||||||
|
case StartsWith : return "startsWith";
|
||||||
|
case EndsWith : return "endsWith";
|
||||||
|
case Matches : return "matches";
|
||||||
|
case MatchesFull : return "matchesFull";
|
||||||
|
case ReplaceMatches : return "replaceMatches";
|
||||||
|
case Contains : return "contains";
|
||||||
|
case Replace : return "replace";
|
||||||
|
case Length : return "length";
|
||||||
|
case Children : return "children";
|
||||||
|
case Descendants : return "descendants";
|
||||||
|
case MemberOf : return "memberOf";
|
||||||
|
case Trace : return "trace";
|
||||||
|
case Check : return "check";
|
||||||
|
case Today : return "today";
|
||||||
|
case Now : return "now";
|
||||||
|
case Resolve : return "resolve";
|
||||||
|
case Extension : return "extension";
|
||||||
|
case AllFalse : return "allFalse";
|
||||||
|
case AnyFalse : return "anyFalse";
|
||||||
|
case AllTrue : return "allTrue";
|
||||||
|
case AnyTrue : return "anyTrue";
|
||||||
|
case HasValue : return "hasValue";
|
||||||
|
case Alias : return "alias";
|
||||||
|
case AliasAs : return "aliasAs";
|
||||||
|
case Encode : return "encode";
|
||||||
|
case Decode : return "decode";
|
||||||
|
case Escape : return "escape";
|
||||||
|
case Unescape : return "unescape";
|
||||||
|
case Trim : return "trim";
|
||||||
|
case Split : return "split";
|
||||||
|
case Join : return "join";
|
||||||
|
case HtmlChecks1 : return "htmlChecks";
|
||||||
|
case HtmlChecks2 : return "htmlChecks2";
|
||||||
|
case Comparable : return "comparable";
|
||||||
|
case OfType : return "ofType";
|
||||||
|
case Type : return "type";
|
||||||
|
case ToInteger : return "toInteger";
|
||||||
|
case ToDecimal : return "toDecimal";
|
||||||
|
case ToString : return "toString";
|
||||||
|
case ToBoolean : return "toBoolean";
|
||||||
|
case ToQuantity : return "toQuantity";
|
||||||
|
case ToDateTime : return "toDateTime";
|
||||||
|
case ToTime : return "toTime";
|
||||||
|
case ConvertsToInteger : return "convertsToInteger";
|
||||||
|
case ConvertsToDecimal : return "convertsToDecimal";
|
||||||
|
case ConvertsToString : return "convertsToString";
|
||||||
|
case ConvertsToBoolean : return "convertsToBoolean";
|
||||||
|
case ConvertsToQuantity : return "convertsToQuantity";
|
||||||
|
case ConvertsToDateTime : return "convertsToDateTime";
|
||||||
|
case ConvertsToDate : return "convertsToDate";
|
||||||
|
case ConvertsToTime : return "isTime";
|
||||||
|
case ConformsTo : return "conformsTo";
|
||||||
|
case Round : return "round";
|
||||||
|
case Sqrt : return "sqrt";
|
||||||
|
case Abs : return "abs";
|
||||||
|
case Ceiling : return "ceiling";
|
||||||
|
case Exp : return "exp";
|
||||||
|
case Floor : return "floor";
|
||||||
|
case Ln : return "ln";
|
||||||
|
case Log : return "log";
|
||||||
|
case Power : return "power";
|
||||||
|
case Truncate: return "truncate";
|
||||||
|
case LowBoundary: return "lowBoundary";
|
||||||
|
case HighBoundary: return "highBoundary";
|
||||||
|
case Precision: return "precision";
|
||||||
|
case hasTemplateIdOf: return "hasTemplateIdOf";
|
||||||
|
default: return "?custom?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Operation {
|
||||||
|
Equals, Equivalent, NotEquals, NotEquivalent, LessThan, Greater, LessOrEqual, GreaterOrEqual, Is, As, Union, Or, And, Xor, Implies,
|
||||||
|
Times, DivideBy, Plus, Minus, Concatenate, Div, Mod, In, Contains, MemberOf;
|
||||||
|
|
||||||
|
public static Operation fromCode(String name) {
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return null;
|
||||||
|
if (name.equals("="))
|
||||||
|
return Operation.Equals;
|
||||||
|
if (name.equals("~"))
|
||||||
|
return Operation.Equivalent;
|
||||||
|
if (name.equals("!="))
|
||||||
|
return Operation.NotEquals;
|
||||||
|
if (name.equals("!~"))
|
||||||
|
return Operation.NotEquivalent;
|
||||||
|
if (name.equals(">"))
|
||||||
|
return Operation.Greater;
|
||||||
|
if (name.equals("<"))
|
||||||
|
return Operation.LessThan;
|
||||||
|
if (name.equals(">="))
|
||||||
|
return Operation.GreaterOrEqual;
|
||||||
|
if (name.equals("<="))
|
||||||
|
return Operation.LessOrEqual;
|
||||||
|
if (name.equals("|"))
|
||||||
|
return Operation.Union;
|
||||||
|
if (name.equals("or"))
|
||||||
|
return Operation.Or;
|
||||||
|
if (name.equals("and"))
|
||||||
|
return Operation.And;
|
||||||
|
if (name.equals("xor"))
|
||||||
|
return Operation.Xor;
|
||||||
|
if (name.equals("is"))
|
||||||
|
return Operation.Is;
|
||||||
|
if (name.equals("as"))
|
||||||
|
return Operation.As;
|
||||||
|
if (name.equals("*"))
|
||||||
|
return Operation.Times;
|
||||||
|
if (name.equals("/"))
|
||||||
|
return Operation.DivideBy;
|
||||||
|
if (name.equals("+"))
|
||||||
|
return Operation.Plus;
|
||||||
|
if (name.equals("-"))
|
||||||
|
return Operation.Minus;
|
||||||
|
if (name.equals("&"))
|
||||||
|
return Operation.Concatenate;
|
||||||
|
if (name.equals("implies"))
|
||||||
|
return Operation.Implies;
|
||||||
|
if (name.equals("div"))
|
||||||
|
return Operation.Div;
|
||||||
|
if (name.equals("mod"))
|
||||||
|
return Operation.Mod;
|
||||||
|
if (name.equals("in"))
|
||||||
|
return Operation.In;
|
||||||
|
if (name.equals("contains"))
|
||||||
|
return Operation.Contains;
|
||||||
|
if (name.equals("memberOf"))
|
||||||
|
return Operation.MemberOf;
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
public String toCode() {
|
||||||
|
switch (this) {
|
||||||
|
case Equals : return "=";
|
||||||
|
case Equivalent : return "~";
|
||||||
|
case NotEquals : return "!=";
|
||||||
|
case NotEquivalent : return "!~";
|
||||||
|
case Greater : return ">";
|
||||||
|
case LessThan : return "<";
|
||||||
|
case GreaterOrEqual : return ">=";
|
||||||
|
case LessOrEqual : return "<=";
|
||||||
|
case Union : return "|";
|
||||||
|
case Or : return "or";
|
||||||
|
case And : return "and";
|
||||||
|
case Xor : return "xor";
|
||||||
|
case Times : return "*";
|
||||||
|
case DivideBy : return "/";
|
||||||
|
case Plus : return "+";
|
||||||
|
case Minus : return "-";
|
||||||
|
case Concatenate : return "&";
|
||||||
|
case Implies : return "implies";
|
||||||
|
case Is : return "is";
|
||||||
|
case As : return "as";
|
||||||
|
case Div : return "div";
|
||||||
|
case Mod : return "mod";
|
||||||
|
case In : return "in";
|
||||||
|
case Contains : return "contains";
|
||||||
|
case MemberOf : return "memberOf";
|
||||||
|
default: return "?custom?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CollectionStatus {
|
||||||
|
SINGLETON, ORDERED, UNORDERED;
|
||||||
|
|
||||||
|
boolean isList() {
|
||||||
|
return this == ORDERED || this == UNORDERED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//the expression will have one of either name or constant
|
||||||
|
private String uniqueId;
|
||||||
|
private Kind kind;
|
||||||
|
private String name;
|
||||||
|
private Base constant;
|
||||||
|
private Function function;
|
||||||
|
private List<ExpressionNode> parameters; // will be created if there is a function
|
||||||
|
private ExpressionNode inner;
|
||||||
|
private ExpressionNode group;
|
||||||
|
private Operation operation;
|
||||||
|
private boolean proximal; // a proximal operation is the first in the sequence of operations. This is significant when evaluating the outcomes
|
||||||
|
private ExpressionNode opNext;
|
||||||
|
private SourceLocation start;
|
||||||
|
private SourceLocation end;
|
||||||
|
private SourceLocation opStart;
|
||||||
|
private SourceLocation opEnd;
|
||||||
|
private TypeDetails types;
|
||||||
|
private TypeDetails opTypes;
|
||||||
|
|
||||||
|
|
||||||
|
public ExpressionNode(int uniqueId) {
|
||||||
|
super();
|
||||||
|
this.uniqueId = Integer.toString(uniqueId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
if (function == Function.Item)
|
||||||
|
b.append("[");
|
||||||
|
else {
|
||||||
|
b.append(name);
|
||||||
|
b.append("(");
|
||||||
|
}
|
||||||
|
boolean first = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
b.append(n.toString());
|
||||||
|
}
|
||||||
|
if (function == Function.Item) {
|
||||||
|
b.append("]");
|
||||||
|
} else {
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
if (constant == null) {
|
||||||
|
b.append("{}");
|
||||||
|
} else if (constant instanceof StringType) {
|
||||||
|
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
|
||||||
|
} else if (constant instanceof Quantity) {
|
||||||
|
Quantity q = (Quantity) constant;
|
||||||
|
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
||||||
|
if (q.hasUnit() || q.hasCode()) {
|
||||||
|
b.append(" '");
|
||||||
|
if (q.hasUnit()) {
|
||||||
|
b.append(Utilities.escapeJson(q.getUnit()));
|
||||||
|
} else {
|
||||||
|
b.append(Utilities.escapeJson(q.getCode()));
|
||||||
|
}
|
||||||
|
b.append("'");
|
||||||
|
}
|
||||||
|
} else if (constant.primitiveValue() != null) {
|
||||||
|
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
||||||
|
} else {
|
||||||
|
b.append(Utilities.escapeJson(constant.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append("(");
|
||||||
|
b.append(group.toString());
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
if (!((ExpressionNode.Kind.Function == inner.getKind()) && (ExpressionNode.Function.Item == inner.getFunction()))) {
|
||||||
|
b.append(".");
|
||||||
|
}
|
||||||
|
b.append(inner.toString());
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(" ");
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(" ");
|
||||||
|
b.append(opNext.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public Base getConstant() {
|
||||||
|
return constant;
|
||||||
|
}
|
||||||
|
public void setConstant(Base constant) {
|
||||||
|
this.constant = constant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Function getFunction() {
|
||||||
|
return function;
|
||||||
|
}
|
||||||
|
public void setFunction(Function function) {
|
||||||
|
this.function = function;
|
||||||
|
if (parameters == null)
|
||||||
|
parameters = new ArrayList<ExpressionNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isProximal() {
|
||||||
|
return proximal;
|
||||||
|
}
|
||||||
|
public void setProximal(boolean proximal) {
|
||||||
|
this.proximal = proximal;
|
||||||
|
}
|
||||||
|
public Operation getOperation() {
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
public void setOperation(Operation operation) {
|
||||||
|
this.operation = operation;
|
||||||
|
}
|
||||||
|
public ExpressionNode getInner() {
|
||||||
|
return inner;
|
||||||
|
}
|
||||||
|
public void setInner(ExpressionNode value) {
|
||||||
|
this.inner = value;
|
||||||
|
}
|
||||||
|
public ExpressionNode getOpNext() {
|
||||||
|
return opNext;
|
||||||
|
}
|
||||||
|
public void setOpNext(ExpressionNode value) {
|
||||||
|
this.opNext = value;
|
||||||
|
}
|
||||||
|
public List<ExpressionNode> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
public boolean checkName() {
|
||||||
|
if (!name.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return Utilities.existsInList(name, "$this", "$total", "$index");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kind getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKind(Kind kind) {
|
||||||
|
this.kind = kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionNode getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroup(ExpressionNode group) {
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(SourceLocation start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(SourceLocation end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpStart() {
|
||||||
|
return opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpStart(SourceLocation opStart) {
|
||||||
|
this.opStart = opStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getOpEnd() {
|
||||||
|
return opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpEnd(SourceLocation opEnd) {
|
||||||
|
this.opEnd = opEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int parameterCount() {
|
||||||
|
if (parameters == null)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return parameters.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Canonical() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
write(b);
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String summary() {
|
||||||
|
switch (kind) {
|
||||||
|
case Name: return uniqueId+": "+name;
|
||||||
|
case Function: return uniqueId+": "+function.toString()+"()";
|
||||||
|
case Constant: return uniqueId+": "+constant;
|
||||||
|
case Group: return uniqueId+": (Group)";
|
||||||
|
}
|
||||||
|
return "?exp-kind?";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(StringBuilder b) {
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
b.append(name);
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
b.append(constant);
|
||||||
|
break;
|
||||||
|
case Function:
|
||||||
|
b.append(function.toCode());
|
||||||
|
b.append('(');
|
||||||
|
boolean f = true;
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
if (f)
|
||||||
|
f = false;
|
||||||
|
else
|
||||||
|
b.append(", ");
|
||||||
|
n.write(b);
|
||||||
|
}
|
||||||
|
b.append(')');
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Group:
|
||||||
|
b.append('(');
|
||||||
|
group.write(b);
|
||||||
|
b.append(')');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inner != null) {
|
||||||
|
b.append('.');
|
||||||
|
inner.write(b);
|
||||||
|
}
|
||||||
|
if (operation != null) {
|
||||||
|
b.append(' ');
|
||||||
|
b.append(operation.toCode());
|
||||||
|
b.append(' ');
|
||||||
|
opNext.write(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String check() {
|
||||||
|
|
||||||
|
if (kind == null) {
|
||||||
|
return "Error in expression - node has no kind";
|
||||||
|
}
|
||||||
|
switch (kind) {
|
||||||
|
case Name:
|
||||||
|
if (Utilities.noString(name))
|
||||||
|
return "No Name provided @ "+location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Function:
|
||||||
|
if (function == null)
|
||||||
|
return "No Function id provided @ "+location();
|
||||||
|
for (ExpressionNode n : parameters) {
|
||||||
|
String msg = n.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Unary:
|
||||||
|
break;
|
||||||
|
case Constant:
|
||||||
|
if (constant == null)
|
||||||
|
return "No Constant provided @ "+location();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Group:
|
||||||
|
if (group == null)
|
||||||
|
return "No Group provided @ "+location();
|
||||||
|
else {
|
||||||
|
String msg = group.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inner != null) {
|
||||||
|
String msg = inner.check();
|
||||||
|
if (msg != null)
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (operation == null) {
|
||||||
|
|
||||||
|
if (opNext != null)
|
||||||
|
return "Next provided when it shouldn't be @ "+location();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (opNext == null)
|
||||||
|
return "No Next provided @ "+location();
|
||||||
|
else
|
||||||
|
opNext.check();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String location() {
|
||||||
|
return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypes(TypeDetails types) {
|
||||||
|
this.types = types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails getOpTypes() {
|
||||||
|
return opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpTypes(TypeDetails opTypes) {
|
||||||
|
this.opTypes = opTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDistalNames() {
|
||||||
|
List<String> names = new ArrayList<String>();
|
||||||
|
if (operation != null) {
|
||||||
|
names.add(null);
|
||||||
|
} else if (inner != null) {
|
||||||
|
names.addAll(inner.getDistalNames());
|
||||||
|
} else if (group != null) {
|
||||||
|
names.addAll(group.getDistalNames());
|
||||||
|
} else if (function != null) {
|
||||||
|
names.add(null);
|
||||||
|
} else if (constant != null) {
|
||||||
|
names.add(null);
|
||||||
|
} else {
|
||||||
|
names.add(name);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNullSet() {
|
||||||
|
return kind == Kind.Constant && constant == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,570 @@
|
||||||
|
package org.hl7.fhir.r5.fhirpath;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
import org.hl7.fhir.utilities.SourceLocation;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
// shared lexer for concrete syntaxes
|
||||||
|
// - FluentPath
|
||||||
|
// - Mapping language
|
||||||
|
|
||||||
|
public class FHIRLexer {
|
||||||
|
public class FHIRLexerException extends FHIRException {
|
||||||
|
|
||||||
|
private SourceLocation location;
|
||||||
|
|
||||||
|
// public FHIRLexerException() {
|
||||||
|
// super();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public FHIRLexerException(String message, Throwable cause) {
|
||||||
|
// super(message, cause);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public FHIRLexerException(String message) {
|
||||||
|
// super(message);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public FHIRLexerException(Throwable cause) {
|
||||||
|
// super(cause);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public FHIRLexerException(String message, SourceLocation location) {
|
||||||
|
super(message);
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SourceLocation getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private String source;
|
||||||
|
private int cursor;
|
||||||
|
private int currentStart;
|
||||||
|
private String current;
|
||||||
|
private List<String> comments = new ArrayList<>();
|
||||||
|
private SourceLocation currentLocation;
|
||||||
|
private SourceLocation currentStartLocation;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private boolean liquidMode; // in liquid mode, || terminates the expression and hands the parser back to the host
|
||||||
|
private SourceLocation commentLocation;
|
||||||
|
private boolean metadataFormat;
|
||||||
|
private boolean allowDoubleQuotes;
|
||||||
|
|
||||||
|
public FHIRLexer(String source, String name) throws FHIRLexerException {
|
||||||
|
this.source = source == null ? "" : source;
|
||||||
|
this.name = name == null ? "??" : name;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public FHIRLexer(String source, int i) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
this.cursor = i;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public FHIRLexer(String source, int i, boolean allowDoubleQuotes) throws FHIRLexerException {
|
||||||
|
this.source = source;
|
||||||
|
this.cursor = i;
|
||||||
|
this.allowDoubleQuotes = allowDoubleQuotes;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public FHIRLexer(String source, String name, boolean metadataFormat, boolean allowDoubleQuotes) throws FHIRLexerException {
|
||||||
|
this.source = source == null ? "" : source;
|
||||||
|
this.name = name == null ? "??" : name;
|
||||||
|
this.metadataFormat = metadataFormat;
|
||||||
|
this.allowDoubleQuotes = allowDoubleQuotes;
|
||||||
|
currentLocation = new SourceLocation(1, 1);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
public String getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
public SourceLocation getCurrentLocation() {
|
||||||
|
return currentLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConstant() {
|
||||||
|
return FHIRPathConstant.isFHIRPathConstant(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFixedName() {
|
||||||
|
return FHIRPathConstant.isFHIRPathFixedName(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStringConstant() {
|
||||||
|
return FHIRPathConstant.isFHIRPathStringConstant(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String take() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
next();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int takeInt() throws FHIRLexerException {
|
||||||
|
String s = current;
|
||||||
|
if (!Utilities.isInteger(s))
|
||||||
|
throw error("Found "+current+" expecting an integer");
|
||||||
|
next();
|
||||||
|
return Integer.parseInt(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToken() {
|
||||||
|
if (Utilities.noString(current))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (current.startsWith("$"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (current.equals("*") || current.equals("**"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((current.charAt(0) >= 'A' && current.charAt(0) <= 'Z') || (current.charAt(0) >= 'a' && current.charAt(0) <= 'z')) {
|
||||||
|
for (int i = 1; i < current.length(); i++)
|
||||||
|
if (!( (current.charAt(1) >= 'A' && current.charAt(1) <= 'Z') || (current.charAt(1) >= 'a' && current.charAt(1) <= 'z') ||
|
||||||
|
(current.charAt(1) >= '0' && current.charAt(1) <= '9')))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg) {
|
||||||
|
return error(msg, currentLocation.toString(), currentLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FHIRLexerException error(String msg, String location, SourceLocation loc) {
|
||||||
|
return new FHIRLexerException("Error @"+location+": "+msg, loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void next() throws FHIRLexerException {
|
||||||
|
skipWhitespaceAndComments();
|
||||||
|
current = null;
|
||||||
|
currentStart = cursor;
|
||||||
|
currentStartLocation = currentLocation;
|
||||||
|
if (cursor < source.length()) {
|
||||||
|
char ch = source.charAt(cursor);
|
||||||
|
if (ch == '!' || ch == '>' || ch == '<' || ch == ':' || ch == '-' || ch == '=') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '=' || source.charAt(cursor) == '~' || source.charAt(cursor) == '-') || (ch == '-' && source.charAt(cursor) == '>'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '.' ) {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '.'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch >= '0' && ch <= '9') {
|
||||||
|
cursor++;
|
||||||
|
boolean dotted = false;
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || (source.charAt(cursor) == '.') && !dotted)) {
|
||||||
|
if (source.charAt(cursor) == '.')
|
||||||
|
dotted = true;
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (source.charAt(cursor-1) == '.')
|
||||||
|
cursor--;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z') || (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z') ||
|
||||||
|
(source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == '_'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '%') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '`')) {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) != '`'))
|
||||||
|
cursor++;
|
||||||
|
cursor++;
|
||||||
|
} else
|
||||||
|
while (cursor < source.length() && ((source.charAt(cursor) >= 'A' && source.charAt(cursor) <= 'Z') || (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z') ||
|
||||||
|
(source.charAt(cursor) >= '0' && source.charAt(cursor) <= '9') || source.charAt(cursor) == ':' || source.charAt(cursor) == '-'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '/') {
|
||||||
|
cursor++;
|
||||||
|
if (cursor < source.length() && (source.charAt(cursor) == '/')) {
|
||||||
|
// we've run into metadata
|
||||||
|
cursor++;
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else {
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
}
|
||||||
|
} else if (ch == '$') {
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && (source.charAt(cursor) >= 'a' && source.charAt(cursor) <= 'z'))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '{') {
|
||||||
|
cursor++;
|
||||||
|
ch = source.charAt(cursor);
|
||||||
|
if (ch == '}')
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '"' && allowDoubleQuotes) {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '"')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "\""+source.substring(currentStart+1, cursor-1)+"\"";
|
||||||
|
} else if (ch == '`') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '`')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "`"+source.substring(currentStart+1, cursor-1)+"`";
|
||||||
|
} else if (ch == '\''){
|
||||||
|
cursor++;
|
||||||
|
char ech = ch;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != ech)) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
if (ech == '\'')
|
||||||
|
current = "\'"+current.substring(1, current.length() - 1)+"\'";
|
||||||
|
} else if (ch == '`') {
|
||||||
|
cursor++;
|
||||||
|
boolean escape = false;
|
||||||
|
while (cursor < source.length() && (escape || source.charAt(cursor) != '`')) {
|
||||||
|
if (escape)
|
||||||
|
escape = false;
|
||||||
|
else
|
||||||
|
escape = (source.charAt(cursor) == '\\');
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor == source.length())
|
||||||
|
throw error("Unterminated string");
|
||||||
|
cursor++;
|
||||||
|
current = "`"+source.substring(currentStart+1, cursor-1)+"`";
|
||||||
|
} else if (ch == '|' && liquidMode) {
|
||||||
|
cursor++;
|
||||||
|
ch = source.charAt(cursor);
|
||||||
|
if (ch == '|')
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else if (ch == '@'){
|
||||||
|
int start = cursor;
|
||||||
|
cursor++;
|
||||||
|
while (cursor < source.length() && isDateChar(source.charAt(cursor), start))
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
} else { // if CharInSet(ch, ['.', ',', '(', ')', '=', '$']) then
|
||||||
|
cursor++;
|
||||||
|
current = source.substring(currentStart, cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void skipWhitespaceAndComments() {
|
||||||
|
comments.clear();
|
||||||
|
commentLocation = null;
|
||||||
|
boolean last13 = false;
|
||||||
|
boolean done = false;
|
||||||
|
while (cursor < source.length() && !done) {
|
||||||
|
if (cursor < source.length() -1 && "//".equals(source.substring(cursor, cursor+2)) && !isMetadataStart()) {
|
||||||
|
if (commentLocation == null) {
|
||||||
|
commentLocation = currentLocation.copy();
|
||||||
|
}
|
||||||
|
int start = cursor+2;
|
||||||
|
while (cursor < source.length() && !((source.charAt(cursor) == '\r') || source.charAt(cursor) == '\n')) {
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
comments.add(source.substring(start, cursor).trim());
|
||||||
|
} else if (cursor < source.length() - 1 && "/*".equals(source.substring(cursor, cursor+2))) {
|
||||||
|
if (commentLocation == null) {
|
||||||
|
commentLocation = currentLocation.copy();
|
||||||
|
}
|
||||||
|
int start = cursor+2;
|
||||||
|
while (cursor < source.length() - 1 && !"*/".equals(source.substring(cursor, cursor+2))) {
|
||||||
|
last13 = currentLocation.checkChar(source.charAt(cursor), last13);
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor >= source.length() -1) {
|
||||||
|
error("Unfinished comment");
|
||||||
|
} else {
|
||||||
|
comments.add(source.substring(start, cursor).trim());
|
||||||
|
cursor = cursor + 2;
|
||||||
|
}
|
||||||
|
} else if (Utilities.isWhitespace(source.charAt(cursor))) {
|
||||||
|
last13 = currentLocation.checkChar(source.charAt(cursor), last13);
|
||||||
|
cursor++;
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMetadataStart() {
|
||||||
|
return metadataFormat && cursor < source.length() - 2 && "///".equals(source.substring(cursor, cursor+3));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDateChar(char ch,int start) {
|
||||||
|
int eot = source.charAt(start+1) == 'T' ? 10 : 20;
|
||||||
|
|
||||||
|
return ch == '-' || ch == ':' || ch == 'T' || ch == '+' || ch == 'Z' || Character.isDigit(ch) || (cursor-start == eot && ch == '.' && cursor < source.length()-1&& Character.isDigit(source.charAt(cursor+1)));
|
||||||
|
}
|
||||||
|
public boolean isOp() {
|
||||||
|
return ExpressionNode.Operation.fromCode(current) != null;
|
||||||
|
}
|
||||||
|
public boolean done() {
|
||||||
|
return currentStart >= source.length();
|
||||||
|
}
|
||||||
|
public int nextId() {
|
||||||
|
id++;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public SourceLocation getCurrentStartLocation() {
|
||||||
|
return currentStartLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// special case use
|
||||||
|
public void setCurrent(String current) {
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasComments() {
|
||||||
|
return comments.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getComments() {
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAllComments() {
|
||||||
|
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder("\r\n");
|
||||||
|
b.addAll(comments);
|
||||||
|
comments.clear();
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstComment() {
|
||||||
|
if (hasComments()) {
|
||||||
|
String s = comments.get(0);
|
||||||
|
comments.remove(0);
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasToken(String kw) {
|
||||||
|
return !done() && kw.equals(current);
|
||||||
|
}
|
||||||
|
public boolean hasToken(String... names) {
|
||||||
|
if (done())
|
||||||
|
return false;
|
||||||
|
for (String s : names)
|
||||||
|
if (s.equals(current))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void token(String kw) throws FHIRLexerException {
|
||||||
|
if (!kw.equals(current))
|
||||||
|
throw error("Found \""+current+"\" expecting \""+kw+"\"");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readConstant(String desc) throws FHIRLexerException {
|
||||||
|
if (!isStringConstant())
|
||||||
|
throw error("Found "+current+" expecting \"["+desc+"]\"");
|
||||||
|
|
||||||
|
return processConstant(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readFixedName(String desc) throws FHIRLexerException {
|
||||||
|
if (!isFixedName())
|
||||||
|
throw error("Found "+current+" expecting \"["+desc+"]\"");
|
||||||
|
|
||||||
|
return processFixedName(take());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processConstant(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length()-1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
b.append('"');
|
||||||
|
break;
|
||||||
|
case '`':
|
||||||
|
b.append('`');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('/');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i+4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown FHIRPath character escape \\"+s.charAt(i), currentLocation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String processFixedName(String s) throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
int i = 1;
|
||||||
|
while (i < s.length()-1) {
|
||||||
|
char ch = s.charAt(i);
|
||||||
|
if (ch == '\\') {
|
||||||
|
i++;
|
||||||
|
switch (s.charAt(i)) {
|
||||||
|
case 't':
|
||||||
|
b.append('\t');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
b.append('\r');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
b.append('\n');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
b.append('\f');
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
b.append('\'');
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
b.append('"');
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
b.append('\\');
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
b.append('/');
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
i++;
|
||||||
|
int uc = Integer.parseInt(s.substring(i, i+4), 16);
|
||||||
|
b.append((char) uc);
|
||||||
|
i = i + 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new FHIRLexerException("Unknown FHIRPath character escape \\"+s.charAt(i), currentLocation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.append(ch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skipToken(String token) throws FHIRLexerException {
|
||||||
|
if (getCurrent().equals(token))
|
||||||
|
next();
|
||||||
|
|
||||||
|
}
|
||||||
|
public String takeDottedToken() throws FHIRLexerException {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append(take());
|
||||||
|
while (!done() && getCurrent().equals(".")) {
|
||||||
|
b.append(take());
|
||||||
|
b.append(take());
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentStart() {
|
||||||
|
return currentStart;
|
||||||
|
}
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public boolean isLiquidMode() {
|
||||||
|
return liquidMode;
|
||||||
|
}
|
||||||
|
public void setLiquidMode(boolean liquidMode) {
|
||||||
|
this.liquidMode = liquidMode;
|
||||||
|
}
|
||||||
|
public SourceLocation getCommentLocation() {
|
||||||
|
return this.commentLocation;
|
||||||
|
}
|
||||||
|
public boolean isMetadataFormat() {
|
||||||
|
return metadataFormat;
|
||||||
|
}
|
||||||
|
public void setMetadataFormat(boolean metadataFormat) {
|
||||||
|
this.metadataFormat = metadataFormat;
|
||||||
|
}
|
||||||
|
public List<String> cloneComments() {
|
||||||
|
List<String> res = new ArrayList<>();
|
||||||
|
res.addAll(getComments());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public String tokenWithTrailingComment(String token) {
|
||||||
|
int line = getCurrentLocation().getLine();
|
||||||
|
token(token);
|
||||||
|
if (getComments().size() > 0 && getCommentLocation().getLine() == line) {
|
||||||
|
return getFirstComment();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isAllowDoubleQuotes() {
|
||||||
|
return allowDoubleQuotes;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.hl7.fhir.r5.fhirpath;
|
||||||
|
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class FHIRPathConstant {
|
||||||
|
|
||||||
|
public static boolean isFHIRPathConstant(String string) {
|
||||||
|
return !Utilities.noString(string) && ((string.charAt(0) == '\'' || string.charAt(0) == '"') || string.charAt(0) == '@' || string.charAt(0) == '%' ||
|
||||||
|
string.charAt(0) == '-' || string.charAt(0) == '+' || (string.charAt(0) >= '0' && string.charAt(0) <= '9') ||
|
||||||
|
string.equals("true") || string.equals("false") || string.equals("{}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFHIRPathFixedName(String string) {
|
||||||
|
return string != null && (string.charAt(0) == '`');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFHIRPathStringConstant(String string) {
|
||||||
|
return string.charAt(0) == '\'' || string.charAt(0) == '"' || string.charAt(0) == '`';
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,201 @@
|
||||||
|
package org.hl7.fhir.r5.fhirpath;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r5.model.Base;
|
||||||
|
import org.hl7.fhir.r5.model.Element;
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.Property;
|
||||||
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
public class FHIRPathUtilityClasses {
|
||||||
|
|
||||||
|
public static class FHIRConstant extends Base {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8933773658248269439L;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public FHIRConstant(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fhirType() {
|
||||||
|
return "%constant";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void listChildren(List<Property> result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdBase() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdBase(String value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String primitiveValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Base copy() {
|
||||||
|
throw new Error("Not Implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
public FhirPublication getFHIRPublicationVersion() {
|
||||||
|
return FhirPublication.R5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ClassTypeInfo extends Base {
|
||||||
|
private static final long serialVersionUID = 4909223114071029317L;
|
||||||
|
private Base instance;
|
||||||
|
|
||||||
|
public ClassTypeInfo(Base instance) {
|
||||||
|
super();
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fhirType() {
|
||||||
|
return "ClassInfo";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void listChildren(List<Property> result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdBase() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdBase(String value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||||
|
if (name.equals("name")) {
|
||||||
|
return new Base[]{new StringType(getName())};
|
||||||
|
} else if (name.equals("namespace")) {
|
||||||
|
return new Base[]{new StringType(getNamespace())};
|
||||||
|
} else {
|
||||||
|
return super.getProperty(hash, name, checkValid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getNamespace() {
|
||||||
|
if ((instance instanceof Resource)) {
|
||||||
|
return "FHIR";
|
||||||
|
} else if (!(instance instanceof Element) || ((Element)instance).isDisallowExtensions()) {
|
||||||
|
return "System";
|
||||||
|
} else {
|
||||||
|
return "FHIR";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getName() {
|
||||||
|
if ((instance instanceof Resource)) {
|
||||||
|
return instance.fhirType();
|
||||||
|
} else if (!(instance instanceof Element) || ((Element)instance).isDisallowExtensions()) {
|
||||||
|
return Utilities.capitalize(instance.fhirType());
|
||||||
|
} else {
|
||||||
|
return instance.fhirType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Base copy() {
|
||||||
|
throw new Error("Not Implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
public FhirPublication getFHIRPublicationVersion() {
|
||||||
|
return FhirPublication.R5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TypedElementDefinition {
|
||||||
|
private ElementDefinition element;
|
||||||
|
private String type;
|
||||||
|
private StructureDefinition src;
|
||||||
|
public TypedElementDefinition(StructureDefinition src, ElementDefinition element, String type) {
|
||||||
|
super();
|
||||||
|
this.element = element;
|
||||||
|
this.type = type;
|
||||||
|
this.src = src;
|
||||||
|
}
|
||||||
|
public TypedElementDefinition(ElementDefinition element) {
|
||||||
|
super();
|
||||||
|
this.element = element;
|
||||||
|
}
|
||||||
|
public ElementDefinition getElement() {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public List<TypeRefComponent> getTypes() {
|
||||||
|
List<TypeRefComponent> res = new ArrayList<ElementDefinition.TypeRefComponent>();
|
||||||
|
for (TypeRefComponent tr : element.getType()) {
|
||||||
|
if (type == null || type.equals(tr.getCode())) {
|
||||||
|
res.add(tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public boolean hasType(String tn) {
|
||||||
|
if (type != null) {
|
||||||
|
return tn.equals(type);
|
||||||
|
} else {
|
||||||
|
for (TypeRefComponent t : element.getType()) {
|
||||||
|
if (tn.equals(t.getCode())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public StructureDefinition getSrc() {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class FunctionDetails {
|
||||||
|
private String description;
|
||||||
|
private int minParameters;
|
||||||
|
private int maxParameters;
|
||||||
|
public FunctionDetails(String description, int minParameters, int maxParameters) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.minParameters = minParameters;
|
||||||
|
this.maxParameters = maxParameters;
|
||||||
|
}
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public int getMinParameters() {
|
||||||
|
return minParameters;
|
||||||
|
}
|
||||||
|
public int getMaxParameters() {
|
||||||
|
return maxParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,592 @@
|
||||||
|
package org.hl7.fhir.r5.fhirpath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
|
import org.hl7.fhir.r5.model.UriType;
|
||||||
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
|
||||||
|
public class TypeDetails {
|
||||||
|
public class ProfiledTypeSorter implements Comparator<ProfiledType> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(ProfiledType o1, ProfiledType o2) {
|
||||||
|
return o1.uri.compareTo(o2.uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String FHIR_NS = "http://hl7.org/fhir/StructureDefinition/";
|
||||||
|
public static final String FP_NS = "http://hl7.org/fhirpath/";
|
||||||
|
public static final String FP_String = "http://hl7.org/fhirpath/System.String";
|
||||||
|
public static final String FP_Boolean = "http://hl7.org/fhirpath/System.Boolean";
|
||||||
|
public static final String FP_Integer = "http://hl7.org/fhirpath/System.Integer";
|
||||||
|
public static final String FP_Decimal = "http://hl7.org/fhirpath/System.Decimal";
|
||||||
|
public static final String FP_Quantity = "http://hl7.org/fhirpath/System.Quantity";
|
||||||
|
public static final String FP_DateTime = "http://hl7.org/fhirpath/System.DateTime";
|
||||||
|
public static final String FP_Time = "http://hl7.org/fhirpath/System.Time";
|
||||||
|
public static final String FP_SimpleTypeInfo = "http://hl7.org/fhirpath/System.SimpleTypeInfo";
|
||||||
|
public static final String FP_ClassInfo = "http://hl7.org/fhirpath/System.ClassInfo";
|
||||||
|
public static final Set<String> FP_NUMBERS = new HashSet<String>(Arrays.asList(FP_Integer, FP_Decimal));
|
||||||
|
|
||||||
|
public static class ProfiledType {
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String uri;
|
||||||
|
private List<String> profiles; // or, not and
|
||||||
|
private List<ElementDefinitionBindingComponent> bindings;
|
||||||
|
|
||||||
|
public ProfiledType(String n) {
|
||||||
|
uri = ns(n);
|
||||||
|
if (uri.equals("http://hl7.org/fhir/StructureDefinition/CDA")) {
|
||||||
|
System.out.println("!"); // #FIXME
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProfiles() {
|
||||||
|
return profiles != null && profiles.size() > 0;
|
||||||
|
}
|
||||||
|
public List<String> getProfiles() {
|
||||||
|
return profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBindings() {
|
||||||
|
return bindings != null && bindings.size() > 0;
|
||||||
|
}
|
||||||
|
public List<ElementDefinitionBindingComponent> getBindings() {
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String ns(String n) {
|
||||||
|
return Utilities.isAbsoluteUrl(n) ? n : FHIR_NS+n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfile(String profile) {
|
||||||
|
if (profiles == null)
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
profiles.add(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBinding(ElementDefinitionBindingComponent binding) {
|
||||||
|
bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
bindings.add(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBinding(ElementDefinitionBindingComponent b) {
|
||||||
|
return false; // todo: do we need to do this?
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfiles(List<CanonicalType> list) {
|
||||||
|
if (profiles == null)
|
||||||
|
profiles = new ArrayList<String>();
|
||||||
|
for (UriType u : list)
|
||||||
|
profiles.add(u.getValue());
|
||||||
|
}
|
||||||
|
public boolean isSystemType() {
|
||||||
|
return uri.startsWith(FP_NS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String describeMin() {
|
||||||
|
if (uri.startsWith(FP_NS)) {
|
||||||
|
return "System."+uri.substring(FP_NS.length());
|
||||||
|
}
|
||||||
|
if (uri.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
||||||
|
return "FHIR."+uri.substring("http://hl7.org/fhir/StructureDefinition/".length());
|
||||||
|
}
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProfiledType> types = new ArrayList<ProfiledType>();
|
||||||
|
private CollectionStatus collectionStatus;
|
||||||
|
private Set<String> targets; // or, not and, canonical urls
|
||||||
|
private boolean choice;
|
||||||
|
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, String... names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
this.types.add(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, Set<String> names) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
for (String n : names) {
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public TypeDetails(CollectionStatus collectionStatus, ProfiledType pt) {
|
||||||
|
super();
|
||||||
|
this.collectionStatus = collectionStatus;
|
||||||
|
this.types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TypeDetails() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addType(String n) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public String addType(String n, String p) {
|
||||||
|
ProfiledType pt = new ProfiledType(n);
|
||||||
|
pt.addProfile(p);
|
||||||
|
String res = pt.uri;
|
||||||
|
addType(pt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addType(ProfiledType pt) {
|
||||||
|
for (ProfiledType et : types) {
|
||||||
|
if (et.uri.equals(pt.uri)) {
|
||||||
|
if (pt.profiles != null) {
|
||||||
|
for (String p : pt.profiles) {
|
||||||
|
if (et.profiles == null)
|
||||||
|
et.profiles = new ArrayList<String>();
|
||||||
|
if (!et.profiles.contains(p))
|
||||||
|
et.profiles.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pt.bindings != null) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.bindings) {
|
||||||
|
if (et.bindings == null)
|
||||||
|
et.bindings = new ArrayList<ElementDefinitionBindingComponent>();
|
||||||
|
if (!et.hasBinding(b))
|
||||||
|
et.bindings.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types.add(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addType(CollectionStatus status, ProfiledType pt) {
|
||||||
|
addType(pt);
|
||||||
|
if (collectionStatus == null) {
|
||||||
|
collectionStatus = status;
|
||||||
|
} else {
|
||||||
|
switch (status) {
|
||||||
|
case ORDERED:
|
||||||
|
if (collectionStatus == CollectionStatus.SINGLETON) {
|
||||||
|
collectionStatus = status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SINGLETON:
|
||||||
|
break;
|
||||||
|
case UNORDERED:
|
||||||
|
collectionStatus = status;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTypes(Collection<String> names) {
|
||||||
|
for (String n : names)
|
||||||
|
addType(new ProfiledType(n));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(IWorkerContext context, String... tn) {
|
||||||
|
for (String n: tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time", "ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS+"System."+Utilities.capitalize(n);
|
||||||
|
if (typesContains(t)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t = ProfiledType.ns(n);
|
||||||
|
StructureDefinition sd = context.fetchTypeDefinition(t);
|
||||||
|
if (sd != null && sd.getKind() != StructureDefinitionKind.LOGICAL && Utilities.existsInList(sd.getType(), "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time")) {
|
||||||
|
t = FP_NS+"System."+Utilities.capitalize(sd.getType());
|
||||||
|
if (typesContains(t)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String n: tn) {
|
||||||
|
String id = n.contains("#") ? n.substring(0, n.indexOf("#")) : n;
|
||||||
|
String tail = null;
|
||||||
|
if (n.contains("#")) {
|
||||||
|
tail = n.substring( n.indexOf("#")+1);
|
||||||
|
tail = tail.substring(tail.indexOf("."));
|
||||||
|
}
|
||||||
|
List<StructureDefinition> list = new ArrayList<>();
|
||||||
|
if (!Utilities.isAbsoluteUrl(n)) {
|
||||||
|
list.addAll(context.fetchTypeDefinitions(n));
|
||||||
|
} else {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
StructureDefinition sd = context.fetchResource(StructureDefinition.class, t);
|
||||||
|
if (sd != null) {
|
||||||
|
list.add(sd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
StructureDefinition sd = list.get(i);
|
||||||
|
while (sd != null) {
|
||||||
|
if (tail == null && typesContains(sd.getUrl()))
|
||||||
|
return true;
|
||||||
|
if (tail == null && getSystemType(sd.getUrl()) != null && typesContains(getSystemType(sd.getUrl())))
|
||||||
|
return true;
|
||||||
|
if (tail != null && typesContains(sd.getUrl()+"#"+sd.getType()+tail))
|
||||||
|
return true;
|
||||||
|
if ("http://hl7.org/fhir/StructureDefinition/string".equals(sd.getUrl()) && typesContains(FP_String)) {
|
||||||
|
return true; // this is work around for R3
|
||||||
|
}
|
||||||
|
if (sd.hasBaseDefinition()) {
|
||||||
|
if (sd.getType().equals("uri"))
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/string");
|
||||||
|
else
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
||||||
|
} else {
|
||||||
|
sd = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSystemType(String url) {
|
||||||
|
if (url.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
||||||
|
String code = url.substring(40);
|
||||||
|
if (Utilities.existsInList(code, "string", "boolean", "integer", "decimal", "dateTime", "time", "Quantity"))
|
||||||
|
return FP_NS+"System.."+Utilities.capitalize(code);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean typesContains(String t) {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.equals(t))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(TypeDetails source) {
|
||||||
|
for (ProfiledType pt : source.types)
|
||||||
|
addType(pt);
|
||||||
|
if (collectionStatus == null || collectionStatus == CollectionStatus.SINGLETON)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else if (source.collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
collectionStatus = source.collectionStatus;
|
||||||
|
else
|
||||||
|
collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
if (source.targets != null) {
|
||||||
|
if (targets == null) {
|
||||||
|
targets = new HashSet<>();
|
||||||
|
}
|
||||||
|
targets.addAll(source.targets);
|
||||||
|
}
|
||||||
|
if (source.isChoice()) {
|
||||||
|
choice = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails union(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
result.addType(pt);
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
if (targets != null || right.targets != null) {
|
||||||
|
result.targets = new HashSet<>();
|
||||||
|
if (targets != null) {
|
||||||
|
result.targets.addAll(targets);
|
||||||
|
}
|
||||||
|
if (right.targets != null) {
|
||||||
|
result.targets.addAll(right.targets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeDetails intersect(TypeDetails right) {
|
||||||
|
TypeDetails result = new TypeDetails(null);
|
||||||
|
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
|
||||||
|
result.collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
else
|
||||||
|
result.collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
boolean found = false;
|
||||||
|
for (ProfiledType r : right.types)
|
||||||
|
found = found || pt.uri.equals(r.uri);
|
||||||
|
if (found)
|
||||||
|
result.addType(pt);
|
||||||
|
}
|
||||||
|
for (ProfiledType pt : right.types)
|
||||||
|
result.addType(pt);
|
||||||
|
if (targets != null && right.targets != null) {
|
||||||
|
result.targets = new HashSet<>();
|
||||||
|
for (String s : targets) {
|
||||||
|
if (right.targets.contains(s)) {
|
||||||
|
result.targets.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNoTypes() {
|
||||||
|
return types.isEmpty();
|
||||||
|
}
|
||||||
|
public Set<String> getTypes() {
|
||||||
|
Set<String> res = new HashSet<String>();
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
res.add(pt.uri);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public TypeDetails toSingleton() {
|
||||||
|
TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
|
||||||
|
result.types.addAll(types);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public CollectionStatus getCollectionStatus() {
|
||||||
|
return collectionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasType(ProfiledType pt) {
|
||||||
|
return hasType(pt.uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(String n) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "date", "dateTime", "time", "ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS+"System."+Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasType(Set<String> tn) {
|
||||||
|
for (String n: tn) {
|
||||||
|
String t = ProfiledType.ns(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
if (Utilities.existsInList(n, "boolean", "string", "integer", "decimal", "Quantity", "dateTime", "time", "ClassInfo", "SimpleTypeInfo")) {
|
||||||
|
t = FP_NS+"System."+Utilities.capitalize(n);
|
||||||
|
if (typesContains(t))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String describe() {
|
||||||
|
return Utilities.sorted(getTypes()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String describeMin() {
|
||||||
|
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||||
|
for (ProfiledType pt : sortedTypes(types))
|
||||||
|
b.append(pt.describeMin());
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProfiledType> sortedTypes(List<ProfiledType> types2) {
|
||||||
|
List<ProfiledType> list = new ArrayList<>();
|
||||||
|
Collections.sort(list, new ProfiledTypeSorter());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return (collectionStatus == null ? collectionStatus.SINGLETON.toString() : collectionStatus.toString()) + getTypes().toString();
|
||||||
|
}
|
||||||
|
public String getTypeCode() throws DefinitionException {
|
||||||
|
if (types.size() != 1)
|
||||||
|
throw new DefinitionException("Multiple types? ("+types.toString()+")");
|
||||||
|
for (ProfiledType pt : types)
|
||||||
|
if (pt.uri.startsWith("http://hl7.org/fhir/StructureDefinition/"))
|
||||||
|
return pt.uri.substring(40);
|
||||||
|
else
|
||||||
|
return pt.uri;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public List<ProfiledType> getProfiledTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
public boolean hasBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
if (pt.hasBindings())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public ElementDefinitionBindingComponent getBinding() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
for (ElementDefinitionBindingComponent b : pt.getBindings())
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addTarget(String url) {
|
||||||
|
if (targets == null) {
|
||||||
|
targets = new HashSet<>();
|
||||||
|
}
|
||||||
|
targets.add(url);
|
||||||
|
}
|
||||||
|
public Set<String> getTargets() {
|
||||||
|
return targets;
|
||||||
|
}
|
||||||
|
public boolean typesHaveTargets() {
|
||||||
|
for (ProfiledType pt : types) {
|
||||||
|
if (Utilities.existsInList(pt.getUri(), "Reference", "CodeableReference", "canonical", "http://hl7.org/fhir/StructureDefinition/Reference", "http://hl7.org/fhir/StructureDefinition/CodeableReference", "http://hl7.org/fhir/StructureDefinition/canonical")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public void addTargets(Set<String> src) {
|
||||||
|
if (src != null) {
|
||||||
|
for (String s : src) {
|
||||||
|
addTarget(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public TypeDetails copy() {
|
||||||
|
TypeDetails td = new TypeDetails();
|
||||||
|
td.types.addAll(types);
|
||||||
|
td.collectionStatus = collectionStatus;
|
||||||
|
if (targets != null ) {
|
||||||
|
td.targets = new HashSet<>();
|
||||||
|
td.targets.addAll(targets);
|
||||||
|
}
|
||||||
|
return td;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(TypeDetails other) {
|
||||||
|
boolean result = collectionStatus == other.collectionStatus && types.equals(other.types);
|
||||||
|
if (targets == null) {
|
||||||
|
return result && other.targets == null;
|
||||||
|
} else {
|
||||||
|
return result && targets.equals(other.targets);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void addTypes(TypeDetails other) {
|
||||||
|
if (other.collectionStatus != CollectionStatus.SINGLETON) {
|
||||||
|
if (other.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED) {
|
||||||
|
collectionStatus = CollectionStatus.UNORDERED;
|
||||||
|
} else {
|
||||||
|
collectionStatus = CollectionStatus.ORDERED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ProfiledType pt : other.types) {
|
||||||
|
addType(pt);
|
||||||
|
}
|
||||||
|
if (other.targets != null) {
|
||||||
|
if (targets == null) {
|
||||||
|
targets = new HashSet<>();
|
||||||
|
}
|
||||||
|
targets.addAll(other.targets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(TypeDetails other) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
if (other.collectionStatus != collectionStatus) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ProfiledType pt : other.types) {
|
||||||
|
if (!hasType(pt)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static TypeDetails empty() {
|
||||||
|
return new TypeDetails(CollectionStatus.SINGLETON);
|
||||||
|
}
|
||||||
|
public boolean isList() {
|
||||||
|
return collectionStatus != null && collectionStatus.isList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// for SQL-on-FHIR: warnings when .ofType() is not paired with a choice element
|
||||||
|
public void setChoice(boolean b) {
|
||||||
|
choice = true;
|
||||||
|
}
|
||||||
|
public boolean isChoice() {
|
||||||
|
return choice;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -32,7 +32,8 @@ package org.hl7.fhir.r5.model;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the base class for Profile classes - whether generated or manual
|
* This class is the base class for Profile classes - whether generated or manual
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.CanonicalType;
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
@ -48,7 +49,6 @@ import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.ResourceFactory;
|
import org.hl7.fhir.r5.model.ResourceFactory;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,10 @@ import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.DomainResource;
|
import org.hl7.fhir.r5.model.DomainResource;
|
||||||
import org.hl7.fhir.r5.renderers.utils.Resolver.IReferenceResolver;
|
import org.hl7.fhir.r5.renderers.utils.Resolver.IReferenceResolver;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
||||||
|
|
|
@ -9,10 +9,11 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.Bundle;
|
import org.hl7.fhir.r5.model.Bundle;
|
||||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.GraphDefinition;
|
import org.hl7.fhir.r5.model.GraphDefinition;
|
||||||
import org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent;
|
import org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent;
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
|
|
|
@ -41,6 +41,8 @@ import java.util.Map;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.BackboneElement;
|
import org.hl7.fhir.r5.model.BackboneElement;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.Bundle;
|
import org.hl7.fhir.r5.model.Bundle;
|
||||||
|
@ -50,7 +52,6 @@ import org.hl7.fhir.r5.model.Bundle.LinkRelationTypes;
|
||||||
import org.hl7.fhir.r5.model.CanonicalType;
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
import org.hl7.fhir.r5.model.DomainResource;
|
import org.hl7.fhir.r5.model.DomainResource;
|
||||||
import org.hl7.fhir.r5.model.Element;
|
import org.hl7.fhir.r5.model.Element;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.IdType;
|
import org.hl7.fhir.r5.model.IdType;
|
||||||
import org.hl7.fhir.r5.model.IntegerType;
|
import org.hl7.fhir.r5.model.IntegerType;
|
||||||
import org.hl7.fhir.r5.model.Property;
|
import org.hl7.fhir.r5.model.Property;
|
||||||
|
|
|
@ -39,14 +39,16 @@ import java.util.Map;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.ExpressionNodeWithOffset;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.Tuple;
|
import org.hl7.fhir.r5.model.Tuple;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.ExpressionNodeWithOffset;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||||
|
|
|
@ -8,21 +8,21 @@ import org.apache.commons.net.util.Base64;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.Base64BinaryType;
|
import org.hl7.fhir.r5.model.Base64BinaryType;
|
||||||
import org.hl7.fhir.r5.model.BaseDateTimeType;
|
import org.hl7.fhir.r5.model.BaseDateTimeType;
|
||||||
import org.hl7.fhir.r5.model.BooleanType;
|
import org.hl7.fhir.r5.model.BooleanType;
|
||||||
import org.hl7.fhir.r5.model.DecimalType;
|
import org.hl7.fhir.r5.model.DecimalType;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r5.model.IntegerType;
|
import org.hl7.fhir.r5.model.IntegerType;
|
||||||
import org.hl7.fhir.r5.model.Property;
|
import org.hl7.fhir.r5.model.Property;
|
||||||
import org.hl7.fhir.r5.model.StringType;
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.json.model.JsonObject;
|
import org.hl7.fhir.utilities.json.model.JsonObject;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IssueMessage;
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IssueMessage;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.json.model.JsonArray;
|
import org.hl7.fhir.utilities.json.model.JsonArray;
|
||||||
import org.hl7.fhir.utilities.json.model.JsonBoolean;
|
import org.hl7.fhir.utilities.json.model.JsonBoolean;
|
||||||
|
|
|
@ -4,12 +4,12 @@ import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.hl7.fhir.r5.utils.structuremap;
|
package org.hl7.fhir.r5.utils.structuremap;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Property;
|
import org.hl7.fhir.r5.elementmodel.Property;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
|
||||||
public class PropertyWithType {
|
public class PropertyWithType {
|
||||||
private String path;
|
private String path;
|
||||||
|
|
|
@ -43,6 +43,13 @@ import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Property;
|
import org.hl7.fhir.r5.elementmodel.Property;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRLexer;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRLexer.FHIRLexerException;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails.ProfiledType;
|
||||||
import org.hl7.fhir.r5.model.*;
|
import org.hl7.fhir.r5.model.*;
|
||||||
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent;
|
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent;
|
||||||
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode;
|
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode;
|
||||||
|
@ -54,19 +61,14 @@ import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
|
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
|
import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r5.model.Narrative.NarrativeStatus;
|
import org.hl7.fhir.r5.model.Narrative.NarrativeStatus;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.*;
|
import org.hl7.fhir.r5.model.StructureMap.*;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails.ProfiledType;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r5.renderers.TerminologyRenderer;
|
import org.hl7.fhir.r5.renderers.TerminologyRenderer;
|
||||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||||
import org.hl7.fhir.r5.utils.FHIRLexer;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.hl7.fhir.r5.utils.structuremap;
|
package org.hl7.fhir.r5.utils.structuremap;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Property;
|
import org.hl7.fhir.r5.elementmodel.Property;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -10,10 +10,10 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode;
|
||||||
|
|
|
@ -13,14 +13,16 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.PathEngineException;
|
import org.hl7.fhir.exceptions.PathEngineException;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.elementmodel.ValidatedFragment;
|
import org.hl7.fhir.r5.elementmodel.ValidatedFragment;
|
||||||
import org.hl7.fhir.r5.formats.JsonParser;
|
import org.hl7.fhir.r5.formats.JsonParser;
|
||||||
import org.hl7.fhir.r5.formats.XmlParser;
|
import org.hl7.fhir.r5.formats.XmlParser;
|
||||||
import org.hl7.fhir.r5.model.*;
|
import org.hl7.fhir.r5.model.*;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||||
|
|
|
@ -20,27 +20,27 @@ import org.hl7.fhir.r5.conformance.profile.BindingResolution;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
|
import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.AllowUnknownProfile;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.AllowUnknownProfile;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.test.utils.TestPackageLoader;
|
import org.hl7.fhir.r5.test.utils.TestPackageLoader;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.formats.JsonParser;
|
import org.hl7.fhir.r5.formats.JsonParser;
|
||||||
import org.hl7.fhir.r5.formats.XmlParser;
|
import org.hl7.fhir.r5.formats.XmlParser;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
|
@ -8,12 +8,12 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.Coding;
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
import org.hl7.fhir.r5.model.StructureMap;
|
import org.hl7.fhir.r5.model.StructureMap;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.structuremap.ITransformerServices;
|
import org.hl7.fhir.r5.utils.structuremap.ITransformerServices;
|
||||||
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||||
|
|
|
@ -8,10 +8,10 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||||
import org.hl7.fhir.utilities.npm.ToolsVersion;
|
import org.hl7.fhir.utilities.npm.ToolsVersion;
|
||||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode;
|
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.hl7.fhir.r5.utils;
|
package org.hl7.fhir.r5.utils;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRLexer;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.ImplementationGuide;
|
import org.hl7.fhir.r5.model.ImplementationGuide;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome;
|
import org.hl7.fhir.r5.model.OperationOutcome;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
@ -30,7 +31,6 @@ import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.utilities.SimpleHTTPClient;
|
import org.hl7.fhir.utilities.SimpleHTTPClient;
|
||||||
import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
|
import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
|
|
|
@ -35,6 +35,8 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.context.SystemOutLoggingService;
|
import org.hl7.fhir.r5.context.SystemOutLoggingService;
|
||||||
import org.hl7.fhir.r5.elementmodel.*;
|
import org.hl7.fhir.r5.elementmodel.*;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.formats.FormatUtilities;
|
import org.hl7.fhir.r5.formats.FormatUtilities;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.formats.JsonParser;
|
import org.hl7.fhir.r5.formats.JsonParser;
|
||||||
|
@ -46,7 +48,6 @@ import org.hl7.fhir.r5.model.CanonicalResource;
|
||||||
import org.hl7.fhir.r5.model.Coding;
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
import org.hl7.fhir.r5.model.DomainResource;
|
import org.hl7.fhir.r5.model.DomainResource;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.ImplementationGuide;
|
import org.hl7.fhir.r5.model.ImplementationGuide;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome;
|
import org.hl7.fhir.r5.model.OperationOutcome;
|
||||||
import org.hl7.fhir.r5.model.PackageInformation;
|
import org.hl7.fhir.r5.model.PackageInformation;
|
||||||
|
@ -60,7 +61,6 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
||||||
import org.hl7.fhir.r5.utils.validation.BundleValidationRule;
|
import org.hl7.fhir.r5.utils.validation.BundleValidationRule;
|
||||||
|
|
|
@ -388,12 +388,12 @@ public class ValidatorCli {
|
||||||
if (cliContext.getSv() == null) {
|
if (cliContext.getSv() == null) {
|
||||||
cliContext.setSv(myValidationService.determineVersion(cliContext));
|
cliContext.setSv(myValidationService.determineVersion(cliContext));
|
||||||
}
|
}
|
||||||
ValidationEngine validationEngine = getValidationEngine(tt, cliContext);
|
ValidationEngine validationEngine = getValidationEngine(tt, cliContext);
|
||||||
tts.end();
|
tts.end();
|
||||||
((ValidationEngineTask) cliTask).executeTask(myValidationService, validationEngine, cliContext, params, tt, tts);
|
((ValidationEngineTask) cliTask).executeTask(myValidationService, validationEngine, cliContext, params, tt, tts);
|
||||||
} else if (cliTask instanceof StandaloneTask) {
|
} else if (cliTask instanceof StandaloneTask) {
|
||||||
((StandaloneTask) cliTask).executeTask(cliContext,params,tt,tts);
|
((StandaloneTask) cliTask).executeTask(cliContext,params,tt,tts);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Done. " + tt.report()+". Max Memory = "+Utilities.describeSize(Runtime.getRuntime().maxMemory()));
|
System.out.println("Done. " + tt.report()+". Max Memory = "+Utilities.describeSize(Runtime.getRuntime().maxMemory()));
|
||||||
SystemExitManager.finish();
|
SystemExitManager.finish();
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Map;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.Coding;
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
import org.hl7.fhir.r5.model.DateType;
|
import org.hl7.fhir.r5.model.DateType;
|
||||||
import org.hl7.fhir.r5.model.IntegerType;
|
import org.hl7.fhir.r5.model.IntegerType;
|
||||||
|
@ -24,7 +25,6 @@ import org.hl7.fhir.r5.model.TimeType;
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier.ValidationContextResourceProxy;
|
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier.ValidationContextResourceProxy;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
|
|
@ -6,12 +6,12 @@ import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.Kind;
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.Operation;
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.Kind;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.Operation;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IssueMessage;
|
||||||
import org.hl7.fhir.r5.model.SearchParameter;
|
import org.hl7.fhir.r5.model.SearchParameter;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IssueMessage;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
|
|
@ -20,6 +20,9 @@ import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
import org.hl7.fhir.r5.extensions.ExtensionConstants;
|
import org.hl7.fhir.r5.extensions.ExtensionConstants;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IssueMessage;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.Coding;
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
|
@ -27,7 +30,6 @@ import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.Extension;
|
import org.hl7.fhir.r5.model.Extension;
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
@ -36,8 +38,6 @@ import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IssueMessage;
|
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
|
|
|
@ -7,6 +7,8 @@ import java.util.List;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
import org.hl7.fhir.r5.model.Coding;
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
import org.hl7.fhir.r5.model.ConceptMap;
|
import org.hl7.fhir.r5.model.ConceptMap;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
@ -20,14 +22,12 @@ import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode;
|
||||||
import org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent;
|
import org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r5.terminologies.ConceptMapUtilities;
|
import org.hl7.fhir.r5.terminologies.ConceptMapUtilities;
|
||||||
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
||||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.structuremap.ResolvedGroup;
|
import org.hl7.fhir.r5.utils.structuremap.ResolvedGroup;
|
||||||
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
|
|
|
@ -34,11 +34,12 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.BooleanType;
|
import org.hl7.fhir.r5.model.BooleanType;
|
||||||
import org.hl7.fhir.r5.model.Coding;
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
import org.hl7.fhir.r5.model.DataType;
|
import org.hl7.fhir.r5.model.DataType;
|
||||||
import org.hl7.fhir.r5.model.Expression;
|
import org.hl7.fhir.r5.model.Expression;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
|
||||||
import org.hl7.fhir.r5.model.Factory;
|
import org.hl7.fhir.r5.model.Factory;
|
||||||
import org.hl7.fhir.r5.model.PrimitiveType;
|
import org.hl7.fhir.r5.model.PrimitiveType;
|
||||||
import org.hl7.fhir.r5.model.Quantity;
|
import org.hl7.fhir.r5.model.Quantity;
|
||||||
|
@ -46,7 +47,6 @@ import org.hl7.fhir.r5.model.Questionnaire.EnableWhenBehavior;
|
||||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent;
|
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent;
|
||||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent;
|
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent;
|
||||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator;
|
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.validation.instance.type.QuestionnaireValidator.QuestionnaireWithContext;
|
import org.hl7.fhir.validation.instance.type.QuestionnaireValidator.QuestionnaireWithContext;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||||
|
|
|
@ -35,12 +35,12 @@ import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
|
|
@ -19,25 +19,25 @@ import org.hl7.fhir.r5.conformance.profile.BindingResolution;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
|
import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.AllowUnknownProfile;
|
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.AllowUnknownProfile;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.ExpressionNode.CollectionStatus;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
import org.hl7.fhir.r5.formats.XmlParser;
|
import org.hl7.fhir.r5.formats.XmlParser;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
|
|
@ -34,6 +34,10 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IEvaluationContext;
|
||||||
|
import org.hl7.fhir.r5.fhirpath.FHIRPathUtilityClasses.FunctionDetails;
|
||||||
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
||||||
import org.hl7.fhir.r5.elementmodel.SHLParser;
|
import org.hl7.fhir.r5.elementmodel.SHLParser;
|
||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
|
@ -49,12 +53,8 @@ import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
||||||
import org.hl7.fhir.r5.model.Patient;
|
import org.hl7.fhir.r5.model.Patient;
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.TypeDetails;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|
||||||
import org.hl7.fhir.r5.utils.OperationOutcomeUtilities;
|
import org.hl7.fhir.r5.utils.OperationOutcomeUtilities;
|
||||||
import org.hl7.fhir.r5.utils.validation.BundleValidationRule;
|
import org.hl7.fhir.r5.utils.validation.BundleValidationRule;
|
||||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||||
|
|
|
@ -1643,7 +1643,6 @@ v: {
|
||||||
"code" : "NZ",
|
"code" : "NZ",
|
||||||
"system" : "urn:iso:std:iso:3166",
|
"system" : "urn:iso:std:iso:3166",
|
||||||
"version" : "2018",
|
"version" : "2018",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1664,7 +1663,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#26643006' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#26643006' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1685,7 +1683,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#767525000' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#767525000' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1706,7 +1703,6 @@ v: {
|
||||||
"code" : "237599002",
|
"code" : "237599002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1727,7 +1723,6 @@ v: {
|
||||||
"code" : "1201005",
|
"code" : "1201005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1748,7 +1743,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#109081006' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#109081006' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1769,7 +1763,6 @@ v: {
|
||||||
"code" : "5913000",
|
"code" : "5913000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1790,7 +1783,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#292954005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#292954005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1811,7 +1803,6 @@ v: {
|
||||||
"code" : "52910006",
|
"code" : "52910006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1832,7 +1823,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#428673006' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#428673006' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1853,7 +1843,6 @@ v: {
|
||||||
"code" : "265132005",
|
"code" : "265132005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1874,7 +1863,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#7947003' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#7947003' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1895,7 +1883,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#81464008' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#81464008' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1916,7 +1903,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#48546005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#48546005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1937,7 +1923,6 @@ v: {
|
||||||
"code" : "40425004",
|
"code" : "40425004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1958,7 +1943,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#158965000' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#158965000' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -1979,7 +1963,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#96309000' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#96309000' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2000,7 +1983,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#714081009' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#714081009' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2021,7 +2003,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#25246002' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#25246002' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2042,7 +2023,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#96067005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#96067005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2063,7 +2043,6 @@ v: {
|
||||||
"code" : "90560007",
|
"code" : "90560007",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2084,7 +2063,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#34206005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#34206005' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2105,7 +2083,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#108537001' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#108537001' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2126,7 +2103,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#126212009' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#126212009' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2147,7 +2123,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#292360004' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#292360004' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2168,7 +2143,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#16217701000119102' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#16217701000119102' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -2189,6 +2163,26 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://snomed.info/sct",
|
||||||
|
"code" : "16076005"
|
||||||
|
}, "valueSet" :http://terminology.hl7.org/ValueSet/snomed-intl-ips, "langs":"en, en-US", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"true", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "The provided code 'http://snomed.info/sct#16076005' was not found in the value set 'http://terminology.hl7.org/ValueSet/snomed-intl-ips|20211027' (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
"unknown-systems" : "",
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
|
|
|
@ -7109,7 +7109,6 @@ v: {
|
||||||
"code" : "8310-5",
|
"code" : "8310-5",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -7131,7 +7130,6 @@ v: {
|
||||||
"code" : "9279-1",
|
"code" : "9279-1",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -7154,7 +7152,6 @@ v: {
|
||||||
"code" : "9279-1",
|
"code" : "9279-1",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -7176,7 +7173,6 @@ v: {
|
||||||
"code" : "9279-1",
|
"code" : "9279-1",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -7198,7 +7194,6 @@ v: {
|
||||||
"code" : "LA15920-4",
|
"code" : "LA15920-4",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -7221,7 +7216,6 @@ v: {
|
||||||
"code" : "LA15920-4",
|
"code" : "LA15920-4",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -7243,6 +7237,204 @@ v: {
|
||||||
"code" : "LA15920-4",
|
"code" : "LA15920-4",
|
||||||
"system" : "http://loinc.org",
|
"system" : "http://loinc.org",
|
||||||
"version" : "2.74",
|
"version" : "2.74",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "47519-4",
|
||||||
|
"display" : "History of Procedures"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'History of Procedures' for http://loinc.org#47519-4 - should be one of 40 choices: 'History of Procedures Document', 'Procedures Hx Doc', '临床文档型' (zh-CN), '临床文档' (zh-CN), '文档' (zh-CN), '文书' (zh-CN), '医疗文书' (zh-CN), '临床医疗文书 事件发生的地方' (zh-CN), '场景' (zh-CN), '环境' (zh-CN), '背景 历史纪录与体格检查 历史纪录与体格检查.历史记录' (zh-CN), '历史纪录与体格检查.历史记录类' (zh-CN), '历史纪录与体格检查.历史记录类别' (zh-CN), '历史纪录与体格检查.病史' (zh-CN), '历史纪录与体格检查.病史类' (zh-CN), '历史纪录与体格检查.病史类别' (zh-CN), '历史纪录与体格检查.病史记录' (zh-CN), '历史纪录与体格检查.病史记录类' (zh-CN), '历史纪录与体格检查.病史记录类别' (zh-CN), '历史纪录与体格检查小节.历史记录' (zh-CN), '历史纪录与体格检查小节.历史记录类' (zh-CN), '历史纪录与体格检查小节.历史记录类别' (zh-CN), '历史纪录与体格检查小节.病史' (zh-CN), '历史纪录与体格检查小节.病史类' (zh-CN), '历史纪录与体格检查小节.病史类别 历史纪录与体格检查小节 发现是一个原子型临床观察指标,并不是作为印象的概括陈述。体格检查、病史、系统检查及其他此类观察指标的属性均为发现。它们的标尺对于编码型发现可能是名义型,而对于叙述型文本之中所报告的发现,则可能是叙述型。' (zh-CN), '发现物' (zh-CN), '所见' (zh-CN), '结果' (zh-CN), '结论 操作历史' (zh-CN), '操作项目历史' (zh-CN), '操作项目史 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 未加明确说明的角色 病史与体格检查' (zh-CN), 'Procedures Hx' (pt-BR), 'Finding' (pt-BR), 'Findings' (pt-BR), 'Point in time' (pt-BR), 'Random' (pt-BR) or 'Anamnesi Osservazione Punto nel tempo (episodio) Ruolo non specificato' (it-IT) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "46240-8",
|
||||||
|
"display" : "Medical Devices"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'Medical Devices' for http://loinc.org#46240-8 - should be one of 55 choices: 'History of Hospitalizations+Outpatient visits Narrative', 'Hx of Hospitalizations+OP visits', '住院治疗历史+门诊就诊历史' (zh-CN), '住院治疗史+门诊就医史' (zh-CN), '住院治疗史+门诊患者就诊史' (zh-CN), '住院治疗史+门诊病人就诊史 医疗服务对象' (zh-CN), '客户' (zh-CN), '病人' (zh-CN), '病患' (zh-CN), '病号' (zh-CN), '超系统 - 病人 医院收容' (zh-CN), '入院' (zh-CN), '住院期' (zh-CN), '收治入院 历史' (zh-CN), '史' (zh-CN), '病史 历史纪录与体格检查 历史纪录与体格检查.历史记录' (zh-CN), '历史纪录与体格检查.历史记录类' (zh-CN), '历史纪录与体格检查.历史记录类别' (zh-CN), '历史纪录与体格检查.病史' (zh-CN), '历史纪录与体格检查.病史类' (zh-CN), '历史纪录与体格检查.病史类别' (zh-CN), '历史纪录与体格检查.病史记录' (zh-CN), '历史纪录与体格检查.病史记录类' (zh-CN), '历史纪录与体格检查.病史记录类别' (zh-CN), '历史纪录与体格检查小节.历史记录' (zh-CN), '历史纪录与体格检查小节.历史记录类' (zh-CN), '历史纪录与体格检查小节.历史记录类别' (zh-CN), '历史纪录与体格检查小节.病史' (zh-CN), '历史纪录与体格检查小节.病史类' (zh-CN), '历史纪录与体格检查小节.病史类别 历史纪录与体格检查小节 叙述' (zh-CN), '叙述性文字' (zh-CN), '报告' (zh-CN), '报告型' (zh-CN), '文字叙述' (zh-CN), '文本叙述型' (zh-CN), '文本描述' (zh-CN), '文本描述型 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 病史与体格检查 门诊就诊类(就诊、就诊过程类、就诊过程、就医过程类、就医类、就医过程、就医)' (zh-CN), '门诊就诊类' (zh-CN), 'Outpatient visits Hx' (pt-BR), 'Hospitalizations+OP visits Hx' (pt-BR), 'Hospitalizations Hx' (pt-BR), 'Finding' (pt-BR), 'Findings' (pt-BR), 'Point in time' (pt-BR), 'Random' (pt-BR), 'Narrative' (pt-BR), 'Report' (pt-BR), 'Anamnesi paziente Punto nel tempo (episodio) Storia' (it-IT), 'Anamnesi visite paziente ambulatoriale' (it-IT), 'Анамнез госпитализаций+Анамнез амбулаторных посещений История Описательный Точка во времени' (ru-RU), 'Момент' (ru-RU) or 'anamnese' (nl-NL) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "30954-2",
|
||||||
|
"display" : "Diagnostic Results"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'Diagnostic Results' for http://loinc.org#30954-2 - should be one of 42 choices: 'Relevant diagnostic tests/laboratory data Narrative', 'Relevant Dx tests/lab data', '医疗服务对象' (zh-CN), '客户' (zh-CN), '病人' (zh-CN), '病患' (zh-CN), '病号' (zh-CN), '超系统 - 病人 发现是一个原子型临床观察指标,并不是作为印象的概括陈述。体格检查、病史、系统检查及其他此类观察指标的属性均为发现。它们的标尺对于编码型发现可能是名义型,而对于叙述型文本之中所报告的发现,则可能是叙述型。' (zh-CN), '发现物' (zh-CN), '所见' (zh-CN), '结果' (zh-CN), '结论 叙述' (zh-CN), '叙述性文字' (zh-CN), '报告' (zh-CN), '报告型' (zh-CN), '文字叙述' (zh-CN), '文本叙述型' (zh-CN), '文本描述' (zh-CN), '文本描述型 接种' (zh-CN), '接种记录' (zh-CN), '疫苗' (zh-CN), '疫苗接种 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 检验科' (zh-CN), '化验室' (zh-CN), '化验科 相关诊断试验/实验室数据' (zh-CN), '相关诊断试验和或实验室资料' (zh-CN), '相关诊断试验和或实验室检验数据' (zh-CN), '相关诊断试验和或检验数据' (zh-CN), '相关诊断试验和或化验数据' (zh-CN), 'Relevant Dx tests/lAc data' (pt-BR), 'Finding' (pt-BR), 'Findings' (pt-BR), 'Point in time' (pt-BR), 'Random' (pt-BR), 'Narrative' (pt-BR), 'Report' (pt-BR), 'VACCINE' (pt-BR), 'Osservazione paziente Punto nel tempo (episodio) Test diagnostici rilevanti/dati di laboratorio Vaccinazioni' (it-IT), 'Описательный Точка во времени' (ru-RU) or 'Момент' (ru-RU) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "8716-3",
|
||||||
|
"display" : "Vital Signs"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"display" : "Vital signs",
|
||||||
|
"code" : "8716-3",
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"version" : "2.74",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "10162-6",
|
||||||
|
"display" : "Pregnancy Information"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'Pregnancy Information' for http://loinc.org#10162-6 - should be one of 39 choices: 'History of pregnancies Narrative', 'Pregnancies Hx', '历史' (zh-CN), '史' (zh-CN), '病史 历史纪录与体格检查 历史纪录与体格检查.历史记录' (zh-CN), '历史纪录与体格检查.历史记录类' (zh-CN), '历史纪录与体格检查.历史记录类别' (zh-CN), '历史纪录与体格检查.病史' (zh-CN), '历史纪录与体格检查.病史类' (zh-CN), '历史纪录与体格检查.病史类别' (zh-CN), '历史纪录与体格检查.病史记录' (zh-CN), '历史纪录与体格检查.病史记录类' (zh-CN), '历史纪录与体格检查.病史记录类别' (zh-CN), '历史纪录与体格检查小节.历史记录' (zh-CN), '历史纪录与体格检查小节.历史记录类' (zh-CN), '历史纪录与体格检查小节.历史记录类别' (zh-CN), '历史纪录与体格检查小节.病史' (zh-CN), '历史纪录与体格检查小节.病史类' (zh-CN), '历史纪录与体格检查小节.病史类别 历史纪录与体格检查小节 叙述' (zh-CN), '叙述性文字' (zh-CN), '报告' (zh-CN), '报告型' (zh-CN), '文字叙述' (zh-CN), '文本叙述型' (zh-CN), '文本描述' (zh-CN), '文本描述型 怀孕' (zh-CN), '怀孕期' (zh-CN), '妊娠期' (zh-CN), '妊娠类' (zh-CN), '妊娠(复数) 怀孕史' (zh-CN), '妊娠历史 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 病史与体格检查' (zh-CN), 'Anamnesi Apparato riproduttore Punto nel tempo (episodio) Storia' (it-IT), 'Anamnesi' (it-IT), 'Акушерский анамнез История Описательный Точка во времени' (ru-RU), 'Момент' (ru-RU) or 'anamnese' (nl-NL) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "11348-0",
|
||||||
|
"display" : "History of Past Illness"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'History of Past Illness' for http://loinc.org#11348-0 - should be one of 40 choices: 'History of Past illness Narrative', 'Hx of Past illness', '医疗服务对象' (zh-CN), '客户' (zh-CN), '病人' (zh-CN), '病患' (zh-CN), '病号' (zh-CN), '超系统 - 病人 历史' (zh-CN), '史' (zh-CN), '病史 历史纪录与体格检查 历史纪录与体格检查.历史记录' (zh-CN), '历史纪录与体格检查.历史记录类' (zh-CN), '历史纪录与体格检查.历史记录类别' (zh-CN), '历史纪录与体格检查.病史' (zh-CN), '历史纪录与体格检查.病史类' (zh-CN), '历史纪录与体格检查.病史类别' (zh-CN), '历史纪录与体格检查.病史记录' (zh-CN), '历史纪录与体格检查.病史记录类' (zh-CN), '历史纪录与体格检查.病史记录类别' (zh-CN), '历史纪录与体格检查小节.历史记录' (zh-CN), '历史纪录与体格检查小节.历史记录类' (zh-CN), '历史纪录与体格检查小节.历史记录类别' (zh-CN), '历史纪录与体格检查小节.病史' (zh-CN), '历史纪录与体格检查小节.病史类' (zh-CN), '历史纪录与体格检查小节.病史类别 历史纪录与体格检查小节 叙述' (zh-CN), '叙述性文字' (zh-CN), '报告' (zh-CN), '报告型' (zh-CN), '文字叙述' (zh-CN), '文本叙述型' (zh-CN), '文本描述' (zh-CN), '文本描述型 既往疾病史' (zh-CN), '既往疾病历史 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 病史与体格检查' (zh-CN), 'Anamnesi Malattie passate paziente Punto nel tempo (episodio) Storia' (it-IT), 'Anamnesi' (it-IT), 'Анамнез заболеваний История Описательный Точка во времени' (ru-RU), 'Момент' (ru-RU) or 'anamnese' (nl-NL) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "47420-5",
|
||||||
|
"display" : "Functional Status"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'Functional Status' for http://loinc.org#47420-5 - should be one of 39 choices: 'Functional status assessment note', 'Functional status note', '临床文档型' (zh-CN), '临床文档' (zh-CN), '文档' (zh-CN), '文书' (zh-CN), '医疗文书' (zh-CN), '临床医疗文书 事件发生的地方' (zh-CN), '场景' (zh-CN), '环境' (zh-CN), '背景 功能(机能)状态(状况、情况)(评价、估计、估价、评论、估定、估算)记录' (zh-CN), '功能状况评估记录' (zh-CN), '功能情况评估记录 功能状况' (zh-CN), '功能情况 发现是一个原子型临床观察指标,并不是作为印象的概括陈述。体格检查、病史、系统检查及其他此类观察指标的属性均为发现。它们的标尺对于编码型发现可能是名义型,而对于叙述型文本之中所报告的发现,则可能是叙述型。' (zh-CN), '发现物' (zh-CN), '所见' (zh-CN), '结果' (zh-CN), '结论 文档本体' (zh-CN), '临床文档本体' (zh-CN), '文档本体' (zh-CN), '文书本体' (zh-CN), '医疗文书本体' (zh-CN), '临床医疗文书本体 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 未加明确说明的角色 状况' (zh-CN), '情况 笔记' (zh-CN), '按语' (zh-CN), '注释' (zh-CN), '说明' (zh-CN), '票据' (zh-CN), '单据' (zh-CN), '证明书 评价' (zh-CN), '估计' (zh-CN), '估价' (zh-CN), '评论' (zh-CN), '估定' (zh-CN), '估算' (zh-CN) or 'Documentazione dell'ontologia Nota di valutazione dello stato funzionale Osservazione Punto nel tempo (episodio) Ruolo non specificato' (it-IT) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "18776-5",
|
||||||
|
"display" : "Plan of Care"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Wrong Display Name 'Plan of Care' for http://loinc.org#18776-5 - should be one of 30 choices: 'Plan of care note', 'Plan of care note', '临床文档型' (zh-CN), '临床文档' (zh-CN), '文档' (zh-CN), '文书' (zh-CN), '医疗文书' (zh-CN), '临床医疗文书 事件发生的地方' (zh-CN), '场景' (zh-CN), '环境' (zh-CN), '背景 医疗服务(照护服务、护理服务、护理、照护、医疗照护、诊疗、诊疗服务、照顾、看护)计划(方案)记录 发现是一个原子型临床观察指标,并不是作为印象的概括陈述。体格检查、病史、系统检查及其他此类观察指标的属性均为发现。它们的标尺对于编码型发现可能是名义型,而对于叙述型文本之中所报告的发现,则可能是叙述型。' (zh-CN), '发现物' (zh-CN), '所见' (zh-CN), '结果' (zh-CN), '结论 文档本体' (zh-CN), '临床文档本体' (zh-CN), '文档本体' (zh-CN), '文书本体' (zh-CN), '医疗文书本体' (zh-CN), '临床医疗文书本体 时刻' (zh-CN), '随机' (zh-CN), '随意' (zh-CN), '瞬间 未加明确说明的角色 笔记' (zh-CN), '按语' (zh-CN), '注释' (zh-CN), '说明' (zh-CN), '票据' (zh-CN), '单据' (zh-CN), '证明书' (zh-CN) or 'Documentazione dell'ontologia Osservazione Piano di cura Punto nel tempo (episodio) Ruolo non specificato' (it-IT) (for the language(s) '--') (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
|
"unknown-systems" : "",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://loinc.org",
|
||||||
|
"code" : "42349-0",
|
||||||
|
"display" : "Advance Directives"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"severity" : "error",
|
||||||
|
"error" : "Unknown Code '42349-0' in the system 'http://loinc.org|2.74'; The provided code 'http://loinc.org#42349-0' was not found in the value set 'http://hl7.org/fhir/ValueSet/@all' (from Tx-Server)",
|
||||||
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
"unknown-systems" : "",
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
|
|
|
@ -4922,7 +4922,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#96067005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-intolerance-substance-condition-uv-ips--0|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#96067005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-intolerance-substance-condition-uv-ips--0|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -4944,7 +4943,6 @@ v: {
|
||||||
"code" : "96067005",
|
"code" : "96067005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -4967,7 +4965,6 @@ v: {
|
||||||
"code" : "96067005",
|
"code" : "96067005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -4989,7 +4986,6 @@ v: {
|
||||||
"code" : "96067005",
|
"code" : "96067005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5010,7 +5006,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#292954005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-reaction-snomed-ct-ips-free-set--0|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#292954005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-reaction-snomed-ct-ips-free-set--0|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5033,7 +5028,6 @@ v: {
|
||||||
"code" : "292954005",
|
"code" : "292954005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5054,7 +5048,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#48546005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-intolerance-substance-condition-uv-ips--0|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#48546005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-intolerance-substance-condition-uv-ips--0|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5076,7 +5069,6 @@ v: {
|
||||||
"code" : "48546005",
|
"code" : "48546005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5099,7 +5091,6 @@ v: {
|
||||||
"code" : "48546005",
|
"code" : "48546005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5121,7 +5112,6 @@ v: {
|
||||||
"code" : "48546005",
|
"code" : "48546005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5142,7 +5132,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#292360004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-reaction-snomed-ct-ips-free-set--0|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#292360004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/allergy-reaction-snomed-ct-ips-free-set--0|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5165,7 +5154,6 @@ v: {
|
||||||
"code" : "292360004",
|
"code" : "292360004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5187,7 +5175,6 @@ v: {
|
||||||
"code" : "40425004",
|
"code" : "40425004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5210,7 +5197,6 @@ v: {
|
||||||
"code" : "40425004",
|
"code" : "40425004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5232,7 +5218,6 @@ v: {
|
||||||
"code" : "40425004",
|
"code" : "40425004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5254,7 +5239,6 @@ v: {
|
||||||
"code" : "237599002",
|
"code" : "237599002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5277,7 +5261,6 @@ v: {
|
||||||
"code" : "237599002",
|
"code" : "237599002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5299,7 +5282,6 @@ v: {
|
||||||
"code" : "237599002",
|
"code" : "237599002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5321,7 +5303,6 @@ v: {
|
||||||
"code" : "90560007",
|
"code" : "90560007",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5344,7 +5325,6 @@ v: {
|
||||||
"code" : "90560007",
|
"code" : "90560007",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5366,7 +5346,6 @@ v: {
|
||||||
"code" : "90560007",
|
"code" : "90560007",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5388,7 +5367,6 @@ v: {
|
||||||
"code" : "1201005",
|
"code" : "1201005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5411,7 +5389,6 @@ v: {
|
||||||
"code" : "1201005",
|
"code" : "1201005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5433,7 +5410,6 @@ v: {
|
||||||
"code" : "1201005",
|
"code" : "1201005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5455,7 +5431,6 @@ v: {
|
||||||
"code" : "52910006",
|
"code" : "52910006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5478,7 +5453,6 @@ v: {
|
||||||
"code" : "52910006",
|
"code" : "52910006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5500,7 +5474,6 @@ v: {
|
||||||
"code" : "52910006",
|
"code" : "52910006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5522,7 +5495,6 @@ v: {
|
||||||
"code" : "5913000",
|
"code" : "5913000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5545,7 +5517,6 @@ v: {
|
||||||
"code" : "5913000",
|
"code" : "5913000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5567,7 +5538,6 @@ v: {
|
||||||
"code" : "5913000",
|
"code" : "5913000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5589,7 +5559,6 @@ v: {
|
||||||
"code" : "126212009",
|
"code" : "126212009",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5610,7 +5579,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#126212009' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#126212009' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5633,7 +5601,6 @@ v: {
|
||||||
"code" : "126212009",
|
"code" : "126212009",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5655,7 +5622,6 @@ v: {
|
||||||
"code" : "126212009",
|
"code" : "126212009",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5678,7 +5644,6 @@ v: {
|
||||||
"code" : "34206005",
|
"code" : "34206005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5700,7 +5665,6 @@ v: {
|
||||||
"code" : "767525000",
|
"code" : "767525000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5722,7 +5686,6 @@ v: {
|
||||||
"code" : "714081009",
|
"code" : "714081009",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5743,7 +5706,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#714081009' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#714081009' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5766,7 +5728,6 @@ v: {
|
||||||
"code" : "714081009",
|
"code" : "714081009",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5788,7 +5749,6 @@ v: {
|
||||||
"code" : "714081009",
|
"code" : "714081009",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5810,7 +5770,6 @@ v: {
|
||||||
"code" : "109081006",
|
"code" : "109081006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5831,7 +5790,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#109081006' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#109081006' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5854,7 +5812,6 @@ v: {
|
||||||
"code" : "109081006",
|
"code" : "109081006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5876,7 +5833,6 @@ v: {
|
||||||
"code" : "109081006",
|
"code" : "109081006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5899,7 +5855,6 @@ v: {
|
||||||
"code" : "26643006",
|
"code" : "26643006",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5921,7 +5876,6 @@ v: {
|
||||||
"code" : "108537001",
|
"code" : "108537001",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5942,7 +5896,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#108537001' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#108537001' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5965,7 +5918,6 @@ v: {
|
||||||
"code" : "108537001",
|
"code" : "108537001",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -5987,7 +5939,6 @@ v: {
|
||||||
"code" : "108537001",
|
"code" : "108537001",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6009,7 +5960,6 @@ v: {
|
||||||
"code" : "96309000",
|
"code" : "96309000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6030,7 +5980,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#96309000' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#96309000' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6053,7 +6002,6 @@ v: {
|
||||||
"code" : "96309000",
|
"code" : "96309000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6075,7 +6023,6 @@ v: {
|
||||||
"code" : "96309000",
|
"code" : "96309000",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6097,7 +6044,6 @@ v: {
|
||||||
"code" : "7947003",
|
"code" : "7947003",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6118,7 +6064,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#7947003' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#7947003' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6141,7 +6086,6 @@ v: {
|
||||||
"code" : "7947003",
|
"code" : "7947003",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6163,7 +6107,6 @@ v: {
|
||||||
"code" : "7947003",
|
"code" : "7947003",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6185,7 +6128,6 @@ v: {
|
||||||
"code" : "25246002",
|
"code" : "25246002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6206,7 +6148,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#25246002' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#25246002' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/medication-snomed-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6229,7 +6170,6 @@ v: {
|
||||||
"code" : "25246002",
|
"code" : "25246002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6251,7 +6191,6 @@ v: {
|
||||||
"code" : "25246002",
|
"code" : "25246002",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6273,7 +6212,6 @@ v: {
|
||||||
"code" : "16217701000119102",
|
"code" : "16217701000119102",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6296,7 +6234,6 @@ v: {
|
||||||
"code" : "16217701000119102",
|
"code" : "16217701000119102",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6318,7 +6255,6 @@ v: {
|
||||||
"code" : "16217701000119102",
|
"code" : "16217701000119102",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6340,7 +6276,6 @@ v: {
|
||||||
"code" : "265132005",
|
"code" : "265132005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6361,7 +6296,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6382,7 +6316,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--2|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--2|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6403,7 +6336,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--3|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--3|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6424,7 +6356,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--4|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--4|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6445,7 +6376,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--5|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--5|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6466,7 +6396,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--6|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--6|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6487,7 +6416,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--7|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--7|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6508,7 +6436,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--8|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#265132005' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--8|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6531,7 +6458,6 @@ v: {
|
||||||
"code" : "265132005",
|
"code" : "265132005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6553,7 +6479,6 @@ v: {
|
||||||
"code" : "265132005",
|
"code" : "265132005",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6575,7 +6500,6 @@ v: {
|
||||||
"code" : "287903004",
|
"code" : "287903004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230131",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6596,7 +6520,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--1|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--1|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6617,7 +6540,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--2|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--2|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6638,7 +6560,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--3|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--3|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6659,7 +6580,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--4|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--4|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6680,7 +6600,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--5|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--5|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6701,7 +6620,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--6|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--6|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6722,7 +6640,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--7|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--7|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6743,7 +6660,6 @@ v: {
|
||||||
"severity" : "error",
|
"severity" : "error",
|
||||||
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--8|1.1.0' (from Tx-Server)",
|
"error" : "The provided code 'http://snomed.info/sct#287903004' is not in the value set 'http://hl7.org/fhir/uv/ips/ValueSet/procedures-uv-ips--8|1.1.0' (from Tx-Server)",
|
||||||
"class" : "UNKNOWN",
|
"class" : "UNKNOWN",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6766,7 +6682,6 @@ v: {
|
||||||
"code" : "287903004",
|
"code" : "287903004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6788,7 +6703,6 @@ v: {
|
||||||
"code" : "287903004",
|
"code" : "287903004",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
"unknown-systems" : "",
|
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
}
|
}
|
||||||
|
@ -6811,6 +6725,28 @@ v: {
|
||||||
"code" : "81464008",
|
"code" : "81464008",
|
||||||
"system" : "http://snomed.info/sct",
|
"system" : "http://snomed.info/sct",
|
||||||
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230731",
|
||||||
|
"issues" : {
|
||||||
|
"resourceType" : "OperationOutcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
{"code" : {
|
||||||
|
"system" : "http://snomed.info/sct",
|
||||||
|
"code" : "16076005",
|
||||||
|
"display" : "Prescription (procedure)"
|
||||||
|
}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
|
||||||
|
"resourceType" : "Parameters",
|
||||||
|
"parameter" : [{
|
||||||
|
"name" : "profile-url",
|
||||||
|
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
|
||||||
|
}]
|
||||||
|
}}####
|
||||||
|
v: {
|
||||||
|
"display" : "Prescription",
|
||||||
|
"code" : "16076005",
|
||||||
|
"system" : "http://snomed.info/sct",
|
||||||
|
"version" : "http://snomed.info/sct/900000000000207008/version/20230901",
|
||||||
"unknown-systems" : "",
|
"unknown-systems" : "",
|
||||||
"issues" : {
|
"issues" : {
|
||||||
"resourceType" : "OperationOutcome"
|
"resourceType" : "OperationOutcome"
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -20,7 +20,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<guava_version>32.0.1-jre</guava_version>
|
<guava_version>32.0.1-jre</guava_version>
|
||||||
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.4.18</validator_test_case_version>
|
<validator_test_case_version>1.4.19-SNAPSHOT</validator_test_case_version>
|
||||||
<jackson_version>2.15.2</jackson_version>
|
<jackson_version>2.15.2</jackson_version>
|
||||||
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
||||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||||
|
|
Loading…
Reference in New Issue