Skip to content

Commit

Permalink
276 Provide version-less Gazelle profiles for current packages
Browse files Browse the repository at this point in the history
Fixes #276
  • Loading branch information
qligier committed Sep 16, 2024
1 parent 5f936d8 commit 0d063d1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
2024/09/ Release 3.9.1
2024/09/16 Release 3.9.1
- Make CORS configurable, default not activated make cors configurable (now activated) [#271](https://github.com/ahdis/matchbox/issues/271)
- server API FML transforms between different FHIR versions (R4, R4B, R5) [#265](https://github.com/ahdis/matchbox/issues/265), set flag xVersion
- show a notification on errors in the validation GUI [#272](https://github.com/ahdis/matchbox/issues/272)
- ignore info/warnings also in slicing info [#273](https://github.com/ahdis/matchbox/issues/273)
- Gazelle validation reports with no issues should pass [#274](https://github.com/ahdis/matchbox/issues/274)
- update frontend dependencies
- provide version-less Gazelle profiles for current packages [#276](https://github.com/ahdis/matchbox/issues/276)

2024/09/10 Release 3.9.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.ahdis.matchbox.gazelle;

import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionResourceEntity;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.util.StopWatch;
import ch.ahdis.fhir.hapi.jpa.validation.ValidationProvider;
Expand Down Expand Up @@ -96,17 +97,32 @@ public Service getMetadata(final HttpServletRequest request) {
@GetMapping(path = PROFILES_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
public List<ValidationProfile> getProfiles() {
// Filter the extensions, because they won't be validated directly
return this.structureDefinitionProvider.getPackageResources().stream()
final List<NpmPackageVersionResourceEntity> entities =
this.structureDefinitionProvider.getPackageResources().stream()
.filter(packageVersionResource -> !packageVersionResource.getFilename().startsWith(SD_EXTENSION_TITLE_PREFIX))
.map(packageVersionResource -> {
.toList();

final var profiles = new ArrayList<ValidationProfile>(entities.size()*2);
entities.forEach(packageVersionResource -> {
final var profile = new ValidationProfile();
final var version = packageVersionResource.getCanonicalVersion();
profile.setProfileID("%s|%s".formatted(packageVersionResource.getCanonicalUrl(), version));
// PATCHed: filename contains the StructureDefinition title.
profile.setProfileName("%s (%s)".formatted(packageVersionResource.getFilename(), version));
profile.setDomain(packageVersionResource.getPackageVersion().getPackageId());
return profile;
}).toList();
profiles.add(profile);

// If the package is current, we also add it version-less
if (packageVersionResource.getPackageVersion().isCurrentVersion()) {
final var profile2 = new ValidationProfile();
profile2.setProfileID(packageVersionResource.getCanonicalUrl());
// PATCHed: filename contains the StructureDefinition title.
profile2.setProfileName(packageVersionResource.getFilename());
profile2.setDomain(packageVersionResource.getPackageVersion().getPackageId());
profiles.add(profile2);
}
});
return profiles;
}

/**
Expand Down

0 comments on commit 0d063d1

Please sign in to comment.