Skip to content

Commit

Permalink
#380 - Change structure of dse profile_tree and profile details for t…
Browse files Browse the repository at this point in the history
…ranslations (#381)

* #380 - Change structure of dse profile_tree and profile details for translations

- update ontology to v3.0.0-test.11
- modify DseProfile and Field according to changes in dse profile database entry
- modify DseProfileTreeNode according to changes in profile_tree.json
  • Loading branch information
michael-82 authored Oct 17, 2024
1 parent bbc408f commit e915994
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 78 deletions.
190 changes: 131 additions & 59 deletions .github/integration-test/ontology/dse/profile_tree.json
Original file line number Diff line number Diff line change
@@ -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
}
]
]
}
]
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<java.version>17</java.version>
<mockwebserver.version>4.10.0</mockwebserver.version>
<okhttp3.version>4.10.0</okhttp3.version>
<ontology-tag>v3.0.0-test.7</ontology-tag>
<ontology-tag>v3.0.0-test.11</ontology-tag>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<LocalizedValue> translations
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Builder
public record DseProfile(
@JsonProperty String url,
@JsonProperty String display,
@JsonProperty DisplayEntry display,
@JsonProperty List<Field> fields,
@JsonProperty List<Filter> filters,
@JsonProperty String errorCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public record DseProfileTreeNode(
@JsonProperty String id,
@JsonProperty List<DseProfileTreeNode> children,
@JsonProperty String name,
@JsonProperty String display,
@JsonProperty DisplayEntry display,
@JsonProperty String module,
@JsonProperty String url,
@JsonProperty boolean leaf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Field> children
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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();
}
}
Loading

0 comments on commit e915994

Please sign in to comment.