Skip to content

Commit

Permalink
xversion configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveregger committed Aug 26, 2024
1 parent c2930b1 commit 27ad01a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"request": "launch",
"mainClass": "ca.uhn.fhir.jpa.starter.Application",
"projectName": "matchbox-server",
"vmArgs": "-Dspring.config.additional-location=file:../../matchbox-int-tests/src/test/resources/application-validate-r4-ch.yaml",
"vmArgs": "-Dspring.config.additional-location=file:../../matchbox-int-tests/src/test/resources/application-validate-r4-ch-exchange.yaml",
"cwd": "${workspaceFolder}/matchbox-server"
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2024/08/xx Release 3.9.0

- initial support for FML transforms between different FHIR versions (R4, R4B, R5) [#265](https://github.com/ahdis/matchbox/issues/265)
- initial support for FML transforms between different FHIR versions (R4, R4B, R5) [#265](https://github.com/ahdis/matchbox/issues/265), set flag xVersion
- support for FHIR R4B in engine and server [#65](https://github.com/ahdis/matchbox/issues/65)
- upgrade to hapi-fhir 7.4.0 and org.hl7.fhir.core 6.3.20 [#267](https://github.com/ahdis/matchbox/issues/267)

Expand Down
1 change: 1 addition & 0 deletions docs/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ matchbox:
fhirVersion: 4.0.1
txServer: n/a
# onlyOneEngine: true
# xVersion : false
# igsPreloaded: ch.fhir.ig.ch-core#4.0.0-ballot
suppressWarnInfo:
hl7.fhir.r4.core#4.0.1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ public MatchboxEngine(SimpleWorkerContext context) throws FHIRException, IOExcep
setContext(context);
this.setVersion(context.getVersion());
context.setCanNoTS(true);

NpmPackage npmX = getPcm().loadPackage(CommonPackages.ID_XVER, CommonPackages.VER_XVER);
context.loadFromPackage(npmX, null);

this.setIgLoader(new IgLoader(this.getPcm(), this.getContext(), this.getVersion(), this.isDebug()));
try {
Expand Down
16 changes: 15 additions & 1 deletion matchbox-server/src/main/java/ch/ahdis/matchbox/CliContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ public boolean isHttpReadOnly() {
return this.httpReadOnly;
}

private boolean xVersion = false;

public boolean getXVersion() {
return xVersion;
}

@Autowired
public CliContext(Environment environment) {
// get al list of all JsonProperty of cliContext with return values property
Expand Down Expand Up @@ -209,6 +215,7 @@ public CliContext(Environment environment) {
this.onlyOneEngine = environment.getProperty("matchbox.fhir.context.onlyOneEngine", Boolean.class, false);
this.httpReadOnly = environment.getProperty("matchbox.fhir.context.httpReadOnly", Boolean.class, false);
this.extensions = Arrays.asList(environment.getProperty("matchbox.fhir.context.extensions", String[].class, new String[]{"any"}));
this.xVersion = environment.getProperty("matchbox.fhir.context.xVersion", Boolean.class, false);
}

public CliContext(CliContext other) {
Expand All @@ -228,6 +235,7 @@ public CliContext(CliContext other) {
this.onlyOneEngine = other.onlyOneEngine;
this.httpReadOnly = other.httpReadOnly;
this.extensions = other.extensions;
this.xVersion = other.xVersion;
}

@JsonProperty("ig")
Expand Down Expand Up @@ -607,6 +615,7 @@ public boolean equals(final Object o) {
&& forPublication == that.forPublication
&& allowExampleUrls == that.allowExampleUrls
&& onlyOneEngine == that.onlyOneEngine
&& xVersion == that.xVersion
&& httpReadOnly == that.httpReadOnly
&& htmlInMarkdownCheck == that.htmlInMarkdownCheck
&& Objects.equals(extensions, that.extensions)
Expand Down Expand Up @@ -658,7 +667,9 @@ public int hashCode() {
mode,
locale,
locations,
jurisdiction);
jurisdiction,
onlyOneEngine,
xVersion);
result = 31 * result + Arrays.hashCode(igsPreloaded);
return result;
}
Expand Down Expand Up @@ -699,6 +710,7 @@ public String toString() {
", jurisdiction='" + jurisdiction + '\'' +
", igsPreloaded=" + Arrays.toString(igsPreloaded) +
", onlyOneEngine=" + onlyOneEngine +
", xVersion=" + xVersion +
", httpReadOnly=" + httpReadOnly +
'}';
}
Expand Down Expand Up @@ -738,6 +750,8 @@ public void addContextToExtension(final Extension ext) {
addExtension(ext, "lang", new StringType(this.lang));
addExtension(ext, "snomedCT", new StringType(this.snomedCT));
addExtension(ext, "fhirVersion", new StringType(this.fhirVersion));
addExtension(ext, "xVersion", new BooleanType(this.xVersion));
addExtension(ext, "onlyOneEngine", new BooleanType(this.onlyOneEngine));
addExtension(ext, "ig", new StringType(this.ig));
// addExtension(ext, "questionnaireMode", new BooleanType(this.questionnaireMode));
// addExtension(ext, "level", new BooleanType(this.level));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public MatchboxEngine getMatchboxEngineNotSynchronized(final @Nullable String ca
cliContext = new CliContext(this.cliContext);
if (cliContext.getFhirVersion().equals("4.0.1")) {
log.debug("Preconfigure FHIR R4");
mainEngine = new MatchboxEngineBuilder().getEngineR4();
mainEngine = new MatchboxEngineBuilder().withXVersion(cliContext.getXVersion()).getEngineR4();
try {
mainEngine.setIgLoader(new IgLoaderFromJpaPackageCache(mainEngine.getPcm(),
mainEngine.getContext(),
Expand All @@ -293,7 +293,7 @@ public MatchboxEngine getMatchboxEngineNotSynchronized(final @Nullable String ca
this.configureValidationEngine(mainEngine, cliContext);
} else if (cliContext.getFhirVersion().equals("4.3.0")) {
log.debug("Preconfigure FHIR R4B");
mainEngine = new MatchboxEngineBuilder().getEngineR4B();
mainEngine = new MatchboxEngineBuilder().withXVersion(cliContext.getXVersion()).getEngineR4B();
mainEngine.setIgLoader(new IgLoaderFromJpaPackageCache(mainEngine.getPcm(),
mainEngine.getContext(),
mainEngine.getVersion(),
Expand All @@ -306,7 +306,7 @@ public MatchboxEngine getMatchboxEngineNotSynchronized(final @Nullable String ca
this.configureValidationEngine(mainEngine, cliContext);
} else if (cliContext.getFhirVersion().equals("5.0.0")) {
log.debug("Preconfigure FHIR R5");
mainEngine = new MatchboxEngineBuilder().getEngineR5();
mainEngine = new MatchboxEngineBuilder().withXVersion(cliContext.getXVersion()).getEngineR5();
mainEngine.setIgLoader(new IgLoaderFromJpaPackageCache(mainEngine.getPcm(),
mainEngine.getContext(),
mainEngine.getVersion(),
Expand Down Expand Up @@ -413,13 +413,13 @@ public MatchboxEngine getMatchboxEngineNotSynchronized(final @Nullable String ca
try {
switch (cliContext.getFhirVersion()) {
case "5.0.0":
baseEngine = new MatchboxEngineBuilder().getEngineR5();
baseEngine = new MatchboxEngineBuilder().withXVersion(cliContext.getXVersion()).getEngineR5();
break;
case "4.3.0":
baseEngine = new MatchboxEngineBuilder().getEngineR4B();
baseEngine = new MatchboxEngineBuilder().withXVersion(cliContext.getXVersion()).getEngineR4B();
break;
case "4.0.1":
baseEngine = new MatchboxEngineBuilder().getEngineR4();
baseEngine = new MatchboxEngineBuilder().withXVersion(cliContext.getXVersion()).getEngineR4();
break;
default:
log.error("FHIR version not yet supported in mixed mode, needs to be added for version "
Expand Down
1 change: 1 addition & 0 deletions matchbox-server/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ matchbox:
context:
fhirVersion: 4.0.1
txServer: n/a
# xVersion: true
# onlyOneEngine: true
# igsPreloaded: ch.fhir.ig.ch-core#4.0.0-ballot
suppressWarnInfo:
Expand Down

0 comments on commit 27ad01a

Please sign in to comment.