more IG maintenance work

This commit is contained in:
Grahame Grieve 2019-04-14 07:59:17 +10:00
parent 793545f2d9
commit 87b191fc5d
6 changed files with 87 additions and 28 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

@ -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

@ -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

@ -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 ===============================================================