mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-07 05:18:14 +00:00
Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
# Conflicts: # org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json
This commit is contained in:
commit
2f817de46e
@ -10014,6 +10014,57 @@ The primary difference between a medication statement and a medication administr
|
|||||||
return _4_1_0;
|
return _4_1_0;
|
||||||
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toCode();
|
return toCode();
|
||||||
|
@ -4145,10 +4145,12 @@ public class FHIRPathEngine {
|
|||||||
List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(sd, element);
|
List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(sd, element);
|
||||||
for (ElementDefinition t : childDefinitions) {
|
for (ElementDefinition t : childDefinitions) {
|
||||||
if (t.getPath().endsWith(".extension") && t.hasSliceName()) {
|
if (t.getPath().endsWith(".extension") && t.hasSliceName()) {
|
||||||
sd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue());
|
StructureDefinition exsd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue());
|
||||||
while (sd!=null && !sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension"))
|
while (exsd!=null && !exsd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension"))
|
||||||
sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
exsd = worker.fetchResource(StructureDefinition.class, exsd.getBaseDefinition());
|
||||||
if (sd.getUrl().equals(targetUrl)) {
|
if (exsd.getUrl().equals(targetUrl)) {
|
||||||
|
if (ProfileUtilities.getChildMap(sd, t).isEmpty())
|
||||||
|
sd = exsd;
|
||||||
focus = t;
|
focus = t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import java.io.BufferedOutputStream;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -85,7 +86,18 @@ public class NPMPackageGenerator {
|
|||||||
System.out.println("create package file at "+destFile);
|
System.out.println("create package file at "+destFile);
|
||||||
this.destFile = destFile;
|
this.destFile = destFile;
|
||||||
start();
|
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 {
|
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();
|
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||||
if (!ig.hasPackageId())
|
if (!ig.hasPackageId())
|
||||||
b.append("packageId");
|
b.append("packageId");
|
||||||
@ -134,8 +146,8 @@ public class NPMPackageGenerator {
|
|||||||
if (kind != PackageType.CORE) {
|
if (kind != PackageType.CORE) {
|
||||||
JsonObject dep = new JsonObject();
|
JsonObject dep = new JsonObject();
|
||||||
npm.add("dependencies", dep);
|
npm.add("dependencies", dep);
|
||||||
for (Enumeration<FHIRVersion> v : ig.getFhirVersion()) { // TODO: fix for multiple versions
|
for (String v : fhirVersion) { // TODO: fix for multiple versions
|
||||||
dep.addProperty("hl7.fhir.core", v.asStringValue());
|
dep.addProperty("hl7.fhir.core", v);
|
||||||
}
|
}
|
||||||
for (ImplementationGuideDependsOnComponent d : ig.getDependsOn()) {
|
for (ImplementationGuideDependsOnComponent d : ig.getDependsOn()) {
|
||||||
dep.addProperty(d.getPackageId(), d.getVersion());
|
dep.addProperty(d.getPackageId(), d.getVersion());
|
||||||
|
@ -343,5 +343,10 @@ import com.google.gson.JsonObject;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** special case when playing around inside the package **/
|
||||||
|
public Map<String, byte[]> getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.hl7.fhir.utilities.json;
|
package org.hl7.fhir.utilities.json;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
* org.hl7.fhir.utilities
|
* org.hl7.fhir.utilities
|
||||||
@ -22,12 +24,13 @@ package org.hl7.fhir.utilities.json;
|
|||||||
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
public class JSONUtil {
|
public class JSONUtil {
|
||||||
|
|
||||||
public static JsonObject parse(String json) {
|
public static JsonObject parse(String json) throws IOException {
|
||||||
return (JsonObject) new com.google.gson.JsonParser().parse(json);
|
return JsonTrackingParser.parseJson(json);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,4 +59,13 @@ public class JSONUtil {
|
|||||||
return res;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -817,8 +817,9 @@ public class ValidationEngine {
|
|||||||
if (refs.size() > 1)
|
if (refs.size() > 1)
|
||||||
produceValidationSummary(outcome);
|
produceValidationSummary(outcome);
|
||||||
results.addEntry().setResource(outcome);
|
results.addEntry().setResource(outcome);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Validation Infrastructure fail validating "+ref+": "+e.getMessage());
|
System.out.println("Validation Infrastructure fail validating "+ref+": "+e.getMessage());
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (asBundle)
|
if (asBundle)
|
||||||
|
@ -107,7 +107,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
|
|||||||
|
|
||||||
if (ve == null || !v.equals(veVersion)) {
|
if (ve == null || !v.equals(veVersion)) {
|
||||||
if (v.equals("5.0"))
|
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"))
|
else if (v.equals("3.0"))
|
||||||
ve = new ValidationEngine("hl7.fhir.core#3.0.1", DEF_TX, null, FhirPublication.STU3);
|
ve = new ValidationEngine("hl7.fhir.core#3.0.1", DEF_TX, null, FhirPublication.STU3);
|
||||||
else if (v.equals("4.0"))
|
else if (v.equals("4.0"))
|
||||||
|
@ -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('http://hl7.org/fhir/StructureDefinition/data-absent-reason').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>
|
@ -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>
|
@ -461,11 +461,11 @@
|
|||||||
"questionnaire" : "questionnaire-enableWhen-test3.xml",
|
"questionnaire" : "questionnaire-enableWhen-test3.xml",
|
||||||
"errorCount": 0
|
"errorCount": 0
|
||||||
},
|
},
|
||||||
"slice-by-polymorphic-type2.xml" : {
|
"extension-slice.xml" : {
|
||||||
"errorCount": 0,
|
"errorCount": 0,
|
||||||
"profile" : {
|
"profile" : {
|
||||||
"source" : "slice-by-polymorphic-type2-profile.xml",
|
"source" : "extension-slice-profile.xml",
|
||||||
"errorCount": 0
|
"errorCount": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
release.bat
21
release.bat
@ -9,31 +9,10 @@ echo ===============================================================
|
|||||||
pause
|
pause
|
||||||
|
|
||||||
call mvn versions:set -DnewVersion=3.7.26-SNAPSHOT
|
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 commit -a -m "Release new version"
|
||||||
call git push origin master
|
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 "*.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"
|
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
|
call mvn deploy
|
||||||
|
|
||||||
echo ===============================================================
|
echo ===============================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user