Skip to content

Commit

Permalink
Merge pull request #94 from ahdis/oe_321
Browse files Browse the repository at this point in the history
  • Loading branch information
qligier authored Apr 5, 2023
2 parents c9148a8 + a5c45b4 commit 3e7b0ef
Show file tree
Hide file tree
Showing 23 changed files with 423 additions and 950 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,18 @@ kubectl cp matchbox-test-app-d684cf865 ./fhir.logdir/
# MVN run unit tests

mvn -Dtest=CapabilityStatementTests test

# Making a release

To make a release, a [tag](https://github.com/ahdis/matchbox/tags) has to be created (e.g. `v.3.2.1`) in GitHub.
It will trigger two workflows:

1. The [Docker workflow](https://github.com/ahdis/matchbox/blob/main/.github/workflows/googleregistry.yml), that
builds a Docker container around `matchbox-server` and publishes it to the Google Artifact registry.
2. The [Maven workflow](https://github.com/ahdis/matchbox/blob/main/.github/workflows/central_repository.yml), that
builds the `matchbox-engine` JAR and publishes it to the Maven Central Repository. The version used is the one
specified in the POM.

If a pull request is merged to create the release, and that it modifies files in the `matchbox-frontend` module, the
tag should not be created before the [Angular workflow](https://github.com/ahdis/matchbox/blob/main/.github/workflows/angular_build.yml)
has completed. Otherwise, the Docker container will not contain the updated GUI.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2023/04/05 Release 3.2.1

- docker pull \
europe-west6-docker.pkg.dev/ahdis-ch/ahdis/matchbox:v3.2.1
- reenable proxy support for downloading packages
- update to core 5.6.116

2023/03/06 Release 3.2.0

- updated CDA core logical model 2.0 and added tests
Expand Down
2 changes: 1 addition & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if you have the rights you can download Matchbox as a docker container:

```
docker pull europe-west6-docker.pkg.dev/ahdis-ch/ahdis/matchbox:v3.2.0-SNAPSHOT
docker pull europe-west6-docker.pkg.dev/ahdis-ch/ahdis/matchbox:v3.2.1
```

## Configurable base image:
Expand Down
2 changes: 1 addition & 1 deletion matchbox-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>matchbox</artifactId>
<groupId>health.matchbox</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>

<artifactId>matchbox-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,11 @@ public org.hl7.fhir.r4.model.StructureDefinition getStructureDefinition(String p
public org.hl7.fhir.r4.model.Resource getCanonicalResource(String canonical) {
org.hl7.fhir.r5.model.Resource fetched = this.getContext().fetchResource(null, canonical);
// allResourcesById is not package aware (???) so we need to fetch it again
// if (fetched!=null) {
// org.hl7.fhir.r5.model.Resource fetched2 = this.getContext().fetchResource(fetched.getClass(), canonical);
// if (fetched2 != null) {
// return VersionConvertorFactory_40_50.convertResource(fetched2);
// }
// }
if (fetched !=null) {
return VersionConvertorFactory_40_50.convertResource(fetched);
if (fetched!=null) {
org.hl7.fhir.r5.model.Resource fetched2 = this.getContext().fetchResource(fetched.getClass(), canonical);
if (fetched2 != null) {
return VersionConvertorFactory_40_50.convertResource(fetched2);
}
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CapabilityStatement;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode;
import org.hl7.fhir.r5.model.Enumerations.CodeSystemContentMode;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
Expand Down Expand Up @@ -793,7 +793,10 @@ public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean h
if (pIn == null) {
throw new Error(formatMessage(I18nConstants.NO_PARAMETERS_PROVIDED_TO_EXPANDVS));
}

if (vs.getUrl().equals("http://hl7.org/fhir/ValueSet/all-time-units") || vs.getUrl().equals("http://hl7.org/fhir/ValueSet/all-distance-units")) {
return new ValueSetExpansionOutcome("This value set is not expanded correctly at this time (will be fixed in a future version)", TerminologyServiceErrorClass.VALUESET_UNSUPPORTED);
}

Parameters p = pIn.copy();

if (vs.hasExpansion()) {
Expand Down Expand Up @@ -827,21 +830,26 @@ public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean h

// ok, first we try to expand locally
ValueSetExpanderSimple vse = constructValueSetExpanderSimple();
res = null;
try {
res = vse.expand(vs, p);
allErrors.addAll(vse.getAllErrors());
if (res.getValueset() != null) {
if (!res.getValueset().hasUrl()) {
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET));
}
txCache.cacheExpansion(cacheToken, res, TerminologyCache.TRANSIENT);
return res;
}
} catch (Exception e) {
allErrors.addAll(vse.getAllErrors());
e.printStackTrace();
res = new ValueSetExpansionOutcome(e.getMessage(), TerminologyServiceErrorClass.UNKNOWN);
}

allErrors.addAll(vse.getAllErrors());
if (res.getValueset() != null) {
if (!res.getValueset().hasUrl()) {
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET));
}
txCache.cacheExpansion(cacheToken, res, TerminologyCache.TRANSIENT);
return res;
}
if (res.getErrorClass() == TerminologyServiceErrorClass.INTERNAL_ERROR) { // this class is created specifically to say: don't consult the server
return new ValueSetExpansionOutcome(res.getError(), res.getErrorClass());
}

// if that failed, we try to expand on the server
if (addDependentResources(p, vs)) {
p.addParameter().setName("cache-id").setValue(new StringType(cacheId));
Expand Down Expand Up @@ -1208,7 +1216,7 @@ protected ValidationResult validateOnServer(ValueSet vs, Parameters pin, Validat
if (isTxCaching && cacheId != null && vs.getUrl() != null && cached.contains(vs.getUrl()+"|"+vs.getVersion())) {
pin.addParameter().setName("url").setValue(new UriType(vs.getUrl()+(vs.hasVersion() ? "|"+vs.getVersion() : "")));
} else if (options.getVsAsUrl()){
pin.addParameter().setName("url").setValue(new StringType(vs.getUrl()));
pin.addParameter().setName("url").setValue(new UriType(vs.getUrl()));
} else {
pin.addParameter().setName("valueSet").setResource(vs);
if (vs.getUrl() != null) {
Expand Down Expand Up @@ -1367,7 +1375,7 @@ public void setExpansionProfile(Parameters expParameters) {

@Override
public boolean isNoTerminologyServer() {
return noTerminologyServer;
return noTerminologyServer || txClient == null;
}

public void setNoTerminologyServer(boolean noTerminologyServer) {
Expand Down Expand Up @@ -2152,6 +2160,14 @@ public StructureDefinition fetchTypeDefinition(String typeName) {
}
}

@Override
public List<StructureDefinition> fetchTypeDefinitions(String typeName) {
List<StructureDefinition> res = new ArrayList<>();
structures.listAll(res);
res.removeIf(sd -> !sd.getType().equals(typeName));
return res;
}

public boolean isTlogging() {
return tlogging;
}
Expand All @@ -2174,63 +2190,63 @@ public String getLinkForUrl(String corePath, String url) {
}

if (codeSystems.has(url)) {
return codeSystems.get(url).getUserString("path");
return codeSystems.get(url).getWebPath();
}

if (valueSets.has(url)) {
return valueSets.get(url).getUserString("path");
return valueSets.get(url).getWebPath();
}

if (maps.has(url)) {
return maps.get(url).getUserString("path");
return maps.get(url).getWebPath();
}

if (transforms.has(url)) {
return transforms.get(url).getUserString("path");
return transforms.get(url).getWebPath();
}

if (actors.has(url)) {
return actors.get(url).getUserString("path");
return actors.get(url).getWebPath();
}

if (requirements.has(url)) {
return requirements.get(url).getUserString("path");
return requirements.get(url).getWebPath();
}

if (structures.has(url)) {
return structures.get(url).getUserString("path");
return structures.get(url).getWebPath();
}

if (guides.has(url)) {
return guides.get(url).getUserString("path");
return guides.get(url).getWebPath();
}

if (capstmts.has(url)) {
return capstmts.get(url).getUserString("path");
return capstmts.get(url).getWebPath();
}

if (measures.has(url)) {
return measures.get(url).getUserString("path");
return measures.get(url).getWebPath();
}

if (libraries.has(url)) {
return libraries.get(url).getUserString("path");
return libraries.get(url).getWebPath();
}

if (searchParameters.has(url)) {
return searchParameters.get(url).getUserString("path");
return searchParameters.get(url).getWebPath();
}

if (questionnaires.has(url)) {
return questionnaires.get(url).getUserString("path");
return questionnaires.get(url).getWebPath();
}

if (operations.has(url)) {
return operations.get(url).getUserString("path");
return operations.get(url).getWebPath();
}

if (plans.has(url)) {
return plans.get(url).getUserString("path");
return plans.get(url).getWebPath();
}

if (url.equals("http://loinc.org")) {
Expand Down Expand Up @@ -2401,4 +2417,4 @@ public PEBuilder getProfiledElementBuilder(PEElementPropertiesPolicy elementProp
// TODO Auto-generated method stub
return new PEBuilder(this, elementProps, fixedProps);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.hl7.fhir.utilities.json.model.JsonElement;
import org.hl7.fhir.utilities.json.model.JsonObject;
import org.hl7.fhir.utilities.json.parser.JsonParser;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.IPackageProvider;
import org.hl7.fhir.utilities.npm.NpmPackage.NpmPackageFolder;
import org.hl7.fhir.utilities.npm.PackageList.PackageListEntry;
import org.slf4j.Logger;
Expand Down Expand Up @@ -87,6 +88,14 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
public class FilesystemPackageCacheManager extends BasePackageCacheManager implements IPackageCacheManager {


// When running in testing mode, some packages are provided from the test case repository rather than by the normal means
// the PackageProvider is responsible for this. if no package provider is defined, or it declines to handle the package,
// then the normal means will be used
public interface IPackageProvider {
boolean handlesPackage(String id, String version);
InputStreamWithSrc provide(String id, String version) throws IOException;
}
private static IPackageProvider packageProvider;

// private static final String SECONDARY_SERVER = "http://local.fhir.org:8080/packages";
public static final String PACKAGE_REGEX = "^[a-zA-Z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+$";
Expand Down Expand Up @@ -404,8 +413,9 @@ public NpmPackage addPackageToCache(String id, String version, InputStream packa
throw new IOException("Attempt to import a mis-identified package. Expected " + id + ", got " + npm.name());
}
}
if (version == null)
if (version == null) {
version = npm.version();
}

String v = version;
return new CacheLock(id + "#" + version).doWithLock(() -> {
Expand Down Expand Up @@ -555,7 +565,9 @@ public NpmPackage loadPackage(String id, String version) throws FHIRException, I

// nup, don't have it locally (or it's expired)
FilesystemPackageCacheManager.InputStreamWithSrc source;
if ("current".equals(version) || (version!= null && version.startsWith("current$"))) {
if (packageProvider != null && packageProvider.handlesPackage(id, version)) {
source = packageProvider.provide(id, version);
} else if ("current".equals(version) || (version!= null && version.startsWith("current$"))) {
// special case - fetch from ci-build server
source = loadFromCIBuild(id, version.startsWith("current$") ? version.substring(8) : null);
} else {
Expand Down Expand Up @@ -1005,5 +1017,13 @@ public void setSuppressErrors(boolean suppressErrors) {
this.suppressErrors = suppressErrors;
}

public static IPackageProvider getPackageProvider() {
return packageProvider;
}

public static void setPackageProvider(IPackageProvider packageProvider) {
FilesystemPackageCacheManager.packageProvider = packageProvider;
}


}
2 changes: 1 addition & 1 deletion matchbox-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matchboxv3",
"version": "3.2.0",
"version": "3.2.1",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down
3 changes: 2 additions & 1 deletion matchbox-server/ig.http
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
###@host = http://localhost:8080/matchbox/fhir
# @host = https://test.ahdis.ch/matchbox/fhir

@host = http://ehealthsuisse.ihe-europe.net:8622/matchbox/fhir
### @host = http://ehealthsuisse.ihe-europe.net:8622/matchbox/fhir
@host = http://gazelle.ihe.net/matchbox/fhir

###
GET {{host}}/metadata HTTP/1.1
Expand Down
Loading

0 comments on commit 3e7b0ef

Please sign in to comment.