# Conflicts:
#	org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json
This commit is contained in:
Lloyd McKenzie 2019-05-13 18:29:13 -06:00
commit 2f817de46e
11 changed files with 158 additions and 36 deletions

View File

@ -10014,6 +10014,57 @@ The primary difference between a medication statement and a medication administr
return _4_1_0;
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
}
public static boolean isValidCode(String codeString) {
if (codeString == null || "".equals(codeString))
return false;
if ("0.01".equals(codeString))
return true;
if ("0.05".equals(codeString))
return true;
if ("0.06".equals(codeString))
return true;
if ("0.11".equals(codeString))
return true;
if ("0.0.80".equals(codeString))
return true;
if ("0.0.81".equals(codeString))
return true;
if ("0.0.82".equals(codeString))
return true;
if ("0.4.0".equals(codeString))
return true;
if ("0.5.0".equals(codeString))
return true;
if ("1.0.0".equals(codeString))
return true;
if ("1.0.1".equals(codeString))
return true;
if ("1.0.2".equals(codeString))
return true;
if ("1.1.0".equals(codeString))
return true;
if ("1.4.0".equals(codeString))
return true;
if ("1.6.0".equals(codeString))
return true;
if ("1.8.0".equals(codeString))
return true;
if ("3.0.0".equals(codeString))
return true;
if ("3.0.1".equals(codeString))
return true;
if ("3.3.0".equals(codeString))
return true;
if ("3.5.0".equals(codeString))
return true;
if ("4.0.0".equals(codeString))
return true;
if ("4.1.0".equals(codeString))
return true;
return false;
}
@Override
public String toString() {
return toCode();

View File

@ -4145,10 +4145,12 @@ public class FHIRPathEngine {
List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(sd, element);
for (ElementDefinition t : childDefinitions) {
if (t.getPath().endsWith(".extension") && t.hasSliceName()) {
sd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue());
while (sd!=null && !sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension"))
sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
if (sd.getUrl().equals(targetUrl)) {
StructureDefinition exsd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue());
while (exsd!=null && !exsd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension"))
exsd = worker.fetchResource(StructureDefinition.class, exsd.getBaseDefinition());
if (exsd.getUrl().equals(targetUrl)) {
if (ProfileUtilities.getChildMap(sd, t).isEmpty())
sd = exsd;
focus = t;
break;
}

View File

@ -25,6 +25,7 @@ import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashSet;
@ -85,7 +86,18 @@ public class NPMPackageGenerator {
System.out.println("create package file at "+destFile);
this.destFile = destFile;
start();
buildPackageJson(canonical, kind, url, genDate, ig);
List<String> fhirVersion = new ArrayList<>();
for (Enumeration<FHIRVersion> v : ig.getFhirVersion())
fhirVersion.add(v.asStringValue());
buildPackageJson(canonical, kind, url, genDate, ig, fhirVersion);
}
public NPMPackageGenerator(String destFile, String canonical, String url, PackageType kind, ImplementationGuide ig, String genDate, List<String> fhirVersion) throws FHIRException, IOException {
super();
System.out.println("create package file at "+destFile);
this.destFile = destFile;
start();
buildPackageJson(canonical, kind, url, genDate, ig, fhirVersion);
}
public NPMPackageGenerator(String destFile, JsonObject npm) throws FHIRException, IOException {
@ -102,7 +114,7 @@ public class NPMPackageGenerator {
}
private void buildPackageJson(String canonical, PackageType kind, String web, String genDate, ImplementationGuide ig) throws FHIRException, IOException {
private void buildPackageJson(String canonical, PackageType kind, String web, String genDate, ImplementationGuide ig, List<String> fhirVersion) throws FHIRException, IOException {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
if (!ig.hasPackageId())
b.append("packageId");
@ -134,8 +146,8 @@ public class NPMPackageGenerator {
if (kind != PackageType.CORE) {
JsonObject dep = new JsonObject();
npm.add("dependencies", dep);
for (Enumeration<FHIRVersion> v : ig.getFhirVersion()) { // TODO: fix for multiple versions
dep.addProperty("hl7.fhir.core", v.asStringValue());
for (String v : fhirVersion) { // TODO: fix for multiple versions
dep.addProperty("hl7.fhir.core", v);
}
for (ImplementationGuideDependsOnComponent d : ig.getDependsOn()) {
dep.addProperty(d.getPackageId(), d.getVersion());

View File

@ -343,5 +343,10 @@ import com.google.gson.JsonObject;
}
}
/** special case when playing around inside the package **/
public Map<String, byte[]> getContent() {
return content;
}
}

View File

@ -1,5 +1,7 @@
package org.hl7.fhir.utilities.json;
import java.io.IOException;
/*-
* #%L
* org.hl7.fhir.utilities
@ -22,12 +24,13 @@ package org.hl7.fhir.utilities.json;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
public class JSONUtil {
public static JsonObject parse(String json) {
return (JsonObject) new com.google.gson.JsonParser().parse(json);
public static JsonObject parse(String json) throws IOException {
return JsonTrackingParser.parseJson(json);
}
@ -56,4 +59,13 @@ public class JSONUtil {
return res;
}
public static JsonObject findByStringProp(JsonArray arr, String prop, String value) {
for (JsonElement e : arr) {
JsonObject obj = (JsonObject) e;
if (obj.has(prop) && obj.get(prop).getAsString().equals(value))
return obj;
}
return null;
}
}

View File

@ -817,8 +817,9 @@ public class ValidationEngine {
if (refs.size() > 1)
produceValidationSummary(outcome);
results.addEntry().setResource(outcome);
} catch (Throwable e) {
} catch (Exception e) {
System.out.println("Validation Infrastructure fail validating "+ref+": "+e.getMessage());
throw e;
}
}
if (asBundle)

View File

@ -107,7 +107,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
if (ve == null || !v.equals(veVersion)) {
if (v.equals("5.0"))
ve = new ValidationEngine("hl7.fhir.core#4.1.0", DEF_TX, null, FhirPublication.R5);
ve = new ValidationEngine("hl7.fhir.core#current", DEF_TX, null, FhirPublication.R5);
else if (v.equals("3.0"))
ve = new ValidationEngine("hl7.fhir.core#3.0.1", DEF_TX, null, FhirPublication.STU3);
else if (v.equals("4.0"))

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../../../../../FHIR/schema/fhir-single.xsd">-->
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="extension-slice-profile"/>
<url value="http://hl7.org/fhir/StructureDefinition/extension-slice-profile"/>
<name value="ExtensionSliceProfile"/>
<status value="draft"/>
<description value="Test slicing by extension with fixed value"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Patient"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<derivation value="constraint"/>
<differential>
<element id="Patient">
<path value="Patient"/>
</element>
<element id="Patient.name">
<path value="Patient.name"/>
<slicing>
<discriminator>
<type value="value"/>
<path value="extension(&#39;http://hl7.org/fhir/StructureDefinition/data-absent-reason&#39;).valueCode"/>
</discriminator>
<rules value="open"/>
</slicing>
</element>
<element id="Patient.name:foo">
<path value="Patient.name"/>
<sliceName value="foo"/>
<min value="1"/>
</element>
<element id="Patient.name:foo.extension:dar">
<path value="Patient.name.extension"/>
<sliceName value="dar"/>
<min value="1"/>
<type>
<code value="Extension"/>
<profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason"/>
</type>
</element>
<element id="Patient.name:foo.extension:dar.valueCode">
<path value="Patient.name.extension.valueCode"/>
<fixedCode value="unknown"/>
</element>
</differential>
</StructureDefinition>

View File

@ -0,0 +1,13 @@
<Patient xmlns="http://hl7.org/fhir">
<id value="extension-slice"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
</div>
</text>
<name>
<extension url="http://hl7.org/fhir/StructureDefinition/data-absent-reason">
<valueCode value="unknown"/>
</extension>
</name>
</Patient>

View File

@ -461,11 +461,11 @@
"questionnaire" : "questionnaire-enableWhen-test3.xml",
"errorCount": 0
},
"slice-by-polymorphic-type2.xml" : {
"extension-slice.xml" : {
"errorCount": 0,
"profile" : {
"source" : "slice-by-polymorphic-type2-profile.xml",
"errorCount": 0
"source" : "extension-slice-profile.xml",
"errorCount": 0
}
}
}

View File

@ -9,31 +9,10 @@ echo ===============================================================
pause
call mvn versions:set -DnewVersion=3.7.26-SNAPSHOT
echo ===============================================================
echo upgraded version number using maven
echo next: do git commit / push
echo ===============================================================
pause
call git commit -a -m "Release new version"
call git push origin master
echo ===============================================================
echo done git commit / push
echo next: replace references in java code + ivy
echo ===============================================================
pause
call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.java" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find "3.7.25-SNAPSHOT" --replace "3.7.26-SNAPSHOT"
call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.xml" --excludeFileMask "*.dll, *.exe" --find "3.7.25-SNAPSHOT" --replace "3.7.26-SNAPSHOT"
echo ===============================================================
echo done replacing references
echo next: do maven release
echo ===============================================================
pause
call mvn deploy
echo ===============================================================