diff --git a/.github/integration-test/ontology/dse/profile_tree.json b/.github/integration-test/ontology/dse/profile_tree.json index 718c85e4..0011dc10 100644 --- a/.github/integration-test/ontology/dse/profile_tree.json +++ b/.github/integration-test/ontology/dse/profile_tree.json @@ -1,63 +1,135 @@ { - "name": "Root", - "module": "no-module", - "url": "no-url", - "children": [ + "name": "Root", + "module": "no-module", + "url": "no-url", + "children": [ + { + "id": "e5dbef02-a690-4f5a-b1b9-081302aff04d", + "name": "modul-medikation", + "display": { + "original": "Medikation", + "translations": [ + { + "language": "de-DE", + "value": "Medikation" + }, + { + "language": "en-US", + "value": "Medication" + } + ] + }, + "url": "modul-medikation", + "module": "modul-medikation", + "selectable": false, + "leaf": false, + "children": [ { - "id": "de5c2903-00aa-4d64-92e5-2161d56e3daf", - "children": [ - { - "id": "69f4718f-1767-4517-90f8-6c079f627eed", - "name": "MII_PR_Medikation_MedicationStatement", - "display": "MII PR Medikation MedicationStatement", - "module": "modul-medikation", - "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement", - "leaf": true, - "selectable": true - }, - { - "id": "83b4d6be-b3e1-451a-adf2-c307477e7b97", - "name": "MII_PR_Medikation_Medikationsliste", - "display": "MII PR Medikation Medikationsliste", - "module": "modul-medikation", - "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/medikationsliste", - "leaf": true, - "selectable": true - }, - { - "id": "fd375ed9-b3cd-414f-8a56-c70e10bb9609", - "name": "MII_PR_Medikation_MedicationRequest", - "display": "MII PR Medikation MedicationRequest", - "module": "modul-medikation", - "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationRequest", - "leaf": true, - "selectable": true - }, - { - "id": "323a3ad1-1c10-45f5-848a-2dc5fb100c47", - "name": "MII_PR_Medikation_Medication", - "display": "MII PR Medikation Medication", - "module": "modul-medikation", - "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/Medication", - "leaf": true, - "selectable": true - }, - { - "id": "81ed0f03-1d77-49c9-8391-d4c25702652c", - "name": "MII_PR_Medikation_MedicationAdministration", - "display": "MII PR Medikation MedicationAdministration", - "module": "modul-medikation", - "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationAdministration", - "leaf": true, - "selectable": true - } - ], - "name": "modul-medikation", - "display": "Medikation", - "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement", - "module": "modul-medikation", - "selectable": true, - "leaf": false + "id": "5486577b-430b-4a42-a3c8-28c6d6eaf4e8", + "name": "MII_PR_Medikation_MedicationStatement", + "display": { + "original": "MII PR Medikation MedicationStatement", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation MedicationStatement" + } + ] + }, + "module": "modul-medikation", + "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement", + "leaf": true, + "selectable": true + }, + { + "id": "491759f1-8afc-4a35-9a35-34642211f02a", + "name": "MII_PR_Medikation_Medikationsliste", + "display": { + "original": "MII PR Medikation Medikationsliste", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation Medicationlist" + } + ] + }, + "module": "modul-medikation", + "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/medikationsliste", + "leaf": true, + "selectable": true + }, + { + "id": "9d1fe081-3964-4951-b743-716d1b60d779", + "name": "MII_PR_Medikation_MedicationRequest", + "display": { + "original": "MII PR Medikation MedicationRequest", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation MedicationRequest" + } + ] + }, + "module": "modul-medikation", + "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationRequest", + "leaf": true, + "selectable": true + }, + { + "id": "1026f31f-78ec-4e20-9b40-c5b02b857bc3", + "name": "MII_PR_Medikation_Medication", + "display": { + "original": "MII PR Medikation Medication", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation Medication" + } + ] + }, + "module": "modul-medikation", + "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/Medication", + "leaf": true, + "selectable": true + }, + { + "id": "d8affe77-892f-45b5-8747-b5ca5400d1be", + "name": "MII_PR_Medikation_MedicationAdministration", + "display": { + "original": "MII PR Medikation MedicationAdministration", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation MedicationAdministration" + } + ] + }, + "module": "modul-medikation", + "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationAdministration", + "leaf": true, + "selectable": true } - ] + ] + } + ] } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 0f50adca..b689735b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ 17 4.10.0 4.10.0 - v3.0.0-test.7 + v3.0.0-test.11 diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DisplayEntry.java b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DisplayEntry.java new file mode 100644 index 00000000..2fae710f --- /dev/null +++ b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DisplayEntry.java @@ -0,0 +1,15 @@ +package de.numcodex.feasibility_gui_backend.dse.api; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Builder +public record DisplayEntry( + @JsonProperty String original, + @JsonProperty List translations + ) { +} diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfile.java b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfile.java index 649b0234..0ff50e78 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfile.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfile.java @@ -10,7 +10,7 @@ @Builder public record DseProfile( @JsonProperty String url, - @JsonProperty String display, + @JsonProperty DisplayEntry display, @JsonProperty List fields, @JsonProperty List filters, @JsonProperty String errorCode, diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfileTreeNode.java b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfileTreeNode.java index 93c954a5..4e8f9192 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfileTreeNode.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/DseProfileTreeNode.java @@ -12,7 +12,7 @@ public record DseProfileTreeNode( @JsonProperty String id, @JsonProperty List children, @JsonProperty String name, - @JsonProperty String display, + @JsonProperty DisplayEntry display, @JsonProperty String module, @JsonProperty String url, @JsonProperty boolean leaf, diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/Field.java b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/Field.java index 4ca0b3b4..a9312877 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/Field.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/Field.java @@ -10,8 +10,8 @@ @Builder public record Field( @JsonProperty String id, - @JsonProperty String display, - @JsonProperty String name, + @JsonProperty DisplayEntry display, + @JsonProperty DisplayEntry description, @JsonProperty String type, @JsonProperty List children ) { diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/LocalizedValue.java b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/LocalizedValue.java new file mode 100644 index 00000000..e2edf722 --- /dev/null +++ b/src/main/java/de/numcodex/feasibility_gui_backend/dse/api/LocalizedValue.java @@ -0,0 +1,13 @@ +package de.numcodex.feasibility_gui_backend.dse.api; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Builder +public record LocalizedValue( + @JsonProperty String language, + @JsonProperty String value +) { +} diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/dse/DseServiceTest.java b/src/test/java/de/numcodex/feasibility_gui_backend/dse/DseServiceTest.java index c357147b..a23cf6b1 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/dse/DseServiceTest.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/dse/DseServiceTest.java @@ -3,7 +3,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; +import de.numcodex.feasibility_gui_backend.dse.api.DisplayEntry; import de.numcodex.feasibility_gui_backend.dse.api.DseProfileTreeNode; +import de.numcodex.feasibility_gui_backend.dse.api.LocalizedValue; import de.numcodex.feasibility_gui_backend.dse.persistence.DseProfile; import de.numcodex.feasibility_gui_backend.dse.persistence.DseProfileRepository; import org.junit.jupiter.api.BeforeEach; @@ -129,9 +131,23 @@ private de.numcodex.feasibility_gui_backend.dse.api.DseProfile createDummyDsePro return de.numcodex.feasibility_gui_backend.dse.api.DseProfile.builder() .url("http://example.com") - .display("some-display") + .display(createDummyDisplayEntry()) .fields(List.of()) .filters(List.of()) .build(); } + + private DisplayEntry createDummyDisplayEntry() { + return DisplayEntry.builder() + .original("some-display") + .translations(List.of(createDummyTranslation())) + .build(); + } + + private LocalizedValue createDummyTranslation() { + return LocalizedValue.builder() + .language("en") + .value("display value") + .build(); + } } \ No newline at end of file diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/dse/v4/DseRestControllerIT.java b/src/test/java/de/numcodex/feasibility_gui_backend/dse/v4/DseRestControllerIT.java index cc9a2669..f3932f74 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/dse/v4/DseRestControllerIT.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/dse/v4/DseRestControllerIT.java @@ -2,8 +2,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import de.numcodex.feasibility_gui_backend.dse.DseService; +import de.numcodex.feasibility_gui_backend.dse.api.DisplayEntry; import de.numcodex.feasibility_gui_backend.dse.api.DseProfile; import de.numcodex.feasibility_gui_backend.dse.api.DseProfileTreeNode; +import de.numcodex.feasibility_gui_backend.dse.api.LocalizedValue; import de.numcodex.feasibility_gui_backend.query.ratelimiting.RateLimitingInterceptor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -77,7 +79,7 @@ void testGetProfileData_succeedsWith200OnFoundProfile() throws Exception { mockMvc.perform(get(URI.create(PATH_API + PATH_DSE + "/profile-data")).param("ids", "https://www.medizininformatik-initiative.de/fhir/core/modul-labor/StructureDefinition/ObservationLab,foobar").with(csrf())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$[0].display").value("some-display")); + .andExpect(jsonPath("$[0].display.original").value("some-display")); } @Test @@ -95,9 +97,23 @@ private DseProfile createDummyDseProfileEntry() { return DseProfile.builder() .url("http://example.com") - .display("some-display") + .display(createDummyDisplayEntry()) .fields(List.of()) .filters(List.of()) .build(); } + + private DisplayEntry createDummyDisplayEntry() { + return DisplayEntry.builder() + .original("some-display") + .translations(List.of(createDummyTranslation())) + .build(); + } + + private LocalizedValue createDummyTranslation() { + return LocalizedValue.builder() + .language("en") + .value("display value") + .build(); + } } \ No newline at end of file diff --git a/src/test/resources/ontology/dse/profile_tree.json b/src/test/resources/ontology/dse/profile_tree.json index 718c85e4..83c1b732 100644 --- a/src/test/resources/ontology/dse/profile_tree.json +++ b/src/test/resources/ontology/dse/profile_tree.json @@ -7,45 +7,105 @@ "id": "de5c2903-00aa-4d64-92e5-2161d56e3daf", "children": [ { - "id": "69f4718f-1767-4517-90f8-6c079f627eed", + "id": "28913b3f-3f9d-473b-a38f-2e63f7f45ea3", "name": "MII_PR_Medikation_MedicationStatement", - "display": "MII PR Medikation MedicationStatement", + "display": { + "original": "MII PR Medikation MedicationStatement", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation MedicationStatement" + } + ] + }, "module": "modul-medikation", "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement", "leaf": true, "selectable": true }, { - "id": "83b4d6be-b3e1-451a-adf2-c307477e7b97", + "id": "d90ed770-c7ec-4b00-8032-539444b31040", "name": "MII_PR_Medikation_Medikationsliste", - "display": "MII PR Medikation Medikationsliste", + "display": { + "original": "MII PR Medikation Medikationsliste", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation Medicationlist" + } + ] + }, "module": "modul-medikation", "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/medikationsliste", "leaf": true, "selectable": true }, { - "id": "fd375ed9-b3cd-414f-8a56-c70e10bb9609", + "id": "b149b0f7-368e-4529-ae6a-11cf9ce46fd2", "name": "MII_PR_Medikation_MedicationRequest", - "display": "MII PR Medikation MedicationRequest", + "display": { + "original": "MII PR Medikation MedicationRequest", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation MedicationRequest" + } + ] + }, "module": "modul-medikation", "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationRequest", "leaf": true, "selectable": true }, { - "id": "323a3ad1-1c10-45f5-848a-2dc5fb100c47", + "id": "265efd74-ec95-4a9d-ba1d-a67d346f6e16", "name": "MII_PR_Medikation_Medication", - "display": "MII PR Medikation Medication", + "display": { + "original": "MII PR Medikation Medication", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation Medication" + } + ] + }, "module": "modul-medikation", "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/Medication", "leaf": true, "selectable": true }, { - "id": "81ed0f03-1d77-49c9-8391-d4c25702652c", + "id": "47609129-402a-4daf-9652-dd2c2fcc533d", "name": "MII_PR_Medikation_MedicationAdministration", - "display": "MII PR Medikation MedicationAdministration", + "display": { + "original": "MII PR Medikation MedicationAdministration", + "translations": [ + { + "language": "de-DE", + "value": "" + }, + { + "language": "en-US", + "value": "MII PR Medikation MedicationAdministration" + } + ] + }, "module": "modul-medikation", "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationAdministration", "leaf": true, @@ -53,7 +113,19 @@ } ], "name": "modul-medikation", - "display": "Medikation", + "display": { + "original": "Medikation", + "translations": [ + { + "language": "de-DE", + "value": "Medikation" + }, + { + "language": "en-US", + "value": "Medication" + } + ] + }, "url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement", "module": "modul-medikation", "selectable": true,