GenomicDataInfrastructure / gdi-userportal-dataset-discovery-service

0 stars 1 forks source link

Add language resources #141

Closed brunopacheco1 closed 3 weeks ago

brunopacheco1 commented 3 weeks ago

Summary by Sourcery

Introduce language resource support in the PackageShowMapper and update OpenAPI specifications to handle multilingual data. Enhance tests to ensure correct parsing of language information.

New Features:

Enhancements:

Tests:

sourcery-ai[bot] commented 3 weeks ago

Reviewer's Guide by Sourcery

This PR adds language resource support to the data model and mapping functionality. The changes include updating OpenAPI specifications to include language fields, enhancing the data mapping logic, and updating tests to cover the new language-related functionality.

ER diagram for updated OpenAPI specifications

erDiagram
    CkanValueLabel {
        string displayName
        string name
    }

    ValueLabel {
        string value
        string label
    }

    CkanResource {
        string id
        string name
        string modified_date
        array language
    }
    CkanResource ||--o{ CkanValueLabel : has

    Distribution {
        string id
        string title
        string modified_at
        array languages
    }
    Distribution ||--o{ ValueLabel : has

Updated class diagram for PackageShowMapper

classDiagram
    class PackageShowMapper {
        +RetrievedDistribution distribution(CkanResource ckanResource)
    }

    class RetrievedDistribution {
        +OffsetDateTime modifiedAt
        +String accessUrl
        +String downloadUrl
        +List~CkanValueLabel~ languages
    }

    class CkanResource {
        +String modifiedDate
        +String accessUrl
        +String downloadUrl
        +List~CkanValueLabel~ language
    }

    class CkanValueLabelParser {
        +List~CkanValueLabel~ values(List~CkanValueLabel~ language)
    }

    PackageShowMapper --> RetrievedDistribution
    RetrievedDistribution --> CkanValueLabel
    CkanResource --> CkanValueLabel
    PackageShowMapper --> CkanValueLabelParser

File-Level Changes

Change Details Files
Added language support in OpenAPI specifications
  • Added language array field to CKAN schema with CkanValueLabel items
  • Added languages array field to Discovery schema with ValueLabel items
src/main/openapi/ckan.yaml
src/main/openapi/discovery.yaml
Enhanced data mapping functionality for language resources
  • Updated distribution mapping to include language values
  • Improved null check using StringUtils.isBlank() for date parsing
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/PackageShowMapper.java
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/CkanDatetimeParser.java
Updated test cases to include language resource testing
  • Added language field testing in the package mapping test
  • Added test cases for language value and label mapping
src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java

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. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### 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/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).