GenomicDataInfrastructure / gdi-userportal-dataset-discovery-service

0 stars 1 forks source link

Upgrade discovery service for ckanext-dcat 2.0 #126

Closed Markus92 closed 2 months ago

Markus92 commented 2 months ago

🚀 Pull Request Checklist

This pull requests updates the discovery service for the new DCAT mapping made in ckanext-dcat 2.0; This also prepares us for CKAN 2.11

Note: breaks API compatibility with previous versions! Publisher and Creator are changed compared to previous versions on the user-facing side. Legacy fields like publisherName and contactUrl have been retired in favor of foaf:Agent objects.

Changes are necessary for compatibility with upstream CKAN.

Tested against fresh version of gdi-userportal-ckan-docker with master version of ckanext-dcat, v1.3.1 of gdi-ckanext-fairdatapoint and latest version of ckanext-gdi-userportal.

As discussed this afternoon, will need to plan the release well ;)

Summary by Sourcery

Upgrade the discovery service to support the new DCAT mapping in ckanext-dcat 2.0, replacing legacy fields with foaf:Agent objects for publishers and creators, and update OpenAPI specifications and tests accordingly.

New Features:

Enhancements:

Documentation:

Tests:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request updates the discovery service to be compatible with ckanext-dcat 2.0 and prepares for CKAN 2.11. The changes primarily involve restructuring the data models for publishers, creators, and contact points, moving away from legacy fields to more structured representations using foaf:Agent objects. This update breaks API compatibility with previous versions.

Sequence Diagram

sequenceDiagram
    participant CKAN as CKAN Package
    participant Mapper as PackageShowMapper
    participant Discovery as RetrievedDataset

    CKAN->>Mapper: CkanPackage data
    Mapper->>Mapper: Extract catalogue
    Mapper->>Mapper: Map organization
    Mapper->>Mapper: Parse dates
    Mapper->>Mapper: Map creators (agents)
    Mapper->>Mapper: Map publishers (agents)
    Mapper->>Mapper: Map contacts
    Mapper->>Mapper: Map distributions
    Mapper->>Discovery: Mapped RetrievedDataset

File-Level Changes

Change Details Files
Refactored data models for publishers, creators, and contact points
  • Replaced publisherName with a list of publisher objects
  • Changed creator from a simple name-identifier pair to a more detailed Agent object
  • Updated contactPoint to contact with a revised structure
  • Added new fields to Agent objects including email, url, and type
src/main/openapi/ckan.yaml
src/main/openapi/discovery.yaml
src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java
Updated mapping logic in PackageShowMapper
  • Modified from method to handle new data structures
  • Removed creator method and added agents method to handle both creators and publishers
  • Updated contactPointEntry method to use new field names
src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java
Updated test cases to reflect new data structures
  • Modified test data to use new Agent and ContactPoint structures
  • Updated assertions to check for new fields and structures
src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java
Added new fields to CkanPackage schema
  • Added temporal_start and temporal_end fields
  • Replaced contact_point with contact
  • Added publisher field as an array of CkanAgent objects
src/main/openapi/ckan.yaml
Updated RetrievedDataset schema
  • Removed publisherName field
  • Changed creators from ValueLabel to Agent objects
  • Added publishers as an array of Agent objects
  • Updated contacts to use the new ContactPoint structure
src/main/openapi/discovery.yaml

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourceryai/) or [GitHub](https://github.com/sourcery-ai).