diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java index 3de7088..3ef5ec9 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java @@ -76,15 +76,15 @@ public DatasetsSearchResponse search(DatasetSearchQuery query, String accessToke return datasetsSearchService.search(query, accessToken); } - var resultsets = queryOnBeaconIfThereAreBeaconFilters(beaconAuthorization, query); + var resultSets = queryOnBeaconIfThereAreBeaconFilters(beaconAuthorization, query); var datasetsSearchResponse = queryOnCkanIfThereIsNoBeaconFilterOrResultsetsIsNotEmpty( accessToken, query, - resultsets + resultSets ); - return enhanceDatasetsResponse(beaconAuthorization, datasetsSearchResponse, resultsets); + return enhanceDatasetsResponse(beaconAuthorization, datasetsSearchResponse, resultSets); } private String retrieveBeaconAuthorization(String accessToken) { @@ -174,30 +174,30 @@ private DatasetSearchQuery enhanceQueryFacets( private DatasetsSearchResponse enhanceDatasetsResponse( String beaconAuthorization, - DatasetsSearchResponse datasetsSearchReponse, + DatasetsSearchResponse datasetsSearchResponse, List resultSets ) { var facetGroupCount = new HashMap(); facetGroupCount.put(BEACON_FACET_GROUP, resultSets.size()); - if (isNotEmpty(datasetsSearchReponse.getFacetGroupCount())) { - facetGroupCount.putAll(datasetsSearchReponse.getFacetGroupCount()); + if (isNotEmpty(datasetsSearchResponse.getFacetGroupCount())) { + facetGroupCount.putAll(datasetsSearchResponse.getFacetGroupCount()); } var facetGroups = new ArrayList(); facetGroups.add(beaconFilteringTermsService.listFilteringTerms(beaconAuthorization)); - if (isNotEmpty(datasetsSearchReponse.getFacetGroups())) { - facetGroups.addAll(datasetsSearchReponse.getFacetGroups()); + if (isNotEmpty(datasetsSearchResponse.getFacetGroups())) { + facetGroups.addAll(datasetsSearchResponse.getFacetGroups()); } var results = List.of(); - if (isNotEmpty(datasetsSearchReponse.getResults())) { + if (isNotEmpty(datasetsSearchResponse.getResults())) { var recordCounts = resultSets.stream() .collect(toMap( BeaconResultSet::getId, BeaconResultSet::getResultsCount )); - results = datasetsSearchReponse.getResults() + results = datasetsSearchResponse.getResults() .stream() .map(it -> it.toBuilder() .recordsCount(recordCounts.get(it.getIdentifier())) @@ -205,7 +205,7 @@ private DatasetsSearchResponse enhanceDatasetsResponse( .toList(); } - return datasetsSearchReponse.toBuilder() + return datasetsSearchResponse.toBuilder() .facetGroupCount(facetGroupCount) .facetGroups(facetGroups) .results(results) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java index 69b092e..61feab0 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java @@ -10,10 +10,7 @@ import io.github.genomicdatainfrastructure.discovery.model.RetrievedDataset; import io.github.genomicdatainfrastructure.discovery.model.RetrievedDistribution; import io.github.genomicdatainfrastructure.discovery.model.ValueLabel; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanOrganization; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanPackage; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanResource; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanTag; +import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*; import lombok.experimental.UtilityClass; import static java.util.Optional.ofNullable; @@ -57,7 +54,7 @@ public RetrievedDataset from(CkanPackage ckanPackage) { .build(); } - private List values(List values) { + private List values(List values) { return ofNullable(values) .orElseGet(List::of) .stream() @@ -77,6 +74,16 @@ private ValueLabel value(String value) { .orElse(null); } + private ValueLabel value(CkanValueLabel value) { + return ofNullable(value) + .filter(Objects::nonNull) + .map(it -> ValueLabel.builder() + .value(it.getName()) + .label(it.getDisplayName()) + .build()) + .orElse(null); + } + private LocalDateTime parse(String date) { return ofNullable(date) .map(it -> LocalDateTime.parse(it, DATE_FORMATTER)) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapper.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapper.java index 0a11d9f..ff75169 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapper.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapper.java @@ -9,11 +9,7 @@ import io.github.genomicdatainfrastructure.discovery.model.FacetGroup; import io.github.genomicdatainfrastructure.discovery.model.SearchedDataset; import io.github.genomicdatainfrastructure.discovery.model.ValueLabel; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanFacet; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanOrganization; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanPackage; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.PackagesSearchResponse; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.PackagesSearchResult; +import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*; import lombok.experimental.UtilityClass; import java.util.List; @@ -26,7 +22,6 @@ import java.time.LocalDateTime; import static java.util.Optional.ofNullable; -import static java.util.function.Predicate.not; @UtilityClass public class PackagesSearchResponseMapper { @@ -130,7 +125,7 @@ private LocalDateTime parse(String date) { .orElse(null); } - private List values(List values) { + private List values(List values) { return ofNullable(values) .orElseGet(List::of) .stream() @@ -139,13 +134,12 @@ private List values(List values) { .toList(); } - private ValueLabel value(String value) { + private ValueLabel value(CkanValueLabel value) { return ofNullable(value) .filter(Objects::nonNull) - .filter(not(String::isBlank)) .map(it -> ValueLabel.builder() - .value(it) - .label(it) + .value(it.getName()) + .label(it.getDisplayName()) .build()) .orElse(null); } diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index 5836dc7..22450f3 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -10,7 +10,7 @@ info: servers: - url: / paths: - /api/3/action/package_search: + /api/3/action/enhanced_package_search: get: summary: Searches for packages based on criteria operationId: package_search @@ -73,7 +73,7 @@ paths: application/json: schema: $ref: "#/components/schemas/PackagesSearchResponse" - /api/3/action/package_show: + /api/3/action/enhanced_package_show: get: summary: Retrieves a package by ID operationId: package_show @@ -137,20 +137,7 @@ components: items: type: array items: - $ref: "#/components/schemas/CkanFacetItem" - CkanFacetItem: - type: object - properties: - name: - type: string - display_name: - type: string - count: - type: integer - required: - - name - - display_name - - count + $ref: "#/components/schemas/CkanValueLabel" CkanPackage: type: object properties: @@ -165,7 +152,7 @@ components: theme: type: array items: - type: string + $ref: "#/components/schemas/CkanValueLabel" tags: type: array items: @@ -183,23 +170,23 @@ components: language: type: array items: - type: string - contact_uri: #TODO check if there are other attributes to form value/label + $ref: "#/components/schemas/CkanValueLabel" + contact_uri: type: string has_version: type: array items: - type: string + $ref: "#/components/schemas/CkanValueLabel" access_rights: - type: string + $ref: "#/components/schemas/CkanValueLabel" conforms_to: type: array items: - type: string + $ref: "#/components/schemas/CkanValueLabel" provenance: type: string - spatial_uri: #TODO check if there are other attributes to form value/label - type: string + spatial_uri: + $ref: "#/components/schemas/CkanValueLabel" resources: type: array items: @@ -230,7 +217,7 @@ components: description: type: string format: - type: string + $ref: "#/components/schemas/CkanValueLabel" uri: type: string created: @@ -281,3 +268,14 @@ components: type: string message: type: string + CkanValueLabel: + properties: + name: + type: string + display_name: + type: string + count: + type: integer + required: + - name + - display_name diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java index 22f250f..7f7a0ce 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java @@ -70,7 +70,7 @@ void can_search_datasets_with_beacon_filters() { .post("/api/v1/datasets/search") .then() .statusCode(200) - .body("count", equalTo(1)) + .body("count", equalTo(1167)) .body("results[0].recordsCount", equalTo(64)); } diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java index dd94ecb..b6a6631 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java @@ -4,20 +4,17 @@ package io.github.genomicdatainfrastructure.discovery.services; -import static java.time.LocalDateTime.parse; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; - -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanTag; -import org.junit.jupiter.api.Test; import io.github.genomicdatainfrastructure.discovery.model.RetrievedDataset; import io.github.genomicdatainfrastructure.discovery.model.RetrievedDistribution; import io.github.genomicdatainfrastructure.discovery.model.ValueLabel; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanOrganization; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanPackage; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanResource; +import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*; +import org.junit.jupiter.api.Test; + import java.time.format.DateTimeFormatter; +import java.util.List; + +import static java.time.LocalDateTime.parse; +import static org.assertj.core.api.Assertions.assertThat; class PackageShowMapperTest { @@ -51,7 +48,10 @@ void can_parse() { .identifier("identifier") .name("name") .notes("notes") - .theme(List.of("theme")) + .theme(List.of(CkanValueLabel.builder() + .displayName("theme") + .name("theme-name") + .build())) .publisherName("publisherName") .organization(CkanOrganization.builder() .title("organization") @@ -64,19 +64,40 @@ void can_parse() { .name("key") .build())) .url("url") - .language(List.of("language")) + .language(List.of( + CkanValueLabel.builder() + .displayName("language") + .name("en") + .build())) .contactUri("contactUri") - .hasVersion(List.of("hasVersion")) - .accessRights("accessRights") - .conformsTo(List.of("conformsTo")) + .hasVersion(List.of( + CkanValueLabel.builder() + .displayName("version") + .name("1") + .build())) + .accessRights(CkanValueLabel.builder() + .displayName("accessRights") + .name("public") + .build()) + .conformsTo(List.of( + CkanValueLabel.builder() + .displayName("conformsTo") + .name("conforms") + .build())) .provenance("provenance") - .spatialUri("spatialUri") + .spatialUri(CkanValueLabel.builder() + .displayName("spatial") + .name("uri") + .build()) .resources(List.of( CkanResource.builder() .id("resource_id") .name("resource_name") .description("resource_description") - .format("format") + .format(CkanValueLabel.builder() + .displayName("format") + .name("pdf") + .build()) .uri("uri") .created("2024-03-19T13:37:05.472970") .lastModified("2024-03-19T13:37:05.472970") @@ -92,7 +113,7 @@ void can_parse() { .description("notes") .themes(List.of( ValueLabel.builder() - .value("theme") + .value("theme-name") .label("theme") .build() )) @@ -103,7 +124,7 @@ void can_parse() { .url("url") .languages(List.of( ValueLabel.builder() - .value("language") + .value("en") .label("language") .build() )) @@ -113,17 +134,17 @@ void can_parse() { .build()) .hasVersions(List.of( ValueLabel.builder() - .value("hasVersion") - .label("hasVersion") + .value("1") + .label("version") .build() )) .accessRights(ValueLabel.builder() - .value("accessRights") + .value("public") .label("accessRights") .build()) .conformsTo(List.of( ValueLabel.builder() - .value("conformsTo") + .value("conforms") .label("conformsTo") .build() )) @@ -133,8 +154,8 @@ void can_parse() { .value("key") .build())) .spatial(ValueLabel.builder() - .value("spatialUri") - .label("spatialUri") + .value("uri") + .label("spatial") .build()) .distributions(List.of( RetrievedDistribution.builder() @@ -142,7 +163,7 @@ void can_parse() { .title("resource_name") .description("resource_description") .format(ValueLabel.builder() - .value("format") + .value("pdf") .label("format") .build()) .uri("uri") diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapperTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapperTest.java index a7fa0d1..b1aa20d 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapperTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackagesSearchResponseMapperTest.java @@ -9,18 +9,15 @@ import java.util.List; import java.util.Map; + +import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*; import org.junit.jupiter.api.Test; import io.github.genomicdatainfrastructure.discovery.model.DatasetsSearchResponse; import io.github.genomicdatainfrastructure.discovery.model.Facet; import io.github.genomicdatainfrastructure.discovery.model.FacetGroup; import io.github.genomicdatainfrastructure.discovery.model.SearchedDataset; import io.github.genomicdatainfrastructure.discovery.model.ValueLabel; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanFacet; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanFacetItem; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanOrganization; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanPackage; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.PackagesSearchResponse; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.PackagesSearchResult; + import java.time.format.DateTimeFormatter; class PackagesSearchResponseMapperTest { @@ -226,7 +223,7 @@ void can_parse() { CkanFacet.builder() .title("dummy label") .items(List.of( - CkanFacetItem.builder() + CkanValueLabel.builder() .name("value") .displayName("label") .build() @@ -239,7 +236,11 @@ void can_parse() { .identifier("identifier") .name("name") .notes("notes") - .theme(List.of("theme")) + .theme(List.of( + CkanValueLabel.builder() + .displayName("theme") + .name("theme") + .build())) .publisherName("publisherName") .organization(CkanOrganization.builder() .title("title") diff --git a/src/test/resources/mappings/package_search.json b/src/test/resources/mappings/package_search.json index 80822c5..2879c04 100644 --- a/src/test/resources/mappings/package_search.json +++ b/src/test/resources/mappings/package_search.json @@ -2,7 +2,7 @@ "priority": 2, "request": { "method": "GET", - "urlPattern": "/api/3/action/package_search.*" + "urlPattern": "/api/3/action/enhanced_package_search.*" }, "response": { "status": 200, @@ -270,16 +270,25 @@ }, "results": [ { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/d73d04ba-23f7-429f-8506-3aa9dccb0435#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/d73d04ba-23f7-429f-8506-3aa9dccb0435#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "0ddd7a13-ee11-4e5d-bbff-34e04a6a7949", - "identifier": "brainmriwml_vu", + "identifier": "27866022694497975", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -331,16 +340,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/e1c89dfd-d7b2-4fb0-960f-75d4cc3104bb#accessRights", + "access_rights": { + "display_name": "Access Rights", + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/e1c89dfd-d7b2-4fb0-960f-75d4cc3104bb#accessRights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "e2fc35e2-0a09-42d7-b2e7-2324758f89f1", "identifier": "euc_kauno_uc6", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -392,16 +410,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/63cc8a90-91c2-47f0-9053-a1e6e5b7d88a#accessRights", + "access_rights": { + "display_name": "Access Rights", + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/63cc8a90-91c2-47f0-9053-a1e6e5b7d88a#accessRights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "128bc39c-8a56-4b07-969d-3cdc2d0bff10", "identifier": "cp-tavi", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -453,16 +480,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/4a9094ae-b986-4624-a1b8-659dbbe89f75#accessRights", + "access_rights": { + "display_name": "Access Rights", + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/4a9094ae-b986-4624-a1b8-659dbbe89f75#accessRights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "28267a33-70c5-4827-b431-9d80e9e9327a", "identifier": "C14GIST_NKI", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -514,16 +550,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/c8412677-d3a3-4960-ba39-a912c0ea3603#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/c8412677-d3a3-4960-ba39-a912c0ea3603#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "f3ea26b6-2737-4f31-8df0-5373b8972c0b", "identifier": "hebon", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -575,16 +620,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/bdd43c94-2620-457e-aa4b-7139620ef911#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/bdd43c94-2620-457e-aa4b-7139620ef911#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "67987f8e-4429-48e3-bb4c-627ee180339b", "identifier": "euc_unipi_uc1", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -636,16 +690,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/25959b82-d81e-4721-9aaf-ca4a33756210#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/25959b82-d81e-4721-9aaf-ca4a33756210#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "887d67e1-39ee-43fc-bbb2-03f2e83ac477", "identifier": "merlin", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -824,16 +887,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/f4c505c5-bd39-44dc-91f0-b862a7dde813#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/f4c505c5-bd39-44dc-91f0-b862a7dde813#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "37293eac-b160-4513-aef0-490c5198b0dc", "identifier": "parelsnoer-ndz", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -885,16 +957,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/dd8482c7-bfe9-49d5-9b91-efd091cfa864#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/dd8482c7-bfe9-49d5-9b91-efd091cfa864#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "04f4908d-5a9d-46fd-a4b3-d9732775a74a", "identifier": "euc_fcrb_uc7", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -946,16 +1027,25 @@ "relationships_as_object": [] }, { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/4e681eb3-e87c-4771-b1ad-c6af707e8c13#accessRights", + "access_rights": { + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/4e681eb3-e87c-4771-b1ad-c6af707e8c13#accessRights", + "display_name": "Access Rights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "cebe6bb9-1194-4379-bd04-c86dfd80ec50", "identifier": "brainmriwml_ne", "isopen": false, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", diff --git a/src/test/resources/mappings/package_show.json b/src/test/resources/mappings/package_show.json index 73d26a3..46ab39a 100644 --- a/src/test/resources/mappings/package_show.json +++ b/src/test/resources/mappings/package_show.json @@ -1,7 +1,7 @@ { "request": { "method": "GET", - "url": "/api/3/action/package_show?id=e1b3eff9-13eb-48b0-b180-7ecb76b84454" + "url": "/api/3/action/enhanced_package_show?id=e1b3eff9-13eb-48b0-b180-7ecb76b84454" }, "response": { "status": 200, @@ -15,20 +15,36 @@ "help": "https://ckan-test.healthdata.nl/api/3/action/help_show?name=package_show", "success": true, "result": { - "access_rights": "https://health-ri.sandbox.semlab-leiden.nl/dataset/e134f4b7-25bb-4f28-a594-828b56deef5e#accessRights", + "access_rights": { + "display_name": "Access Rights", + "name": "https://health-ri.sandbox.semlab-leiden.nl/dataset/e134f4b7-25bb-4f28-a594-828b56deef5e#accessRights" + }, "conforms_to": [ - "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + { + "display_name": "Conforms to", + "name": "https://health-ri.sandbox.semlab-leiden.nl/profile/2f08228e-1789-40f8-84cd-28e3288c3604" + } ], "contact_uri": "https://orcid.org/0000-0003-1076-199X", "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "has_version": [ - "https://repo.metadatacenter.org/template-instances/92948e21-4361-406b-adc0-bb83f39ecca6" + { + "display_name":"version", + "name": "https://repo.metadatacenter.org/template-instances/92948e21-4361-406b-adc0-bb83f39ecca6" + } ], "id": "e1b3eff9-13eb-48b0-b180-7ecb76b84454", "identifier": "27866022694497975", "isopen": false, + "spatial_uri": { + "display_name": "Spatial Uri", + "name": "uri" + }, "language": [ - "http://id.loc.gov/vocabulary/iso639-1/en" + { + "display_name": "English", + "name": "http://id.loc.gov/vocabulary/iso639-1/en" + } ], "license_id": "", "license_title": "", @@ -57,12 +73,30 @@ "temporal_end": "2025-12-31", "temporal_start": "2020-01-01", "theme": [ - "http://purl.bioontology.org/ontology/ICD10CM/U07.1", - "http://purl.org/zonmw/covid19/10006", - "http://purl.org/zonmw/covid19/10014", - "http://purl.org/zonmw/covid19/10033", - "http://purl.org/zonmw/covid19/10091", - "http://purl.org/zonmw/generic/10095" + { + "display_name": "Bio ontology", + "name": "http://purl.bioontology.org/ontology/ICD10CM/U07.1" + }, + { + "display_name": "Covid 19", + "name": "http://purl.org/zonmw/covid19/10006" + }, + { + "display_name": "Covid 19", + "name": "http://purl.org/zonmw/covid19/10014" + }, + { + "display_name": "Covid 19", + "name": "http://purl.org/zonmw/covid19/10033" + }, + { + "display_name": "Covid 19", + "name": "http://purl.org/zonmw/covid19/10091" + }, + { + "display_name": "Generic", + "name": "http://purl.org/zonmw/generic/10095" + } ], "title": "COVID-NL cohort AUMC", "type": "dataset", diff --git a/src/test/resources/mappings/package_show_with_error.json b/src/test/resources/mappings/package_show_with_error.json index cec8465..37660dd 100644 --- a/src/test/resources/mappings/package_show_with_error.json +++ b/src/test/resources/mappings/package_show_with_error.json @@ -1,7 +1,7 @@ { "request": { "method": "GET", - "url": "/api/3/action/package_show?id=dataset_with_error" + "url": "/api/3/action/enhanced_package_show?id=dataset_with_error" }, "response": { "status": 500,