Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static final class CodeSystem extends MetadataResource {

// XXX do we need caseSensitive???
public static final String CONTENT = "content";
public static final String VALUE_SET = "valueSet";
// TODO valueSet
public static final String COUNT = "count";
// XXX do we need hierarchyMeaning???
Expand Down Expand Up @@ -115,6 +116,8 @@ public static final class CodeSystem extends MetadataResource {
.addAll(SUMMARY)
.add(TEXT)
.add(CONCEPT)
.add(COPYRIGHT)
.add(VALUE_SET)
.build();

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 B2i Healthcare, https://b2ihealthcare.com
* Copyright 2021-2025 B2i Healthcare, https://b2ihealthcare.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,6 +52,16 @@ default int count(ServiceProvider context, ResourceURI resourceUri) {
.execute(context)
.getTotal();
}

/**
* Compute and return the ValueSet URL to set that denotes the entire CodeSystem.
*
* @param codeSystem - to use its configured properties to construct the necessary ValueSet URL
* @since 9.8.0
*/
default String computeValueSet(CodeSystem codeSystem) {
return null;
}

/**
* Implementers may expand a FHIR CodeSystem with its concepts if they wish to include them. This method by default does nothing.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 B2i Healthcare, https://b2ihealthcare.com
* Copyright 2021-2025 B2i Healthcare, https://b2ihealthcare.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -118,5 +118,7 @@ protected void expandResourceSpecificFields(RepositoryContext context, CodeSyste
includeIfFieldSelected(R5ObjectFields.CodeSystem.PROPERTY, () -> converter.expandProperties(context, resourceURI, locales()), properties -> {
properties.forEach(entry::addProperty);
});

includeIfFieldSelected(R5ObjectFields.CodeSystem.VALUE_SET, () -> converter.computeValueSet(entry), entry::setValueSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.b2international.fhir.FhirCodeSystems;
import com.b2international.snowowl.fhir.core.R5ObjectFields;
import com.b2international.snowowl.fhir.rest.tests.FhirRestTest;
import com.b2international.snowowl.snomed.fhir.SnomedUri;
import com.b2international.snowowl.test.commons.codesystem.CodeSystemRestRequests;
import com.b2international.snowowl.test.commons.rest.RestExtensions;

Expand All @@ -50,6 +51,7 @@ public void GET_CodeSystem() throws Exception {
.body("total", notNullValue()) // actual number depends on test data, just verify existence
.body("entry[0].resource.id", equalTo(getTestCodeSystemId()))
.body("entry[0].resource.url", equalTo(getTestCodeSystemUrl()))
.body("entry[0].resource.valueSet", equalTo(String.join("?", getTestCodeSystemUrl(), SnomedUri.QueryPart.PREFIX_VS)))
.body("entry[0].resource.count", equalTo(1943)); // base RF2 package count
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 B2i Healthcare, https://b2ihealthcare.com
* Copyright 2021-2025 B2i Healthcare, https://b2ihealthcare.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,6 +36,12 @@
*/
public class SnomedFhirCodeSystemResourceConverter implements FhirCodeSystemResourceConverter {

@Override
public String computeValueSet(CodeSystem codeSystem) {
// make sure the ValueSet always points to fhir_vs using the complete URI of the CodeSystem system + version
return String.join("?", codeSystem.getUrl(), SnomedUri.QueryPart.PREFIX_VS);
}

@Override
public List<CodeSystem.PropertyComponent> expandProperties(ServiceProvider context, ResourceURI resourceURI, List<ExtendedLocale> locales) {
final ImmutableList.Builder<CodeSystem.PropertyComponent> properties = ImmutableList.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public String getUrlString() {
*/
public static class QueryPart {

private static final String PREFIX_VS = "fhir_vs";
private static final String PREFIX_CM = "fhir_cm";
public static final String PREFIX_VS = "fhir_vs";
public static final String PREFIX_CM = "fhir_cm";

private String queryParameter;
private QueryPartDefinition queryPartDefinition = QueryPartDefinition.NONE;
Expand Down