prepare for 5.1.16 release (#358)

* Ensure "I" flag in profile table representation is not used for underlying infrastructural constraints that exist everywhere

* render multiple values for properties if they exist

* fix for npe

* fix for use of "current" as version

* fix bad package URLs as they are loaded

* RELEASE_NOTES.md

* Add rendering for must support on types, profiles, targets

* Add new validation for must-support on types / profiles / targets + improve extension validation

* add <code> when rendering turtle to HTML

* RELEASE_NOTES.md

* fix notes

* fix rendering problems with languages in value sets

* Change warnings about invalid codes to hints in retired value sets

* Fix bugs loading content to validate from hapi servers

* Fix FHIRPath engine for updated tests for date addition/subtraction

* fix questionnaire mode support for validator

* rename org.hl7.fhir.utilities.cache to org.hl7.fhir.utilities.npm

* update to POM

* refactor FHIRPath to report error locations for run time errors
This commit is contained in:
Grahame Grieve 2020-09-30 23:27:23 +10:00 committed by GitHub
parent 2d46644982
commit 75d5939227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
78 changed files with 1143 additions and 853 deletions

View File

@ -0,0 +1,7 @@
Validator:
* Add date addition/subtraction to FHIRPath
* Fix questionnaire mode parameter support for validator
* add extra debugging when valdiator can't fetch content to validate
Other code changes:
* rename org.hl7.fhir.utilities.cache to org.hl7.fhir.utilities.npm

View File

@ -65,10 +65,10 @@ import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.utils.NPMPackageGenerator;
import org.hl7.fhir.r4.utils.NPMPackageGenerator.Category;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.PackageGenerator.PackageType;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.npm.PackageGenerator.PackageType;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

View File

@ -5,7 +5,7 @@ import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.ElementDefinition;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import java.util.ArrayList;
import java.util.List;

View File

@ -6,7 +6,7 @@ import org.hl7.fhir.r4.model.CanonicalType;
import org.hl7.fhir.r4.model.ElementDefinition;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import java.util.ArrayList;
import java.util.List;

View File

@ -8,7 +8,7 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import com.google.gson.JsonSyntaxException;

View File

@ -55,9 +55,9 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.cache.NpmPackage;
import com.google.gson.JsonSyntaxException;

View File

@ -56,9 +56,9 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.cache.NpmPackage;
import com.google.gson.JsonSyntaxException;

View File

@ -56,9 +56,9 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.cache.NpmPackage;
import com.google.gson.JsonSyntaxException;

View File

@ -56,9 +56,9 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.cache.NpmPackage;
import com.google.gson.JsonSyntaxException;

View File

@ -55,9 +55,9 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.cache.NpmPackage;
import com.google.gson.JsonSyntaxException;

View File

@ -35,30 +35,31 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode;
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
import org.hl7.fhir.dstu3.utils.ToolingExtensions;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.r4.formats.XmlParser;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode;
import org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r4.model.CodeSystem.PropertyType;
import org.hl7.fhir.r4.model.DateTimeType;
import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r4.utils.ToolingExtensions;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r4.formats.JsonParser;
import org.hl7.fhir.utilities.CSVReader;
import org.hl7.fhir.utilities.Utilities;
public class NUCCConvertor {
private String[] last = new String[2];
private ConceptDefinitionComponent[] concepts = new ConceptDefinitionComponent[2];
public static void main(String[] args) throws Exception {
new NUCCConvertor().execute();
}
public void execute() throws IOException, FHIRException {
public void execute() throws IOException, FHIRException {
CSVReader csv = new CSVReader(new FileInputStream("c:\\temp\\nucc.csv"));
CodeSystem cs = new CodeSystem();
cs.setId("nucc-provider-taxonomy");
@ -66,50 +67,41 @@ public class NUCCConvertor {
cs.setName("NUCC Provider Taxonomy");
cs.setDateElement(new DateTimeType());
cs.setDescription("The Health Care Provider Taxonomy code is a unique alphanumeric code, ten characters in length. The code set is structured into three distinct 'Levels' including Provider Type, Classification, and Area of Specialization");
cs.setCopyright("See NUCC copyright statement");
cs.setCopyright("Vendors must request a license to include this in a product per the following: 'Vendors interested in incorporating the Health Care Provider Taxonomy code set into their commercial products must complete the license request form found on the CSV page.' Using the form at the url listed. The preamble is reproduced below: http://www.nucc.org/index.php?option=com_content&view=article&id=111&Itemid=110");
cs.setStatus(PublicationStatus.ACTIVE);
cs.setContent(CodeSystemContentMode.COMPLETE);
cs.setExperimental(false);
cs.setValueSet("http://hl7.org/fhir/ValueSet/nucc-provider-taxonomy");
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
cs.addProperty().setCode("grouping").setType(PropertyType.STRING).setDescription("A major grouping of service(s) or occupation(s) of health care providers. For example: Allopathic & Osteopathic Physicians, Dental Providers, Hospitals, etc");
cs.addProperty().setCode("classification").setType(PropertyType.STRING).setDescription("A more specific service or occupation related to the Provider Grouping.e");
cs.addProperty().setCode("specialization").setType(PropertyType.STRING).setDescription("A more specialized area of the Classification in which a provider chooses to practice or make services available.");
csv.parseLine();
while (csv.ready())
{
while (csv.ready()) {
String[] values = csv.parseLine();
processLine(cs, values);
}
csv.close();
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.xml"), cs);
cs.sort();
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.json"), cs);
}
private void processLine(CodeSystem cs, String[] values) throws FHIRFormatError {
if (!values[1].equals(last[0])) {
last[1] = "";
last[0] = values[1];
concepts[0] = new ConceptDefinitionComponent();
cs.getConcept().add(concepts[0]);
concepts[0].setDisplay(values[1]);
concepts[0].setCode("base-"+Integer.toString(cs.getConcept().size()));
CodeSystemUtilities.setNotSelectable(cs, concepts[0]);
ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
cs.getConcept().add(cc);
cc.setCode(values[0]);
cc.setDisplay(values[4]);
if (!Utilities.noString(values[1])) {
cc.addProperty().setCode("grouping").setValue(new StringType(values[1]));
}
if (!values[2].equals(last[1])) {
last[1] = values[2];
concepts[1] = new ConceptDefinitionComponent();
concepts[0].getConcept().add(concepts[1]);
concepts[1].setCode(values[0]);
concepts[1].setDisplay(values[2]);
concepts[1].setDefinition(values[4]);
if (values.length > 5 && !Utilities.noString(values[5]))
ToolingExtensions.addCSComment(concepts[1], values[5]);
} else if (!Utilities.noString(values[3])) {
ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
concepts[1].getConcept().add(cc);
cc.setCode(values[0]);
cc.setDisplay(values[3]);
cc.setDefinition(values[4]);
if (values.length > 5 && !Utilities.noString(values[5]))
ToolingExtensions.addCSComment(cc, values[5]);
if (!Utilities.noString(values[2])) {
cc.addProperty().setCode("classification").setValue(new StringType(values[2]));
}
if (!Utilities.noString(values[3])) {
cc.addProperty().setCode("specialization").setValue(new StringType(values[3]));
}
if (values.length > 5 && !Utilities.noString(values[5]))
cc.setDefinition(values[5]);
}
}

View File

@ -33,9 +33,9 @@ import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.NpmPackageIndexBuilder;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackageIndexBuilder;
import com.google.common.base.Charsets;
import com.google.gson.JsonArray;

View File

@ -12,9 +12,9 @@ import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.w3c.dom.Document;
public class OIDBasedValueSetImporter {

View File

@ -19,9 +19,9 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.utilities.CSVReader;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
public class PhinVadsImporter extends OIDBasedValueSetImporter {

View File

@ -6,7 +6,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Map.Entry;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

View File

@ -89,7 +89,7 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.CSFileInputStream;
import org.hl7.fhir.utilities.OIDUtils;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;

View File

@ -79,7 +79,7 @@ import org.hl7.fhir.r4.utils.IResourceValidator;
import org.hl7.fhir.r4.utils.NarrativeGenerator;
import org.hl7.fhir.utilities.CSFileInputStream;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;

View File

@ -939,4 +939,9 @@ public abstract class BaseDateTimeType extends PrimitiveType<Date> {
}
@Override
public String fpValue() {
return "@"+primitiveValue();
}
}

View File

@ -37,6 +37,7 @@ package org.hl7.fhir.r4.model;
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponentSorter;
import org.hl7.fhir.r4.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
@ -5049,6 +5050,30 @@ public class CodeSystem extends MetadataResource {
return null;
}
public class ConceptDefinitionComponentSorter implements Comparator<ConceptDefinitionComponent> {
@Override
public int compare(ConceptDefinitionComponent l, ConceptDefinitionComponent r) {
return l.getCode().compareTo(r.getCode());
}
}
public void sort() {
sort(getConcept(), new ConceptDefinitionComponentSorter());
}
public void sort(List<ConceptDefinitionComponent> list, Comparator<ConceptDefinitionComponent> comp) {
Collections.sort(list, comp);
for (ConceptDefinitionComponent def : list) {
if (def.hasConcept()) {
sort (def.getConcept(), comp);
}
}
}
public void sort(Comparator<ConceptDefinitionComponent> comp) {
sort(getConcept(), comp);
}
// end addition
}

View File

@ -34,6 +34,7 @@ package org.hl7.fhir.r4.model;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
public class ExpressionNode {
@ -41,31 +42,6 @@ public class ExpressionNode {
public enum Kind {
Name, Function, Constant, Group, Unary
}
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,

View File

@ -249,4 +249,7 @@ public abstract class PrimitiveType<T> extends Type implements IPrimitiveType<T>
return StringUtils.isNotBlank(getValueAsString());
}
public String fpValue() {
return primitiveValue();
}
}

View File

@ -67,7 +67,7 @@ public class CodeSystemUtilities {
public static void setNotSelectable(CodeSystem cs, ConceptDefinitionComponent concept) throws FHIRFormatError {
defineNotSelectableProperty(cs);
ConceptPropertyComponent p = getProperty(concept, "notSelectable");
ConceptPropertyComponent p = getProperty(concept, "abstract");
if (p != null)
p.setValue(new BooleanType(true));
else

View File

@ -50,8 +50,8 @@ import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.utilities.CSFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;

View File

@ -34,7 +34,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.ExpressionNode;
import org.hl7.fhir.r4.model.ExpressionNode.SourceLocation;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
// shared lexer for concrete syntaxes

View File

@ -58,8 +58,8 @@ import org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnCom
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.PackageGenerator.PackageType;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.npm.PackageGenerator.PackageType;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

View File

@ -8,8 +8,8 @@ import org.hl7.fhir.r4.elementmodel.Element;
import org.hl7.fhir.r4.elementmodel.Manager;
import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

View File

@ -205,7 +205,7 @@ public class FHIRPathTests {
Assertions.assertTrue(outcome.get(i).equalsDeep(q), String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString()));
} else {
Assertions.assertTrue(outcome.get(i) instanceof PrimitiveType, String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType()));
Assertions.assertEquals(v, ((PrimitiveType) outcome.get(i)).asStringValue(), String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression));
Assertions.assertEquals(v, ((PrimitiveType) outcome.get(i)).fpValue(), String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, ((PrimitiveType) outcome.get(i)).fpValue(), expression));
}
}
}

View File

@ -220,6 +220,7 @@ public class CanonicalResourceManager<T extends CanonicalResource> {
if (enforceUniqueId && map.containsKey(cr.getId())) {
drop(cr.getId());
}
// special case logic for UTG support prior to version 5
if (cr.getPackageInfo() != null && cr.getPackageInfo().getId().startsWith("hl7.terminology")) {
List<CachedCanonicalResource<T>> toDrop = new ArrayList<>();

View File

@ -67,8 +67,8 @@ import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.TranslationServices;
import org.hl7.fhir.utilities.cache.BasePackageCacheManager;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationOptions;

View File

@ -81,11 +81,11 @@ import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.BasePackageCacheManager;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.NpmPackage.PackageResourceInformation;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformation;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;

View File

@ -1006,4 +1006,9 @@ public abstract class BaseDateTimeType extends PrimitiveType<Date> {
}
}
@Override
public String fpValue() {
return "@"+primitiveValue();
}
}

View File

@ -34,6 +34,7 @@ package org.hl7.fhir.r5.model;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
public class ExpressionNode {
@ -41,31 +42,7 @@ public class ExpressionNode {
public enum Kind {
Name, Function, Constant, Group, Unary
}
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,

View File

@ -248,4 +248,8 @@ public abstract class PrimitiveType<T> extends DataType implements IPrimitiveTyp
public boolean hasPrimitiveValue() {
return StringUtils.isNotBlank(getValueAsString());
}
public String fpValue() {
return primitiveValue();
}
}

View File

@ -234,6 +234,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
}
if (doDefinition) {
tr.td().b().tx("Definition");
doLangs = false;
} else {
// if we're not doing definitions and we don't have too many languages, we'll do them in line
if (langs.size() < MAX_LANGS_IN_LINE) {
@ -260,9 +261,9 @@ public class ValueSetRenderer extends TerminologyRenderer {
x.para().b().tx("Additional Language Displays");
t = x.table( "codes");
tr = t.tr();
tdDisp.b().tx("Code");
tr.td().b().tx("Code");
for (String lang : langs) {
tdDisp.b().addText(describeLang(lang));
tr.td().b().addText(describeLang(lang));
}
for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) {
addLanguageRow(c, t, langs);
@ -482,7 +483,6 @@ public class ValueSetRenderer extends TerminologyRenderer {
if ("1.0m".equals(v)) return "Jul 1999";
if ("1.0l".equals(v)) return "Jan 1998";
if ("1.0ja".equals(v)) return "Oct 1997";
return null;
}
@ -662,7 +662,9 @@ public class ValueSetRenderer extends TerminologyRenderer {
td.i().tx("("+mapping.comp.getComment()+")");
}
}
addLangaugesToRow(c, langs, tr);
if (doLangs) {
addLangaugesToRow(c, langs, tr);
}
for (ValueSetExpansionContainsComponent cc : c.getContains()) {
addExpansionRowToTable(t, cc, i+1, doLevel, doSystem, doDefinition, maps, allCS, langs, doLangs);
}

View File

@ -22,8 +22,8 @@ import org.hl7.fhir.utilities.CSFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.tests.BaseTestingUtilities;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -34,7 +34,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.ExpressionNode;
import org.hl7.fhir.r5.model.ExpressionNode.SourceLocation;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
// shared lexer for concrete syntaxes

View File

@ -62,9 +62,9 @@ import org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnCom
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackageIndexBuilder;
import org.hl7.fhir.utilities.cache.PackageGenerator.PackageType;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.NpmPackageIndexBuilder;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.npm.PackageGenerator.PackageType;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

View File

@ -13,8 +13,8 @@ import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

View File

@ -176,6 +176,7 @@ public class FHIRPathTests {
node = fp.parse(expression);
Assertions.assertTrue(fail != TestResultType.SYNTAX, String.format("Expected exception didn't occur parsing %s", expression));
} catch (Exception e) {
System.out.println("Parsing Error: "+e.getMessage());
Assertions.assertTrue(fail == TestResultType.SYNTAX, String.format("Unexpected exception parsing %s: " + e.getMessage(), expression));
}
@ -193,6 +194,7 @@ public class FHIRPathTests {
}
Assertions.assertTrue(fail != TestResultType.SEMANTICS, String.format("Expected exception didn't occur checking %s", expression));
} catch (Exception e) {
System.out.println("Checking Error: "+e.getMessage());
Assertions.assertTrue(fail == TestResultType.SEMANTICS, String.format("Unexpected exception checking %s: " + e.getMessage(), expression));
node = null;
}
@ -203,6 +205,7 @@ public class FHIRPathTests {
outcome = fp.evaluate(res, node);
Assertions.assertTrue(fail == TestResultType.OK, String.format("Expected exception didn't occur executing %s", expression));
} catch (Exception e) {
System.out.println("Execution Error: "+e.getMessage());
Assertions.assertTrue(fail == TestResultType.EXECUTION, String.format("Unexpected exception executing %s: " + e.getMessage(), expression));
node = null;
}
@ -254,11 +257,11 @@ public class FHIRPathTests {
Assertions.assertTrue(outcome.get(i).equalsDeep(q), String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString()));
} else {
Assertions.assertTrue(outcome.get(i) instanceof PrimitiveType, String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType()));
if (!(v.equals(((PrimitiveType) outcome.get(i)).asStringValue()))) {
if (!(v.equals(((PrimitiveType) outcome.get(i)).fpValue()))) {
System.out.println(name);
System.out.println(String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression));
System.out.println(String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, ((PrimitiveType) outcome.get(i)).fpValue(), expression));
}
Assertions.assertEquals(v, ((PrimitiveType) outcome.get(i)).asStringValue(), String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression));
Assertions.assertEquals(v, ((PrimitiveType) outcome.get(i)).fpValue(), String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, ((PrimitiveType) outcome.get(i)).fpValue(), expression));
}
}
}

View File

@ -11,7 +11,7 @@ import java.util.zip.ZipInputStream;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@ -43,9 +43,9 @@ import org.hl7.fhir.r5.utils.IResourceValidator;
import org.hl7.fhir.r5.utils.XVerExtensionManager;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.xml.XMLUtil;

View File

@ -42,9 +42,9 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.hl7.fhir.r5.utils.XVerExtensionManager;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.xml.XMLUtil;

View File

@ -12,8 +12,8 @@ import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@ -11,8 +11,8 @@ import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

View File

@ -1,5 +1,8 @@
package org.hl7.fhir.exceptions;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@ -33,20 +36,62 @@ package org.hl7.fhir.exceptions;
public class PathEngineException extends FHIRException {
private static final long serialVersionUID = 31969342112856390L;
private SourceLocation location;
private String expression;
public PathEngineException() {
super();
}
public PathEngineException(String message, Throwable cause) {
super(message, cause);
}
public PathEngineException(String message, Throwable cause) {
super(message, cause);
}
public PathEngineException(String message) {
super(message);
}
public PathEngineException(String message) {
super(message);
}
public PathEngineException(Throwable cause) {
public PathEngineException(String message, SourceLocation location, String expression, Throwable cause) {
super(message+rep(location, expression), cause);
}
public PathEngineException(String message, SourceLocation location, String expression) {
super(message+rep(location, expression));
}
private static String rep(SourceLocation loc, String expr) {
if (loc != null) {
if (loc.getLine() == 1) {
return " (@char "+loc.getColumn()+")";
} else {
return " (@line "+loc.getLine()+" char "+loc.getColumn()+")";
}
} else if (Utilities.noString(expr)) { // can happen in some contexts...
return " (@~"+expr+")";
} else {
return "";
}
}
public PathEngineException(Throwable cause) {
super(cause);
}
public String getExpression() {
return expression;
}
public void setExpression(String expression) {
this.expression = expression;
}
public SourceLocation getLocation() {
return location;
}
public void setLocation(SourceLocation location) {
this.location = location;
}
}

View File

@ -0,0 +1,27 @@
package org.hl7.fhir.utilities;
public 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);
}
}

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage;
/*
Copyright (c) 2011+, HL7, Inc.

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.exceptions.FHIRException;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
import java.io.File;
import java.io.FileInputStream;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
/*
Copyright (c) 2011+, HL7, Inc.
@ -40,8 +40,8 @@ import org.hl7.fhir.utilities.IniFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.NpmPackage.NpmPackageFolder;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.npm.NpmPackage.NpmPackageFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
import org.hl7.fhir.exceptions.FHIRException;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
/*
Copyright (c) 2011+, HL7, Inc.
@ -61,10 +61,10 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage.PackageResourceInformationSorter;
import org.hl7.fhir.utilities.cache.PackageGenerator.PackageType;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformationSorter;
import org.hl7.fhir.utilities.npm.PackageGenerator.PackageType;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
import java.io.File;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
/*
Copyright (c) 2011+, HL7, Inc.

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
import java.io.File;
import java.io.FileInputStream;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.utilities.cache;
package org.hl7.fhir.utilities.npm;
/*
Copyright (c) 2011+, HL7, Inc.

View File

@ -133,11 +133,11 @@ Terminology_TX_Code_ValueSetMax = No code provided, and a code must be provided
Terminology_TX_Code_ValueSet_Ext = No code provided, and a code should be provided from the value set {0} ({1})
Terminology_TX_Coding_Count = Expected {0} but found {1} coding elements
Terminology_TX_Confirm_1 = Could not confirm that the codes provided are in the value set {0} and a code from this value set is required (class = {1})
Terminology_TX_Confirm_2 = Could not confirm that the codes provided are in the value set {0} and a code should come from this value set unless it has no suitable code (class = {1})
Terminology_TX_Confirm_2 = Could not confirm that the codes provided are in the value set {0} and a code should come from this value set unless it has no suitable code (the validator cannot judge what is suitable) (class = {1})
Terminology_TX_Confirm_3 = Could not confirm that the codes provided are in the value set {0} and a code is recommended to come from this value set (class = {1})
Terminology_TX_Confirm_4a = The code provided ({2}) is not in the value set {0}, and a code from this value set is required: {1}
Terminology_TX_Confirm_4b = The codes provided ({2}) are not in the value set {0}, and a code from this value set is required: {1}
Terminology_TX_Confirm_5 = Could not confirm that the codes provided are in the value set {0}, and a code should come from this value set unless it has no suitable code
Terminology_TX_Confirm_5 = Could not confirm that the codes provided are in the value set {0}, and a code should come from this value set unless it has no suitable code (the validator cannot judge what is suitable)
Terminology_TX_Confirm_6 = Could not confirm that the codes provided are in the value set {0}, and a code is recommended to come from this value set
Terminology_TX_Display_Wrong = Display should be ''{0}''
Terminology_TX_Error_CodeableConcept = Error {0} validating CodeableConcept
@ -148,16 +148,16 @@ Terminology_TX_NoValid_1 = None of the codes provided are in the value set {0} (
Terminology_TX_NoValid_10 = The code provided is not in the maximum value set {0} ({1}), and a code from this value set is required) (code = {2}#{3})
Terminology_TX_NoValid_11 = The code provided is not in the maximum value set {0} ({1}{2})
Terminology_TX_NoValid_12 = The Coding provided ({2}) is not in the value set {0}, and a code is required from this value set. {1}
Terminology_TX_NoValid_13 = The Coding provided ({2}) is not in the value set {0}, and a code should come from this value set unless it has no suitable code. {1}
Terminology_TX_NoValid_13 = The Coding provided ({2}) is not in the value set {0}, and a code should come from this value set unless it has no suitable code (the validator cannot judge what is suitable). {1}
Terminology_TX_NoValid_14 = The Coding provided ({2}) is not in the value set {0}, and a code is recommended to come from this value set. {1}
Terminology_TX_NoValid_15 = The value provided (''{0}'') could not be validated in the absence of a terminology server
Terminology_TX_NoValid_16 = The value provided (''{0}'') is not in the value set {1} ({2}), and a code is required from this value set){3}
Terminology_TX_NoValid_17 = The value provided (''{0}'') is not in the value set {1} ({2}), and a code should come from this value set unless it has no suitable code){3}
Terminology_TX_NoValid_17 = The value provided (''{0}'') is not in the value set {1} ({2}), and a code should come from this value set unless it has no suitable code and the validator cannot judge what is suitable){3}
Terminology_TX_NoValid_18 = The value provided (''{0}'') is not in the value set {1} ({2}), and a code is recommended to come from this value set){3}
Terminology_TX_NoValid_2 = None of the codes provided are in the value set {0} ({1}), and a code should come from this value set unless it has no suitable code) (codes = {2})
Terminology_TX_NoValid_2 = None of the codes provided are in the value set {0} ({1}), and a code should come from this value set unless it has no suitable code and the validator cannot judge what is suitable) (codes = {2})
Terminology_TX_NoValid_3 = None of the codes provided are in the value set {0} ({1}), and a code is recommended to come from this value set) (codes = {2})
Terminology_TX_NoValid_4 = The Coding provided ({2}) is not in the value set {0}, and a code is required from this value set {1}
Terminology_TX_NoValid_5 = The Coding provided ({2}) is not in the value set {0}, and a code should come from this value set unless it has no suitable code {1}
Terminology_TX_NoValid_5 = The Coding provided ({2}) is not in the value set {0}, and a code should come from this value set unless it has no suitable code (the validator cannot judge what is suitable) {1}
Terminology_TX_NoValid_6 = The Coding provided ({2}) is not in the value set {0}, and a code is recommended to come from this value set {1}
Terminology_TX_NoValid_7 = None of the codes provided could be validated against the maximum value set {0} ({1}), (error = {2})
Terminology_TX_NoValid_8 = None of the codes provided are in the maximum value set {0} ({1}), and a code from this value set is required) (codes = {2})

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.utilities.tests;
import org.hl7.fhir.utilities.cache.CachingPackageClient;
import org.hl7.fhir.utilities.cache.PackageClient.PackageInfo;
import org.hl7.fhir.utilities.npm.CachingPackageClient;
import org.hl7.fhir.utilities.npm.PackageClient.PackageInfo;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@ -1,9 +1,9 @@
package org.hl7.fhir.utilities.tests;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@ -529,6 +529,21 @@ public class BaseValidator {
return thePass;
}
/**
* Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
*
* @param thePass
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
protected boolean warningOrHint(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, boolean warning, String msg, Object... theMessageArguments) {
if (!thePass) {
String message = context.formatMessage(msg, theMessageArguments);
addValidationMessage(errors, type, -1, -1, path, message, warning ? IssueSeverity.WARNING : IssueSeverity.INFORMATION, null);
}
return thePass;
}
/**
* Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
*

View File

@ -34,7 +34,13 @@ import org.hl7.fhir.r5.utils.*;
import org.hl7.fhir.r5.utils.IResourceValidator.*;
import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.PackageClient;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.validation.BaseValidator.ValidationControl;
import org.hl7.fhir.validation.Validator.QuestionnaireMode;
import org.hl7.fhir.validation.cli.services.StandAloneValidatorFetcher.IPackageInstaller;
import org.hl7.fhir.validation.instance.InstanceValidator;
import org.hl7.fhir.utilities.IniFile;
@ -42,11 +48,6 @@ import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.PackageClient;
import org.hl7.fhir.utilities.cache.BasePackageCacheManager;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.i18n.I18nBase;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.validation.ValidationMessage;
@ -311,6 +312,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
private boolean showTimes;
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
private Map<String, ValidationControl> validationControl = new HashMap<>();
private QuestionnaireMode questionnaireMode;
private class AsteriskFilter implements FilenameFilter {
String dir;
@ -531,7 +533,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
v = src.substring(src.indexOf("|")+1);
src = src.substring(0, src.indexOf("|"));
}
String pid = pcm.getPackageId(src);
String pid = explore ? pcm.getPackageId(src) : null;
if (!Utilities.noString(pid))
return fetchByPackage(pid+(v == null ? "" : "#"+v));
else
@ -563,7 +565,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
} else if ((src.matches(FilesystemPackageCacheManager.PACKAGE_REGEX) || src.matches(FilesystemPackageCacheManager.PACKAGE_VERSION_REGEX)) && !src.endsWith(".zip") && !src.endsWith(".tgz")) {
return fetchByPackage(src);
}
throw new FHIRException("Unable to find/resolve/read -ig "+src);
throw new FHIRException("Unable to find/resolve/read "+(explore ? "-ig " : "")+src);
}
private Map<String, byte[]> loadIgSourceForVersion(String src, boolean recursive, boolean explore, VersionSourceInformation versions) throws FHIRException, IOException {
@ -642,18 +644,26 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
// ok, having tried all that... now we'll just try to access it directly
byte[] cnt;
if (stream == null)
cnt = fetchFromUrlSpecific(src, "application/json", true);
else
List<String> errors = new ArrayList<>();
if (stream != null) {
cnt = TextFile.streamToBytes(stream);
} else {
cnt = fetchFromUrlSpecific(src, "application/json", true, errors);
if (cnt == null) {
cnt = fetchFromUrlSpecific(src, "application/xml", true, errors);
}
}
if (cnt == null) {
throw new FHIRException("Unable to fetch content from "+src+" ("+errors.toString()+")");
}
FhirFormat fmt = checkIsResource(cnt, src);
if (fmt != null) {
Map<String, byte[]> res = new HashMap<String, byte[]>();
res.put(Utilities.changeFileExt(src, "."+fmt.getExtension()), cnt);
return res;
}
throw new FHIRException("Unable to find/resolve/read -ig "+src);
throw new FHIRException("Unable to read content from "+src+": cannot determine format");
}
private Map<String, byte[]> fetchVersionFromUrl(String src, boolean explore, VersionSourceInformation versions) throws FHIRException, IOException {
@ -687,7 +697,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
// ok, having tried all that... now we'll just try to access it directly
byte[] cnt;
if (stream == null)
cnt = fetchFromUrlSpecific(src, "application/json", true);
cnt = fetchFromUrlSpecific(src, "application/json", true, null);
else
cnt = TextFile.streamToBytes(stream);
@ -697,7 +707,20 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
res.put(Utilities.changeFileExt(src, "."+fmt.getExtension()), cnt);
return res;
}
throw new FHIRException("Unable to find/resolve/read -ig "+src);
String fn = Utilities.path("[tmp]", "fetch-resource-error-content.bin");
TextFile.bytesToFile(cnt, fn);
System.out.println("Error Fetching "+src);
System.out.println("Some content was found, saved to "+fn);
System.out.println("1st 100 bytes = "+presentForDebugging(cnt));
throw new FHIRException("Unable to find/resolve/read "+(explore ? "-ig " : "")+src);
}
private String presentForDebugging(byte[] cnt) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < Integer.min(cnt.length, 50); i++) {
b.append(Integer.toHexString(cnt[i]));
}
return b.toString();
}
private InputStream fetchFromUrlSpecific(String source, boolean optional) throws FHIRException, IOException {
@ -713,13 +736,24 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
}
}
private byte[] fetchFromUrlSpecific(String source, String contentType, boolean optional) throws FHIRException, IOException {
private byte[] fetchFromUrlSpecific(String source, String contentType, boolean optional, List<String> errors) throws FHIRException, IOException {
try {
URL url = new URL(source+"?nocache=" + System.currentTimeMillis());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Accept", contentType);
return TextFile.streamToBytes(conn.getInputStream());
try {
// try with cache-busting option and then try withhout in case the server doesn't support that
URL url = new URL(source+"?nocache=" + System.currentTimeMillis());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Accept", contentType);
return TextFile.streamToBytes(conn.getInputStream());
} catch (Exception e) {
URL url = new URL(source);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Accept", contentType);
return TextFile.streamToBytes(conn.getInputStream());
}
} catch (IOException e) {
if (errors != null) {
errors.add("Error accessing "+source+": "+e.getMessage());
}
if (optional)
return null;
else
@ -1123,7 +1157,8 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
}
}
public void setQuestionnaires(List<String> questionnaires) {
public void setQuestionnaireMode(Validator.QuestionnaireMode questionnaireMode) {
this.questionnaireMode = questionnaireMode;
}
public void setNative(boolean doNative) {
@ -1135,8 +1170,8 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
FhirFormat cntType = null;
}
public Content loadContent(String source, String opName) throws FHIRException, IOException {
Map<String, byte[]> s = loadIgSource(source, false, false);
public Content loadContent(String source, String opName, boolean asIg) throws FHIRException, IOException {
Map<String, byte[]> s = loadIgSource(source, false, asIg);
Content res = new Content();
if (s.size() != 1)
throw new FHIRException("Unable to find resource " + source + " to "+opName);
@ -1192,7 +1227,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
InstanceValidator validator = getValidator();
for (String ref : refs) {
Content cnt = loadContent(ref, "validate");
Content cnt = loadContent(ref, "validate", false);
List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
Element e = null;
try {
@ -1264,7 +1299,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
List<String> refs = new ArrayList<String>();
handleSources(sources, refs);
for (String ref : refs) {
Content cnt = loadContent(ref, "validate");
Content cnt = loadContent(ref, "validate", false);
String s = TextFile.bytesToString(cnt.focus);
if (s.contains("http://hl7.org/fhir/3.0")) {
versions.see("3.0", "Profile in "+ref);
@ -1293,7 +1328,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
TimeTracker.Session tts = context.clock().start("validation");
context.clock().milestone();
System.out.print(" Validate " + ref);
Content cnt = loadContent(ref, "validate");
Content cnt = loadContent(ref, "validate", false);
try {
OperationOutcome outcome = validate(ref, cnt.focus, cnt.cntType, profiles);
ToolingExtensions.addStringExtension(outcome, ToolingExtensions.EXT_OO_FILE, ref);
@ -1485,7 +1520,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
}
public org.hl7.fhir.r5.elementmodel.Element transform(String source, String map) throws FHIRException, IOException {
Content cnt = loadContent(source, "validate");
Content cnt = loadContent(source, "validate", false);
return transform(cnt.focus, cnt.cntType, map);
}
@ -1530,7 +1565,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
}
public DomainResource generate(String source, String version) throws FHIRException, IOException, EOperationOutcome {
Content cnt = loadContent(source, "validate");
Content cnt = loadContent(source, "validate", false);
Resource res = loadResourceByVersion(version, cnt.focus, source);
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.RESOURCE);
RendererFactory.factory(res, rc).render((DomainResource) res);
@ -1538,20 +1573,20 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
}
public void convert(String source, String output) throws FHIRException, IOException {
Content cnt = loadContent(source, "validate");
Content cnt = loadContent(source, "validate", false);
Element e = Manager.parse(context, new ByteArrayInputStream(cnt.focus), cnt.cntType);
Manager.compose(context, e, new FileOutputStream(output), (output.endsWith(".json") ? FhirFormat.JSON : FhirFormat.XML), OutputStyle.PRETTY, null);
}
public String evaluateFhirPath(String source, String expression) throws FHIRException, IOException {
Content cnt = loadContent(source, "validate");
Content cnt = loadContent(source, "validate", false);
FHIRPathEngine fpe = new FHIRPathEngine(context);
Element e = Manager.parse(context, new ByteArrayInputStream(cnt.focus), cnt.cntType);
return fpe.evaluateToString(e, expression);
}
public StructureDefinition snapshot(String source, String version) throws FHIRException, IOException {
Content cnt = loadContent(source, "validate");
Content cnt = loadContent(source, "validate", false);
Resource res = loadResourceByVersion(version, cnt.focus, Utilities.getFileNameForName(source));
if (!(res instanceof StructureDefinition))
@ -1595,6 +1630,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
validator.getImplementationGuides().addAll(igs);
validator.getBundleValidationRules().addAll(bundleValidationRules);
validator.getValidationControl().putAll(validationControl );
validator.setQuestionnaireMode(questionnaireMode);
return validator;
}
@ -2054,7 +2090,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
}
public byte[] transformVersion(String source, String targetVer, FhirFormat format, Boolean canDoNative) throws FHIRException, IOException, Exception {
Content cnt = loadContent(source, "validate");
Content cnt = loadContent(source, "validate", false);
org.hl7.fhir.r5.elementmodel.Element src = Manager.parse(context, new ByteArrayInputStream(cnt.focus), cnt.cntType);
// if the src has a url, we try to use the java code

View File

@ -91,6 +91,8 @@ public class Validator {
public enum EngineMode {
VALIDATION, TRANSFORM, NARRATIVE, SNAPSHOT, SCAN, CONVERT, FHIRPATH, VERSION
}
public enum QuestionnaireMode { NONE, CHECK, REQUIRED }
private static CliContext cliContext;

View File

@ -54,8 +54,9 @@ public class CliContext {
@JsonProperty("igs")
private List<String> igs = new ArrayList<String>();
@JsonProperty("questionnaires")
private List<String> questionnaires = new ArrayList<String>();
@JsonProperty("questionnaire")
private Validator.QuestionnaireMode questionnaireMode = Validator.QuestionnaireMode.CHECK;
@JsonProperty("profiles")
private List<String> profiles = new ArrayList<String>();
@JsonProperty("sources")
@ -118,22 +119,14 @@ public class CliContext {
return this;
}
@JsonProperty("questionnaires")
public List<String> getQuestionnaires() {
return questionnaires;
@JsonProperty("questionnaire")
public Validator.QuestionnaireMode getQuestionnaireMode() {
return questionnaireMode;
}
@JsonProperty("questionnaires")
public CliContext setQuestionnaires(List<String> questionnaires) {
this.questionnaires = questionnaires;
return this;
}
public CliContext addQuestionnaire(String questionnaire) {
if (this.questionnaires == null) {
this.questionnaires = new ArrayList<>();
}
this.questionnaires.add(questionnaire);
@JsonProperty("questionnaire")
public CliContext setQuestionnaireMode(Validator.QuestionnaireMode questionnaireMode) {
this.questionnaireMode = questionnaireMode;
return this;
}
@ -482,7 +475,7 @@ public class CliContext {
Objects.equals(snomedCT, that.snomedCT) &&
Objects.equals(targetVer, that.targetVer) &&
Objects.equals(igs, that.igs) &&
Objects.equals(questionnaires, that.questionnaires) &&
Objects.equals(questionnaireMode, that.questionnaireMode) &&
Objects.equals(profiles, that.profiles) &&
Objects.equals(sources, that.sources) &&
Objects.equals(crumbTrails, that.crumbTrails) &&
@ -494,6 +487,6 @@ public class CliContext {
@Override
public int hashCode() {
return Objects.hash(doNative, anyExtensionsAllowed, hintAboutNonMustSupport, recursive, doDebug, assumeValidRestReferences, canDoNative, noInternalCaching, noExtensibleBindingMessages, map, output, txServer, sv, txLog, mapLog, lang, fhirpath, snomedCT, targetVer, igs, questionnaires, profiles, sources, mode, locale, locations, crumbTrails, showTimes);
return Objects.hash(doNative, anyExtensionsAllowed, hintAboutNonMustSupport, recursive, doDebug, assumeValidRestReferences, canDoNative, noInternalCaching, noExtensibleBindingMessages, map, output, txServer, sv, txLog, mapLog, lang, fhirpath, snomedCT, targetVer, igs, questionnaireMode, profiles, sources, mode, locale, locations, crumbTrails, showTimes);
}
}

View File

@ -14,9 +14,9 @@ import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.VersionUtilities.VersionURLInfo;
import org.hl7.fhir.utilities.cache.BasePackageCacheManager;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.validation.cli.services.StandAloneValidatorFetcher.IPackageInstaller;
public class StandAloneValidatorFetcher implements IValidatorResourceFetcher {

View File

@ -203,7 +203,7 @@ public class ValidationService {
validator.loadIg(src, cliContext.isRecursive());
}
System.out.print(" Get set... ");
validator.setQuestionnaires(cliContext.getQuestionnaires());
validator.setQuestionnaireMode(cliContext.getQuestionnaireMode());
validator.setNative(cliContext.isDoNative());
validator.setHintAboutNonMustSupport(cliContext.isHintAboutNonMustSupport());
validator.setAnyExtensionsAllowed(cliContext.isAnyExtensionsAllowed());

View File

@ -2,8 +2,8 @@ package org.hl7.fhir.validation.cli.utils;
import org.hl7.fhir.r5.model.Constants;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import java.io.IOException;

View File

@ -122,8 +122,10 @@ public class Params {
} else if (args[i].equals(QUESTIONNAIRE)) {
if (i + 1 == args.length)
throw new Error("Specified -questionnaire without indicating questionnaire file");
else
cliContext.addQuestionnaire(args[++i]);
else {
String q = args[++i];
cliContext.setQuestionnaireMode(Validator.QuestionnaireMode.valueOf(q));
}
} else if (args[i].equals(NATIVE)) {
cliContext.setDoNative(true);
} else if (args[i].equals(ASSUME_VALID_REST_REF)) {

View File

@ -140,6 +140,7 @@ import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.r5.utils.XVerExtensionManager;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.validation.BaseValidator;
import org.hl7.fhir.validation.Validator.QuestionnaireMode;
import org.hl7.fhir.validation.instance.type.BundleValidator;
import org.hl7.fhir.validation.instance.type.CodeSystemValidator;
import org.hl7.fhir.validation.instance.type.MeasureValidator;
@ -375,6 +376,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private boolean crumbTrails;
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
private boolean validateValueSetCodesOnTxServer = true;
private QuestionnaireMode questionnaireMode;
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) {
super(theContext);
@ -3844,9 +3846,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} else if (element.getType().equals("Observation")) {
validateObservation(errors, element, stack);
} else if (element.getType().equals("Questionnaire")) {
new QuestionnaireValidator(context, myEnableWhenEvaluator, fpe, timeTracker).validateQuestionannaire(errors, element, element, stack);
new QuestionnaireValidator(context, myEnableWhenEvaluator, fpe, timeTracker, questionnaireMode).validateQuestionannaire(errors, element, element, stack);
} else if (element.getType().equals("QuestionnaireResponse")) {
new QuestionnaireValidator(context, myEnableWhenEvaluator, fpe, timeTracker).validateQuestionannaireResponse(hostContext, errors, element, stack);
new QuestionnaireValidator(context, myEnableWhenEvaluator, fpe, timeTracker, questionnaireMode).validateQuestionannaireResponse(hostContext, errors, element, stack);
} else if (element.getType().equals("Measure")) {
new MeasureValidator(context, timeTracker).validateMeasure(hostContext, errors, element, stack);
} else if (element.getType().equals("MeasureReport")) {
@ -5081,4 +5083,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
public void setQuestionnaireMode(QuestionnaireMode questionnaireMode) {
this.questionnaireMode = questionnaireMode;
}
public QuestionnaireMode getQuestionnaireMode() {
return questionnaireMode;
}
}

View File

@ -45,6 +45,7 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import org.hl7.fhir.validation.BaseValidator;
import org.hl7.fhir.validation.TimeTracker;
import org.hl7.fhir.validation.Validator.QuestionnaireMode;
import org.hl7.fhir.validation.instance.EnableWhenEvaluator;
import org.hl7.fhir.validation.instance.EnableWhenEvaluator.QStack;
import org.hl7.fhir.validation.instance.utils.NodeStack;
@ -56,13 +57,15 @@ public class QuestionnaireValidator extends BaseValidator {
private EnableWhenEvaluator myEnableWhenEvaluator;
private FHIRPathEngine fpe;
private QuestionnaireMode questionnaireMode;
public QuestionnaireValidator(IWorkerContext context, EnableWhenEvaluator myEnableWhenEvaluator, FHIRPathEngine fpe, TimeTracker timeTracker) {
public QuestionnaireValidator(IWorkerContext context, EnableWhenEvaluator myEnableWhenEvaluator, FHIRPathEngine fpe, TimeTracker timeTracker, QuestionnaireMode questionnaireMode) {
super(context);
source = Source.InstanceValidator;
this.myEnableWhenEvaluator = myEnableWhenEvaluator;
this.fpe = fpe;
this.timeTracker = timeTracker;
this.questionnaireMode = questionnaireMode;
}
public void validateQuestionannaire(List<ValidationMessage> errors, Element element, Element element2, NodeStack stack) {
@ -164,6 +167,9 @@ public class QuestionnaireValidator extends BaseValidator {
}
public void validateQuestionannaireResponse(ValidatorHostContext hostContext, List<ValidationMessage> errors, Element element, NodeStack stack) throws FHIRException {
if (questionnaireMode == QuestionnaireMode.NONE) {
return;
}
Element q = element.getNamedChild("questionnaire");
String questionnaire = null;
if (q != null) {
@ -179,9 +185,15 @@ public class QuestionnaireValidator extends BaseValidator {
questionnaire = q.getChildValue("reference");
}
}
if (hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), questionnaire != null, I18nConstants.QUESTIONNAIRE_QR_Q_NONE)) {
boolean ok = questionnaireMode == QuestionnaireMode.REQUIRED ?
rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), questionnaire != null, I18nConstants.QUESTIONNAIRE_QR_Q_NONE) :
hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), questionnaire != null, I18nConstants.QUESTIONNAIRE_QR_Q_NONE);
if (ok) {
Questionnaire qsrc = questionnaire.startsWith("#") ? loadQuestionnaire(element, questionnaire.substring(1)) : context.fetchResource(Questionnaire.class, questionnaire);
if (warning(errors, IssueType.REQUIRED, q.line(), q.col(), stack.getLiteralPath(), qsrc != null, I18nConstants.QUESTIONNAIRE_QR_Q_NOTFOUND, questionnaire)) {
ok = questionnaireMode == QuestionnaireMode.REQUIRED ?
rule(errors, IssueType.REQUIRED, q.line(), q.col(), stack.getLiteralPath(), qsrc != null, I18nConstants.QUESTIONNAIRE_QR_Q_NOTFOUND, questionnaire) :
warning(errors, IssueType.REQUIRED, q.line(), q.col(), stack.getLiteralPath(), qsrc != null, I18nConstants.QUESTIONNAIRE_QR_Q_NOTFOUND, questionnaire);
if (ok) {
boolean inProgress = "in-progress".equals(element.getNamedChildValue("status"));
validateQuestionannaireResponseItems(hostContext, qsrc, qsrc.getItem(), errors, element, stack, inProgress, element, new QStack(qsrc, element));
}

View File

@ -56,28 +56,28 @@ public class ValueSetValidator extends BaseValidator {
List<Element> composes = vs.getChildrenByName("compose");
int cc = 0;
for (Element compose : composes) {
validateValueSetCompose(errors, compose, stack.push(compose, cc, null, null), vs.getNamedChildValue("url"));
validateValueSetCompose(errors, compose, stack.push(compose, cc, null, null), vs.getNamedChildValue("url"), "retired".equals(vs.getNamedChildValue("url")));
cc++;
}
}
}
private void validateValueSetCompose(List<ValidationMessage> errors, Element compose, NodeStack stack, String vsid) {
private void validateValueSetCompose(List<ValidationMessage> errors, Element compose, NodeStack stack, String vsid, boolean retired) {
List<Element> includes = compose.getChildrenByName("include");
int ci = 0;
for (Element include : includes) {
validateValueSetInclude(errors, include, stack.push(include, ci, null, null), vsid);
validateValueSetInclude(errors, include, stack.push(include, ci, null, null), vsid, retired);
ci++;
}
List<Element> excludes = compose.getChildrenByName("exclude");
int ce = 0;
for (Element exclude : excludes) {
validateValueSetInclude(errors, exclude, stack.push(exclude, ce, null, null), vsid);
validateValueSetInclude(errors, exclude, stack.push(exclude, ce, null, null), vsid, retired);
ce++;
}
}
private void validateValueSetInclude(List<ValidationMessage> errors, Element include, NodeStack stack, String vsid) {
private void validateValueSetInclude(List<ValidationMessage> errors, Element include, NodeStack stack, String vsid, boolean retired) {
String system = include.getChildValue("system");
String version = include.getChildValue("version");
List<Element> valuesets = include.getChildrenByName("valueSet");
@ -125,9 +125,9 @@ public class ValueSetValidator extends BaseValidator {
}
for (VSCodingValidationRequest cv : batch) {
if (version == null) {
warning(errors, IssueType.BUSINESSRULE, cv.getStack().getLiteralPath(), cv.getResult().isOk(), I18nConstants.VALUESET_INCLUDE_INVALID_CONCEPT_CODE, system, cv.getCoding().getCode());
warningOrHint(errors, IssueType.BUSINESSRULE, cv.getStack().getLiteralPath(), cv.getResult().isOk(), !retired, I18nConstants.VALUESET_INCLUDE_INVALID_CONCEPT_CODE, system, cv.getCoding().getCode());
} else {
warning(errors, IssueType.BUSINESSRULE, cv.getStack().getLiteralPath(), cv.getResult().isOk(), I18nConstants.VALUESET_INCLUDE_INVALID_CONCEPT_CODE_VER, system, version, cv.getCoding().getCode());
warningOrHint(errors, IssueType.BUSINESSRULE, cv.getStack().getLiteralPath(), cv.getResult().isOk(), !retired, I18nConstants.VALUESET_INCLUDE_INVALID_CONCEPT_CODE_VER, system, version, cv.getCoding().getCode());
}
}
}

View File

@ -7,11 +7,11 @@ import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.CachingPackageClient;
import org.hl7.fhir.utilities.cache.PackageClient.PackageInfo;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.CachingPackageClient;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.npm.PackageClient.PackageInfo;
public class PackageValidator {

View File

@ -38,9 +38,9 @@ import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;

View File

@ -22,8 +22,8 @@ import org.hl7.fhir.r4.utils.StructureMapUtilities.ITransformerServices;
import org.hl7.fhir.utilities.IniFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.junit.jupiter.api.Disabled;

View File

@ -59,9 +59,8 @@ import org.hl7.fhir.utilities.CSFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;

View File

@ -19,7 +19,7 @@
<properties>
<hapi_fhir_version>5.1.0</hapi_fhir_version>
<validator_test_case_version>1.1.44</validator_test_case_version>
<validator_test_case_version>1.1.45-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.6.2</junit_jupiter_version>
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
<jacoco_version>0.8.5</jacoco_version>