Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(my-pages): add location to vaccination detail #16464

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

disaerna
Copy link
Member

@disaerna disaerna commented Oct 18, 2024

My pages - Health - Vaccinations

What

Adding location to vaccinations detail table

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Added a location field to vaccination information, enhancing detail in the vaccination data returned.
    • Updated the healthDirectorateVaccinations query to include the new location field.
  • Bug Fixes

    • Replaced the display of the comment field with the new location field in the SortedVaccinationsTable component.
  • API Changes

    • Removed two vaccine-related endpoints and updated various schemas to reflect new properties and structural changes.

@disaerna disaerna requested review from a team as code owners October 18, 2024 12:47
Copy link
Contributor

coderabbitai bot commented Oct 18, 2024

Walkthrough

The pull request introduces updates to the HealthDirectorateService and related components to include a new location property in vaccination-related data structures. The getVaccinations method now returns this property in the vaccinationsInfo array, which is derived from the VaccinationDto. Additionally, modifications to the OpenAPI specification have occurred, including the removal of certain endpoints and the renaming and restructuring of schemas. These changes enhance the detail and structure of vaccination data returned in the API and GraphQL queries.

Changes

File Change Summary
libs/api/domains/health-directorate/src/lib/health-directorate.service.ts Updated getVaccinations method to include a new location property in the returned vaccinationsInfo array.
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts Added a new nullable location field to the Info class in the HealthDirectorateVaccinationsInfo GraphQL object type.
libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json Removed endpoints /v1/vaccines and /v1/vaccines/{vaccineId}; updated VaccinationDto to include vaccinationLocation; renamed VaccineDto to VaccineDiseaseDto with structural changes; updated several schemas to simplify and reference the new structure.
libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql Added a new location field in the vaccinationsInfo object of the healthDirectorateVaccinations query.
libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx Modified SortedVaccinationsTable to display the new location field instead of the comment field for vaccination entries.

Possibly related PRs

  • fix(service-portal): Health Directorate - Fixes #15728: The changes in this PR involve modifications to the HealthDirectorateVaccinations entity and the GraphQL queries related to vaccinations, which are directly connected to the updates made in the getVaccinations method and the addition of the location property in the vaccination information.

Suggested labels

automerge

Suggested reviewers

  • svanaeinars
  • thorkellmani

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx (1)

91-91: LGTM! Consider adding a comment for clarity.

The change from vaccination.comment to vaccination.location correctly implements the PR objective of adding location to vaccination details. It maintains type safety with the nullish coalescing operator and doesn't affect the component's reusability or tree-shaking potential.

For consistency and clarity, consider adding a brief comment explaining the purpose of this field, similar to other parts of the code. For example:

{
  // Display location of vaccination
  value: vaccination.location ?? '',
},
libs/api/domains/health-directorate/src/lib/health-directorate.service.ts (1)

102-102: LGTM! Consider adding explicit typing for improved clarity.

The addition of the location property aligns well with the PR objectives and enhances the vaccination information returned by the getVaccinations method. This change is consistent with the overall structure and purpose of the method.

To further improve the code:

Consider adding an explicit type for the location property in the Info interface (assuming it's the type used for elements in the vaccinationsInfo array). This would enhance type safety and documentation. For example:

interface Info {
  // ... other properties
  location: string; // or a more specific type if applicable
}

This change would make the type of the location property more explicit and self-documenting.

libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json (3)

693-693: LGTM! Consider adding a description for the new vaccinationLocation property.

The addition of vaccinationLocation to the VaccinationDto schema aligns well with the PR objective. It's correctly added to both the properties and required fields.

Consider adding a description for the vaccinationLocation property to provide more context about its purpose and expected format. For example:

-  "vaccinationLocation": { "type": "string" },
+  "vaccinationLocation": { 
+    "type": "string",
+    "description": "The location where the vaccination was administered"
+  },

Also applies to: 709-709


830-830: LGTM! Consider implementing additional validation for optional fields.

The reduction of required fields in DiseaseRuleDto increases flexibility in rule creation and updates. This change allows for more granular control over disease rules.

To maintain data integrity and prevent potential inconsistencies, consider implementing the following:

  1. Add server-side validation to ensure that optional fields, when provided, meet specific criteria or business rules.
  2. Implement default values for critical optional fields where appropriate.
  3. Document any constraints or dependencies between fields in the API documentation.

These measures will help maintain the robustness of the disease rule system while benefiting from the increased flexibility.


915-915: LGTM! Ensure backend validation for optional fields.

The reduction of required fields in CreateDiseaseRuleDto allows for more flexible creation of disease rules. This change aligns with the similar modification made to DiseaseRuleDto.

To maintain data integrity and consistency, consider implementing the following measures:

  1. Enhance backend validation to ensure that all necessary data is provided, even if not marked as required in the schema.
  2. Implement business logic to set default values for critical optional fields when not provided.
  3. Add clear documentation for API users, explaining which optional fields are recommended or required for specific use cases.
  4. Consider implementing a two-step creation process for complex rules, where a basic rule is created first and then updated with additional details.

These steps will help balance the flexibility provided by optional fields with the need for comprehensive and consistent disease rule data.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3552edc and 0b416f6.

📒 Files selected for processing (5)
  • libs/api/domains/health-directorate/src/lib/health-directorate.service.ts (1 hunks)
  • libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (1 hunks)
  • libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json (6 hunks)
  • libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1 hunks)
  • libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
libs/api/domains/health-directorate/src/lib/health-directorate.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (6)
libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1)

23-23: LGTM! Verify backend support for the new field.

The addition of the location field to the vaccinationsInfo object aligns well with the PR objective to enhance the vaccination detail table. This change will provide users with more comprehensive information about their vaccinations.

To ensure full compatibility, please verify that the backend GraphQL schema and resolvers have been updated to support this new field. Run the following script to check for corresponding backend changes:

libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (2)

Line range hint 1-41: Code adheres to guidelines and demonstrates good practices

The file vaccinations.model.ts demonstrates adherence to the coding guidelines for libs/**/* files:

  1. It defines reusable GraphQL object types that can be utilized across different NextJS apps within the project.
  2. TypeScript is effectively used for defining props and exporting types, enhancing type safety and developer experience.
  3. The modular structure of the code supports effective tree-shaking and bundling practices.

The overall code quality is high, with clear and consistent naming conventions, appropriate use of decorators, and well-structured class definitions.


40-41: LGTM: New location field added correctly

The addition of the location field to the Info class is well-implemented. It follows the existing code structure and correctly uses TypeScript and GraphQL decorators. This change aligns with the PR objective of adding location information to vaccination details.

To ensure this change is properly utilized, let's verify its usage in related files:

✅ Verification successful

Verification Successful: No usages of location field found

No references to the new location field in the Info class were found in the codebase. This confirms that the addition of the location field does not impact existing functionality and is correctly implemented.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of the new location field in related files

# Search for references to the Info class or its properties
rg --type typescript -g '!*.test.ts' -g '!*.spec.ts' "Info.*location|location.*Info" libs/api/domains/health-directorate/

Length of output: 158


Script:

#!/bin/bash
# Description: Check for usage of the new location field in related files

# Search for references to the Info class or its properties
rg --type=ts -g '!*.test.ts' -g '!*.spec.ts' "Info.*location|location.*Info" libs/api/domains/health-directorate/

Length of output: 115

libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx (1)

Line range hint 1-115: Excellent adherence to coding guidelines and best practices.

The SortedVaccinationsTable component demonstrates strong adherence to the specified coding guidelines:

  1. Reusability: The component is well-structured for reuse across different NextJS apps within the health module.
  2. TypeScript usage: Props are properly defined using TypeScript interfaces, enhancing type safety.
  3. Tree-shaking friendly: The component is a named export and uses imports from specific paths, facilitating effective tree-shaking.

Additionally, the component leverages shared components and internationalization, further enhancing its reusability and maintainability.

libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json (2)

784-792: LGTM! Please clarify the purpose of useInCalculations.

The renaming of VaccineDto to VaccineDiseaseDto and the restructuring of its properties improve the representation of vaccine-disease relationships. The addition of diseaseId as a required field enhances the schema's utility.

Could you please provide more context about the useInCalculations property? Specifically:

  1. What types of calculations does this property influence?
  2. Are there any specific business rules or use cases associated with this property?

This information would be valuable for maintaining and extending the API in the future.


851-851: LGTM! Consistent schema reference update.

The update of the vaccines property to reference VaccineDiseaseDto instead of VaccineDto maintains consistency with the earlier schema renaming. This change ensures that the DiseaseDto schema correctly reflects the updated structure of vaccine-disease relationships.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.75%. Comparing base (e384cdc) to head (90843c6).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16464      +/-   ##
==========================================
- Coverage   36.77%   36.75%   -0.02%     
==========================================
  Files        6847     6841       -6     
  Lines      141850   141254     -596     
  Branches    40417    40179     -238     
==========================================
- Hits        52165    51918     -247     
+ Misses      89685    89336     -349     
Flag Coverage Δ
api 3.37% <ø> (ø)
application-system-api 41.36% <ø> (ø)
application-template-api-modules 27.78% <ø> (-0.02%) ⬇️
application-ui-shell 21.36% <ø> (ø)
nest-core ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 64 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e384cdc...90843c6. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 18, 2024

Datadog Report

All test runs d36f283 🔗

5 Total Test Services: 0 Failed, 4 Passed
➡️ Test Sessions change in coverage: 14 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.81s 1 no change Link
application-system-api 0 0 0 120 2 3m 9.04s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 34.79s 1 no change Link
application-ui-shell 0 0 0 74 0 31.14s 1 no change Link
service-portal-health 0 0 0 0 0 513.85ms 1 no change Link

Copy link
Member

@thorkellmani thorkellmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@disaerna disaerna added the automerge Merge this PR as soon as all checks pass label Oct 21, 2024
@kodiakhq kodiakhq bot merged commit 9c1d3f1 into main Oct 21, 2024
43 checks passed
@kodiakhq kodiakhq bot deleted the my-pages/vaccination-updates branch October 21, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants