Merge remote-tracking branch 'origin/master' into do-20240830-maven-compiler-update
This commit is contained in:
commit
9ea15aa617
|
@ -3463,6 +3463,11 @@ public class ProfileUtilities {
|
||||||
|
|
||||||
|
|
||||||
public void sortDifferential(StructureDefinition base, StructureDefinition diff, String name, List<String> errors, boolean errorIfChanges) throws FHIRException {
|
public void sortDifferential(StructureDefinition base, StructureDefinition diff, String name, List<String> errors, boolean errorIfChanges) throws FHIRException {
|
||||||
|
int index = 0;
|
||||||
|
for (ElementDefinition ed : diff.getDifferential().getElement()) {
|
||||||
|
ed.setUserData("ed.index", Integer.toString(index));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
List<ElementDefinition> original = new ArrayList<>();
|
List<ElementDefinition> original = new ArrayList<>();
|
||||||
original.addAll(diff.getDifferential().getElement());
|
original.addAll(diff.getDifferential().getElement());
|
||||||
final List<ElementDefinition> diffList = diff.getDifferential().getElement();
|
final List<ElementDefinition> diffList = diff.getDifferential().getElement();
|
||||||
|
@ -3520,7 +3525,7 @@ public class ProfileUtilities {
|
||||||
ElementDefinition e = diffList.get(i);
|
ElementDefinition e = diffList.get(i);
|
||||||
ElementDefinition n = newDiff.get(i);
|
ElementDefinition n = newDiff.get(i);
|
||||||
if (!n.getPath().equals(e.getPath())) {
|
if (!n.getPath().equals(e.getPath())) {
|
||||||
errors.add("The element "+e.getPath()+" is out of order (and maybe others after it)");
|
errors.add("The element "+(e.hasId() ? e.getId() : e.getPath())+" @diff["+e.getUserString("ed.index")+"] is out of order (and maybe others after it)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,9 @@ public class LanguageUtils {
|
||||||
}
|
}
|
||||||
for (TranslationUnit t : translations) {
|
for (TranslationUnit t : translations) {
|
||||||
if (!usedUnits.contains(t)) {
|
if (!usedUnits.contains(t)) {
|
||||||
messages.add(new ValidationMessage(Source.Publisher, IssueType.INFORMATIONAL, t.getId(), "Unused '"+t.getLanguage()+"' translation '"+t.getSrcText()+"' -> '"+t.getTgtText()+"'", IssueSeverity.INFORMATION));
|
if (messages != null) {
|
||||||
|
messages.add(new ValidationMessage(Source.Publisher, IssueType.INFORMATIONAL, t.getId(), "Unused '"+t.getLanguage()+"' translation '"+t.getSrcText()+"' -> '"+t.getTgtText()+"'", IssueSeverity.INFORMATION));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -182,7 +184,9 @@ public class LanguageUtils {
|
||||||
}
|
}
|
||||||
for (TranslationUnit t : translations) {
|
for (TranslationUnit t : translations) {
|
||||||
if (!usedUnits.contains(t)) {
|
if (!usedUnits.contains(t)) {
|
||||||
messages.add(new ValidationMessage(Source.Publisher, IssueType.INFORMATIONAL, t.getId(), "Unused '"+t.getLanguage()+"' translation '"+t.getSrcText()+"' -> '"+t.getTgtText()+"'", IssueSeverity.INFORMATION));
|
if (messages != null) {
|
||||||
|
messages.add(new ValidationMessage(Source.Publisher, IssueType.INFORMATIONAL, t.getId(), "Unused '"+t.getLanguage()+"' translation '"+t.getSrcText()+"' -> '"+t.getTgtText()+"'", IssueSeverity.INFORMATION));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -296,7 +300,9 @@ public class LanguageUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Element c : element.getChildren()) {
|
// Create a copy of the children collection before iterating
|
||||||
|
List<Element> childrenCopy = List.copyOf(element.getChildren());
|
||||||
|
for (Element c : childrenCopy) {
|
||||||
if (!c.getName().equals("designation")) {
|
if (!c.getName().equals("designation")) {
|
||||||
t = t + importFromTranslations(element, c, translations, usedUnits);
|
t = t + importFromTranslations(element, c, translations, usedUnits);
|
||||||
}
|
}
|
||||||
|
|
|
@ -897,7 +897,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
Row parent = null;
|
Row parent = null;
|
||||||
if (child.hasSliceName()) {
|
if (child.hasSliceName()) {
|
||||||
// ok, we're a slice
|
// ok, we're a slice
|
||||||
if (slicer == null || !slicer.getId().equals(child.getPath())) {
|
if (slicer == null || !noTail(slicer.getId()).equals(child.getPath())) {
|
||||||
parent = gen.new Row();
|
parent = gen.new Row();
|
||||||
String anchorE = child.getPath();
|
String anchorE = child.getPath();
|
||||||
anchorE = makeAnchorUnique(anchorE);
|
anchorE = makeAnchorUnique(anchorE);
|
||||||
|
@ -906,7 +906,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
parent.setColor(context.getProfileUtilities().getRowColor(child, isConstraintMode));
|
parent.setColor(context.getProfileUtilities().getRowColor(child, isConstraintMode));
|
||||||
parent.setLineColor(1);
|
parent.setLineColor(1);
|
||||||
parent.setIcon("icon_slice.png", context.formatPhrase(RenderingContext.TEXT_ICON_SLICE));
|
parent.setIcon("icon_slice.png", context.formatPhrase(RenderingContext.TEXT_ICON_SLICE));
|
||||||
parent.getCells().add(gen.new Cell(null, null, "Slices for "+ child.getName(), "", null));
|
parent.getCells().add(gen.new Cell(null, null, context.formatPhrase(RenderingContext.STRUC_DEF_SLICE_FOR, child.getName()), "", null));
|
||||||
switch (context.getStructureMode()) {
|
switch (context.getStructureMode()) {
|
||||||
case BINDINGS:
|
case BINDINGS:
|
||||||
case OBLIGATIONS:
|
case OBLIGATIONS:
|
||||||
|
@ -947,6 +947,16 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||||
return slicingRow;
|
return slicingRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String noTail(String id) {
|
||||||
|
if (id.contains(".")) {
|
||||||
|
String t = id.substring(id.lastIndexOf(".")+1);
|
||||||
|
if (Utilities.isInteger(t)) {
|
||||||
|
return id.substring(0, id.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
private String makeAnchorUnique(String anchor) {
|
private String makeAnchorUnique(String anchor) {
|
||||||
if (anchors.containsKey(anchor)) {
|
if (anchors.containsKey(anchor)) {
|
||||||
int c = anchors.get(anchor)+1;
|
int c = anchors.get(anchor)+1;
|
||||||
|
|
|
@ -100,7 +100,8 @@ public class SpreadsheetGenerator {
|
||||||
if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN - 2) {
|
if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN - 2) {
|
||||||
name = name.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN - 2);
|
name = name.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN - 2);
|
||||||
}
|
}
|
||||||
String s = fixSheetNameChars(name);
|
name = fixSheetNameChars(name);
|
||||||
|
String s = name;
|
||||||
if (sheetNames.containsKey(s)) {
|
if (sheetNames.containsKey(s)) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
package org.hl7.fhir.r5.renderers.spreadsheets;
|
package org.hl7.fhir.r5.renderers.spreadsheets;
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
|
||||||
import org.hl7.fhir.r5.model.CanonicalType;
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent;
|
|
||||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
|
||||||
|
|
||||||
public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator {
|
public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator {
|
||||||
|
|
||||||
|
@ -36,11 +28,12 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
|
||||||
System.out.println("no valueset!");
|
System.out.println("no valueset!");
|
||||||
}
|
}
|
||||||
addValueSetMetadata(renderCanonicalResource(vs, false), vs);
|
addValueSetMetadata(renderCanonicalResource(vs, false), vs);
|
||||||
|
int i = 0;
|
||||||
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
||||||
genInclude(vs, inc, "Include");
|
genInclude(vs, inc, "Include", i++);
|
||||||
}
|
}
|
||||||
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
|
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
|
||||||
genInclude(vs, exc, "Exclude");
|
genInclude(vs, exc, "Exclude", i++);
|
||||||
}
|
}
|
||||||
if (vs.hasExpansion()) {
|
if (vs.hasExpansion()) {
|
||||||
if (vs.getExpansion().hasParameter()) {
|
if (vs.getExpansion().hasParameter()) {
|
||||||
|
@ -82,11 +75,11 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
|
||||||
return value ? "" : "false";
|
return value ? "" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void genInclude(ValueSet vs, ConceptSetComponent inc, String mode) {
|
private void genInclude(ValueSet vs, ConceptSetComponent inc, String mode, int count) {
|
||||||
if (inc.hasSystem()) {
|
if (inc.hasSystem()) {
|
||||||
genIncludeSystem(vs, inc, mode);
|
genIncludeSystem(vs, inc, mode, count);
|
||||||
} else {
|
} else {
|
||||||
genIncludeValueSets(vs, inc, mode);
|
genIncludeValueSets(vs, inc, mode, count);
|
||||||
}
|
}
|
||||||
// String subname = inc.hasSystem() ? : "ValueSets";
|
// String subname = inc.hasSystem() ? : "ValueSets";
|
||||||
//
|
//
|
||||||
|
@ -107,14 +100,14 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
|
||||||
// configureSheet(sheet, sd);
|
// configureSheet(sheet, sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode) {
|
private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode, int count) {
|
||||||
Sheet sheet = makeSheet(mode+" ValueSets");
|
Sheet sheet = makeSheet(mode+" ValueSet #"+count);
|
||||||
addValueSets(sheet, inc.getValueSet());
|
addValueSets(sheet, inc.getValueSet());
|
||||||
configureSheet(sheet);
|
configureSheet(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode) {
|
private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode, int count) {
|
||||||
Sheet sheet = makeSheet(mode+" from "+dr.displaySystem(inc.getSystem()));
|
Sheet sheet = makeSheet(mode+" #"+count);
|
||||||
if (inc.hasValueSet()) {
|
if (inc.hasValueSet()) {
|
||||||
addValueSets(sheet, inc.getValueSet());
|
addValueSets(sheet, inc.getValueSet());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package org.hl7.fhir.r5.elementmodel;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.formats.JsonCreatorDirect;
|
||||||
|
import org.hl7.fhir.r5.test.utils.CompareUtilities;
|
||||||
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
|
import org.hl7.fhir.utilities.i18n.LanguageFileProducer;
|
||||||
|
import org.hl7.fhir.utilities.i18n.PoGetTextProducer;
|
||||||
|
import org.hl7.fhir.utilities.tests.ResourceLoaderTests;
|
||||||
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
class LanguageUtilsTest implements ResourceLoaderTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void importFromTranslations() throws Exception {
|
||||||
|
|
||||||
|
IWorkerContext context = TestingUtilities.getSharedWorkerContext();
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.elementmodel.JsonParser jp = new org.hl7.fhir.r5.elementmodel.JsonParser(context);
|
||||||
|
InputStream resource = getResourceAsInputStream("languageUtils", "CodeSystem-answer.json");
|
||||||
|
Element element = jp.parseSingle(resource, null);
|
||||||
|
|
||||||
|
PoGetTextProducer lp = new PoGetTextProducer();
|
||||||
|
List<LanguageFileProducer.TranslationUnit> res = new ArrayList<>();
|
||||||
|
res.addAll(lp.loadSource(getResourceAsInputStream("languageUtils", "CodeSystem-answer.po")));
|
||||||
|
|
||||||
|
List<ValidationMessage> lvm = new ArrayList<>();
|
||||||
|
lvm.add(new ValidationMessage());
|
||||||
|
LanguageUtils languageUtils = new LanguageUtils(context);
|
||||||
|
int result = languageUtils.importFromTranslations(element, res, lvm);
|
||||||
|
|
||||||
|
Writer generatedResource = new StringWriter();
|
||||||
|
jp.compose(element, new JsonCreatorDirect(generatedResource, false, false));
|
||||||
|
|
||||||
|
assert result == 3;
|
||||||
|
|
||||||
|
InputStream translatedResource = getResourceAsInputStream("languageUtils", "CodeSystem-answer-translated.json");
|
||||||
|
String text = new BufferedReader(new InputStreamReader(translatedResource))
|
||||||
|
.lines()
|
||||||
|
.collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
String msg = CompareUtilities.checkJsonSrcIsSame("", generatedResource.toString(),text, null);
|
||||||
|
Assertions.assertNull(msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -84,12 +84,12 @@ public class NarrativeGenerationTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLinkFor(String corePath, String typeSimple) {
|
public String getLinkFor(String corePath, String typeSimple) {
|
||||||
throw new NotImplementedException();
|
return "http://test/link";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BindingResolution resolveBinding(StructureDefinition def, ElementDefinitionBindingComponent binding, String path) throws FHIRException {
|
public BindingResolution resolveBinding(StructureDefinition def, ElementDefinitionBindingComponent binding, String path) throws FHIRException {
|
||||||
throw new NotImplementedException();
|
return new BindingResolution("test", "http://test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,7 +102,7 @@ public class NarrativeGenerationTests {
|
||||||
return new BindingResolution(vs.present(), "valueset-"+vs.getIdBase()+".html");
|
return new BindingResolution(vs.present(), "valueset-"+vs.getIdBase()+".html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new NotImplementedException();
|
return new BindingResolution("test", "http://test/ns");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,7 +120,7 @@ public class NarrativeGenerationTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLinkForUrl(String corePath, String s) {
|
public String getLinkForUrl(String corePath, String s) {
|
||||||
throw new NotImplementedException();
|
return "http://test/link/url";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"resourceType" : "CodeSystem",
|
||||||
|
"id" : "basic-answer",
|
||||||
|
"language" : "en",
|
||||||
|
"url" : "https://example.com/CodeSystem/basic-answer",
|
||||||
|
"version" : "0.1.0",
|
||||||
|
"name" : "BasicAnswer",
|
||||||
|
"title" : "Administration-Method",
|
||||||
|
"status" : "active",
|
||||||
|
"date" : "2024-04-07",
|
||||||
|
"publisher" : "Sample",
|
||||||
|
"description" : "Basic answers for any kind of questions.",
|
||||||
|
"caseSensitive" : false,
|
||||||
|
"content" : "complete",
|
||||||
|
"count" : 3,
|
||||||
|
"concept" : [ {
|
||||||
|
"code" : "ok",
|
||||||
|
"display" : "OK",
|
||||||
|
"designation" : [ {
|
||||||
|
"language" : "it",
|
||||||
|
"value" : "OK"
|
||||||
|
} ]
|
||||||
|
}, {
|
||||||
|
"code" : "yes",
|
||||||
|
"display" : "Yes",
|
||||||
|
"designation" : [ {
|
||||||
|
"language" : "it",
|
||||||
|
"value" : "Si"
|
||||||
|
} ]
|
||||||
|
}, {
|
||||||
|
"code" : "no",
|
||||||
|
"display" : "No",
|
||||||
|
"designation" : [ {
|
||||||
|
"language" : "it",
|
||||||
|
"value" : "No"
|
||||||
|
} ]
|
||||||
|
} ]
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"resourceType": "CodeSystem",
|
||||||
|
"status": "active",
|
||||||
|
"content": "complete",
|
||||||
|
"name": "BasicAnswer",
|
||||||
|
"id": "basic-answer",
|
||||||
|
"title": "Administration-Method",
|
||||||
|
"description": "Basic answers for any kind of questions.",
|
||||||
|
"url": "https://example.com/CodeSystem/basic-answer",
|
||||||
|
"concept": [
|
||||||
|
{
|
||||||
|
"code": "ok",
|
||||||
|
"display": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "yes",
|
||||||
|
"display": "Yes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "no",
|
||||||
|
"display": "No"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"language": "en",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"date": "2024-04-07",
|
||||||
|
"publisher": "Sample",
|
||||||
|
"caseSensitive": false,
|
||||||
|
"count": 3
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
# en -> it
|
||||||
|
|
||||||
|
#: CanonicalResource.name
|
||||||
|
#. A natural language name identifying the code system. This name should be usable as an identifier for the module by machine processing applications such as code generation.
|
||||||
|
msgid "BasicAnswer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CanonicalResource.title
|
||||||
|
#. A short, descriptive, user-friendly title for the code system.
|
||||||
|
msgid "Administration-Method"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CanonicalResource.publisher
|
||||||
|
#. The name of the organization or individual that published the code system.
|
||||||
|
msgid "Example Publisher"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CanonicalResource.description
|
||||||
|
#. A free text natural language description of the code system from a consumer's perspective.
|
||||||
|
msgid "Basic answers for any kind of questions."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CodeSystem.concept.display
|
||||||
|
#. A human readable string that is the recommended default way to present this concept to a user.
|
||||||
|
msgid "OK"
|
||||||
|
msgstr "OK"
|
||||||
|
|
||||||
|
#: CodeSystem.concept.display
|
||||||
|
#. A human readable string that is the recommended default way to present this concept to a user.
|
||||||
|
msgid "Yes"
|
||||||
|
msgstr "Si"
|
||||||
|
|
||||||
|
#: CodeSystem.concept.display
|
||||||
|
#. A human readable string that is the recommended default way to present this concept to a user.
|
||||||
|
msgid "No"
|
||||||
|
msgstr "No"
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skipStaging>true</skipStaging>
|
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -30,61 +30,73 @@ public class PackageHacker {
|
||||||
private static boolean useSecureReferences = false;
|
private static boolean useSecureReferences = false;
|
||||||
|
|
||||||
public static void main(String[] args) throws FileNotFoundException, IOException {
|
public static void main(String[] args) throws FileNotFoundException, IOException {
|
||||||
new PackageHacker().massEdit(new File("/Users/grahamegrieve/web/hl7.org/fhir"));
|
// new PackageHacker().massEdit(new File("/Users/grahamegrieve/web/hl7.org/fhir"));
|
||||||
// new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/us/vitals/2020Sep/package.tgz");
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot1/hl7.fhir.r6.core.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot1/hl7.fhir.r6.corexml.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot1/hl7.fhir.r6.examples.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot1/hl7.fhir.r6.expansions.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot1/hl7.fhir.r6.search.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot2/hl7.fhir.r6.core.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot2/hl7.fhir.r6.corexml.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot2/hl7.fhir.r6.examples.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot2/hl7.fhir.r6.expansions.tgz");
|
||||||
|
new PackageHacker().edit("/Users/grahamegrieve/web/hl7.org/fhir/6.0.0-ballot2/hl7.fhir.r6.search.tgz");
|
||||||
|
|
||||||
|
// new PackageHacker().edit(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void massEdit(File dir) throws IOException {
|
// private void massEdit(File dir) throws IOException {
|
||||||
System.out.println("process "+dir.getAbsolutePath());
|
// System.out.println("process "+dir.getAbsolutePath());
|
||||||
for (File f : dir.listFiles()) {
|
// for (File f : dir.listFiles()) {
|
||||||
if (f.isDirectory()) {
|
// if (f.isDirectory()) {
|
||||||
massEdit(f);
|
// massEdit(f);
|
||||||
} else if (f.getName().equals("package.tgz")) {
|
// } else if (f.getName().equals("package.tgz")) {
|
||||||
try {
|
// try {
|
||||||
FileInputStream fs = ManagedFileAccess.inStream(f);
|
// FileInputStream fs = ManagedFileAccess.inStream(f);
|
||||||
NpmPackage pck = NpmPackage.fromPackage(fs);
|
// NpmPackage pck = NpmPackage.fromPackage(fs);
|
||||||
if ("fhir.core".equals(pck.getNpm().str("type"))) {
|
// if ("fhir.core".equals(pck.getNpm().str("type"))) {
|
||||||
System.out.println("!!change "+f.getAbsolutePath());
|
// System.out.println("!!change "+f.getAbsolutePath());
|
||||||
pck.getNpm().remove("type");
|
// pck.getNpm().remove("type");
|
||||||
pck.getNpm().set("type", "Core");
|
// pck.getNpm().set("type", "Core");
|
||||||
FileOutputStream fso = ManagedFileAccess.outStream(f);
|
// FileOutputStream fso = ManagedFileAccess.outStream(f);
|
||||||
try {
|
// try {
|
||||||
pck.save(fso);
|
// pck.save(fso);
|
||||||
} finally {
|
// } finally {
|
||||||
fso.close();
|
// fso.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
System.out.println("!!Error: "+e.getMessage());
|
// System.out.println("!!Error: "+e.getMessage());
|
||||||
}
|
// }
|
||||||
} else if (f.getName().startsWith("hl7.fhir.r") && f.getName().endsWith(".examples.tgz")) {
|
// } else if (f.getName().startsWith("hl7.fhir.r") && f.getName().endsWith(".examples.tgz")) {
|
||||||
try {
|
// try {
|
||||||
FileInputStream fs = ManagedFileAccess.inStream(f);
|
// FileInputStream fs = ManagedFileAccess.inStream(f);
|
||||||
NpmPackage pck = NpmPackage.fromPackage(fs);
|
// NpmPackage pck = NpmPackage.fromPackage(fs);
|
||||||
if ("fhir.examples".equals(pck.getNpm().str("type"))) {
|
// if ("fhir.examples".equals(pck.getNpm().str("type"))) {
|
||||||
System.out.println("!!change "+f.getAbsolutePath());
|
// System.out.println("!!change "+f.getAbsolutePath());
|
||||||
pck.getNpm().remove("type");
|
// pck.getNpm().remove("type");
|
||||||
pck.getNpm().set("type", "Examples");
|
// pck.getNpm().set("type", "Examples");
|
||||||
FileOutputStream fso = ManagedFileAccess.outStream(f);
|
// FileOutputStream fso = ManagedFileAccess.outStream(f);
|
||||||
try {
|
// try {
|
||||||
pck.save(fso);
|
// pck.save(fso);
|
||||||
} finally {
|
// } finally {
|
||||||
fso.close();
|
// fso.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
System.out.println("!!Error: "+e.getMessage());
|
// System.out.println("!!Error: "+e.getMessage());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void edit(String name) throws FileNotFoundException, IOException {
|
private void edit(String name) throws FileNotFoundException, IOException {
|
||||||
File f = ManagedFileAccess.file(name);
|
File f = ManagedFileAccess.file(name);
|
||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
throw new Error("Unable to find "+f.getAbsolutePath());
|
throw new Error("Unable to find "+f.getAbsolutePath());
|
||||||
|
|
||||||
|
System.out.println("Loading Package "+f.getAbsolutePath());
|
||||||
NpmPackage pck = null;
|
NpmPackage pck = null;
|
||||||
FileInputStream fs = ManagedFileAccess.inStream(f);
|
FileInputStream fs = ManagedFileAccess.inStream(f);
|
||||||
try {
|
try {
|
||||||
|
@ -95,15 +107,15 @@ public class PackageHacker {
|
||||||
System.out.println("Altering Package "+f.getAbsolutePath());
|
System.out.println("Altering Package "+f.getAbsolutePath());
|
||||||
System.out.println(nice(pck.getNpm()));
|
System.out.println(nice(pck.getNpm()));
|
||||||
|
|
||||||
change(pck.getNpm());
|
if (change(pck.getNpm())) {
|
||||||
|
|
||||||
System.out.println("Revised Package");
|
System.out.println("Revised Package");
|
||||||
System.out.println("=======================");
|
System.out.println("=======================");
|
||||||
System.out.println(nice(pck.getNpm()));
|
System.out.println(nice(pck.getNpm()));
|
||||||
System.out.println("=======================");
|
System.out.println("=======================");
|
||||||
System.out.print("save? y/n: ");
|
// System.out.print("save? y/n: ");
|
||||||
int r = System.in.read();
|
// int r = System.in.read();
|
||||||
if (r == 'y') {
|
// if (r == 'y') {
|
||||||
f.renameTo(ManagedFileAccess.file(Utilities.changeFileExt(name, ".tgz.bak")));
|
f.renameTo(ManagedFileAccess.file(Utilities.changeFileExt(name, ".tgz.bak")));
|
||||||
FileOutputStream fso = ManagedFileAccess.outStream(f);
|
FileOutputStream fso = ManagedFileAccess.outStream(f);
|
||||||
try {
|
try {
|
||||||
|
@ -111,6 +123,7 @@ public class PackageHacker {
|
||||||
} finally {
|
} finally {
|
||||||
fso.close();
|
fso.close();
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,10 +142,13 @@ public class PackageHacker {
|
||||||
return JsonParser.compose(json, true);
|
return JsonParser.compose(json, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void change(JsonObject npm) throws FileNotFoundException, IOException {
|
private boolean change(JsonObject npm) throws FileNotFoundException, IOException {
|
||||||
// fixVersions(npm, ver);
|
// fixVersions(npm, ver);
|
||||||
npm.remove("notForPublication");
|
if (npm.has("notForPublication")) {
|
||||||
npm.set("name", "hl7.fhir.us.vitals");
|
npm.remove("notForPublication");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fixVersionInContent(Map<String, byte[]> content) {
|
private void fixVersionInContent(Map<String, byte[]> content) {
|
||||||
|
|
|
@ -560,7 +560,6 @@ public class HierarchicalTableGenerator {
|
||||||
}
|
}
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TableModel {
|
public class TableModel {
|
||||||
|
|
|
@ -405,7 +405,7 @@
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skipStaging>true</skipStaging>
|
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -34,9 +34,9 @@ public class ConceptMapValidator extends BaseValidator {
|
||||||
private static final int TOO_MANY_CODES_TO_VALIDATE = 500;
|
private static final int TOO_MANY_CODES_TO_VALIDATE = 500;
|
||||||
|
|
||||||
public static class PropertyDefinition {
|
public static class PropertyDefinition {
|
||||||
private String type;
|
private final String type;
|
||||||
private String system;
|
private final String system;
|
||||||
private CodeSystem cs;
|
private final CodeSystem cs;
|
||||||
protected PropertyDefinition(String type, String system, CodeSystem cs) {
|
protected PropertyDefinition(String type, String system, CodeSystem cs) {
|
||||||
super();
|
super();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -94,7 +94,7 @@ public class ConceptMapValidator extends BaseValidator {
|
||||||
|
|
||||||
public class CMCodingValidationRequest extends CodingValidationRequest {
|
public class CMCodingValidationRequest extends CodingValidationRequest {
|
||||||
|
|
||||||
private NodeStack stack;
|
private final NodeStack stack;
|
||||||
|
|
||||||
public CMCodingValidationRequest(NodeStack stack, Coding code, ValueSet vs) {
|
public CMCodingValidationRequest(NodeStack stack, Coding code, ValueSet vs) {
|
||||||
super(code, vs);
|
super(code, vs);
|
||||||
|
@ -106,7 +106,7 @@ public class ConceptMapValidator extends BaseValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CMCodingValidationRequest> batch = new ArrayList<>();
|
private final List<CMCodingValidationRequest> batch = new ArrayList<>();
|
||||||
|
|
||||||
public ConceptMapValidator(BaseValidator parent) {
|
public ConceptMapValidator(BaseValidator parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
|
@ -237,7 +237,7 @@ public class ConceptMapValidator extends BaseValidator {
|
||||||
} else {
|
} else {
|
||||||
warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), sourceScope != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_UNKNOWN, e.getValue());
|
warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), sourceScope != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_UNKNOWN, e.getValue());
|
||||||
}
|
}
|
||||||
if (ctxt.source.version == null && ctxt.source.cs != null && !CodeSystemUtilities.isExemptFromMultipleVersionChecking(ctxt.source.url)) {
|
if (ctxt.source.version == null && ctxt.source.cs != null && !CodeSystemUtilities.isExemptFromMultipleVersionChecking(ctxt.source.url) && fetcher != null) {
|
||||||
Set<String> possibleVersions = fetcher.fetchCanonicalResourceVersions(null, valContext.getAppContext(), ctxt.source.url);
|
Set<String> possibleVersions = fetcher.fetchCanonicalResourceVersions(null, valContext.getAppContext(), ctxt.source.url);
|
||||||
warning(errors, NO_RULE_DATE, IssueType.INVALID, grp.line(), grp.col(), stack.getLiteralPath(), possibleVersions.size() <= 1, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_CANONICAL_MULTIPLE_POSSIBLE_VERSIONS,
|
warning(errors, NO_RULE_DATE, IssueType.INVALID, grp.line(), grp.col(), stack.getLiteralPath(), possibleVersions.size() <= 1, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_CANONICAL_MULTIPLE_POSSIBLE_VERSIONS,
|
||||||
ctxt.source.url, ctxt.source.cs.getVersion(), CommaSeparatedStringBuilder.join(", ", Utilities.sorted(possibleVersions)));
|
ctxt.source.url, ctxt.source.cs.getVersion(), CommaSeparatedStringBuilder.join(", ", Utilities.sorted(possibleVersions)));
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -21,7 +21,7 @@
|
||||||
<commons_compress_version>1.26.0</commons_compress_version>
|
<commons_compress_version>1.26.0</commons_compress_version>
|
||||||
<guava_version>32.0.1-jre</guava_version>
|
<guava_version>32.0.1-jre</guava_version>
|
||||||
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.5.20</validator_test_case_version>
|
<validator_test_case_version>1.5.21-SNAPSHOT</validator_test_case_version>
|
||||||
<jackson_version>2.17.0</jackson_version>
|
<jackson_version>2.17.0</jackson_version>
|
||||||
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
||||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||||
|
@ -710,7 +710,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
<version>1.6.13</version>
|
<version>1.7.0</version>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<serverId>ossrh</serverId>
|
<serverId>ossrh</serverId>
|
||||||
|
|
Loading…
Reference in New Issue