-
Notifications
You must be signed in to change notification settings - Fork 61
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
fix(service-portal): Health Directorate - Fixes #15728
Conversation
WalkthroughThe changes introduce new functionalities related to organ donation and vaccinations within the health directorate module. This includes the addition of new API endpoints, updates to GraphQL queries and mutations, modifications to service and resolver logic, and enhancements to data models. The updates streamline the handling of donor and vaccination data, improve data structure, and enhance user interaction through a more organized interface. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant API
participant Database
User->>Frontend: Request donor status
Frontend->>API: Fetch donor status with locale
API->>Database: Query donor data
Database-->>API: Return donor data
API-->>Frontend: Send donor data
Frontend-->>User: Display donor status
sequenceDiagram
participant User
participant Frontend
participant API
participant Database
User->>Frontend: Request vaccinations
Frontend->>API: Fetch vaccinations
API->>Database: Query vaccination data
Database-->>API: Return vaccination data
API-->>Frontend: Send vaccination data
Frontend-->>User: Display vaccinations
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
Datadog ReportAll test runs ✅ 6 Total Test Services: 0 Failed, 5 Passed Test Services
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15728 +/- ##
=======================================
Coverage 36.82% 36.82%
=======================================
Files 6692 6692
Lines 137101 137100 -1
Branches 38975 38975
=======================================
+ Hits 50481 50482 +1
+ Misses 86620 86618 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range, codebase verification and nitpick comments (2)
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (1)
41-68
: ClassVaccination
is well-designed for handling complex health data.The nullable fields allow for flexibility in data representation, which is crucial in health applications. Consider adding documentation comments to explain the purpose and usage of each field, especially for fields like
status
,statusName
, andstatusColor
which might not be immediately clear to other developers or API consumers.libs/service-portal/core/src/index.ts (1)
32-32
: Review of New Export inindex.ts
The addition of the
export * from './components/TabNavigation/TabBar'
statement at line 32 is a straightforward enhancement to the module's functionality. Here are some considerations:
- Consistency and Reusability: Ensure that the
TabBar
component is designed to be reusable across different parts of the application. This aligns with the PR's objective of enhancing reusability.- TypeScript Usage: Confirm that the
TabBar
component and its props are fully typed to leverage TypeScript's benefits for safer code.- Tree-shaking and Bundling: Verify that the export does not negatively impact the tree-shaking process or increase the bundle size unnecessarily. This is crucial for maintaining performance, especially in a large-scale application like a service portal.
Overall, the change is positive, but keep the above points in mind to ensure optimal integration and performance.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (30)
- apps/api/infra/api.ts (2 hunks)
- charts/islandis/values.dev.yaml (1 hunks)
- charts/islandis/values.prod.yaml (1 hunks)
- charts/islandis/values.staging.yaml (1 hunks)
- infra/src/dsl/xroad.ts (1 hunks)
- libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts (3 hunks)
- libs/api/domains/health-directorate/src/lib/health-directorate.service.ts (2 hunks)
- libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts (1 hunks)
- libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (1 hunks)
- libs/clients/health-directorate/src/index.ts (1 hunks)
- libs/clients/health-directorate/src/lib/clients/organ-donation/clientConfig.json (6 hunks)
- libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.config.ts (1 hunks)
- libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.provider.ts (1 hunks)
- libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.service.ts (3 hunks)
- libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json (17 hunks)
- libs/clients/health-directorate/src/lib/clients/vaccinations/vaccinations.config.ts (1 hunks)
- libs/clients/health-directorate/src/lib/clients/vaccinations/vaccinations.service.ts (2 hunks)
- libs/service-portal/core/src/index.ts (1 hunks)
- libs/service-portal/health/src/lib/messages.ts (2 hunks)
- libs/service-portal/health/src/module.tsx (2 hunks)
- libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql (1 hunks)
- libs/service-portal/health/src/screens/OrganDonation/OrganDonation.tsx (2 hunks)
- libs/service-portal/health/src/screens/OrganDonationRegistration/Limitations.tsx (2 hunks)
- libs/service-portal/health/src/screens/OrganDonationRegistration/Loader.tsx (1 hunks)
- libs/service-portal/health/src/screens/OrganDonationRegistration/RegistrationForm.tsx (4 hunks)
- libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1 hunks)
- libs/service-portal/health/src/screens/Vaccinations/VaccinationsWrapper.tsx (1 hunks)
- libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx (1 hunks)
- libs/service-portal/health/src/screens/Vaccinations/tables/VaccinationsDetailTable.tsx (1 hunks)
- libs/service-portal/health/src/utils/tagSelector.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.provider.ts
Additional context used
Path-based instructions (26)
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/clients/health-directorate/src/index.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/vaccinations.config.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/organ-donation/organDonation.config.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/service-portal/health/src/utils/tagSelector.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/service-portal/health/src/screens/OrganDonation/OrganDonation.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/OrganDonationRegistration/Loader.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."
libs/api/domains/health-directorate/src/lib/models/organ-donation.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/vaccinations.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/service-portal/health/src/screens/Vaccinations/tables/VaccinationsDetailTable.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."
libs/api/domains/health-directorate/src/lib/health-directorate.resolver.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/organ-donation/organDonation.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/service-portal/health/src/screens/OrganDonationRegistration/Limitations.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."
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.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."
libs/service-portal/health/src/screens/Vaccinations/VaccinationsWrapper.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."
libs/service-portal/core/src/index.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/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/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."
libs/service-portal/health/src/screens/OrganDonationRegistration/RegistrationForm.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."
libs/service-portal/health/src/module.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."
libs/clients/health-directorate/src/lib/clients/organ-donation/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."
apps/api/infra/api.ts (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
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."
infra/src/dsl/xroad.ts (1)
Pattern
infra/src/dsl/**/*
: "Confirm that the code adheres to the following:
- The clarity and expressiveness of the DSL syntax.
- Integration with Helm charts and Kubernetes resources.
- Documentation on how to use the DSL to create complex Helm values."
libs/service-portal/health/src/lib/messages.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."
Additional comments not posted (54)
libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1)
2-24
: Verify integration with frontend components.The GraphQL query
getVaccinations
has been significantly restructured. Ensure that the frontend components consuming this query have been updated to handle the new fields and structure. Check for any potential breaking changes due to the removal of old fields and the addition of new ones.libs/clients/health-directorate/src/index.ts (1)
15-15
: Verify usage of new export.The addition of
DiseaseVaccinationDtoVaccinationStatusEnum
to the exports enhances type safety. Verify that this new type is being used correctly across the application and does not conflict with existing types.Verification successful
Verification successful: Usage of
DiseaseVaccinationDtoVaccinationStatusEnum
is correct.The
DiseaseVaccinationDtoVaccinationStatusEnum
is appropriately used in the codebase. It is imported and registered as a GraphQL enum type, which aligns with its intended use. No conflicts or issues were found.
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts
: The enum is registered as a GraphQL enum type.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `DiseaseVaccinationDtoVaccinationStatusEnum` across the application. # Test: Search for the usage of `DiseaseVaccinationDtoVaccinationStatusEnum`. Expect: Correct usage and no conflicts. rg --type ts -A 5 $'DiseaseVaccinationDtoVaccinationStatusEnum'Length of output: 1232
libs/clients/health-directorate/src/lib/clients/vaccinations/vaccinations.config.ts (1)
17-20
: Verify new configuration settings.The updates to
XROAD_HEALTH_DIRECTORATE_VACCINATION_PATH
and the expansion of thescope
property inHealthDirectorateVaccinationsClientConfig
are significant. Ensure that these changes are correctly integrated into the system and do not conflict with other configurations.libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.config.ts (1)
17-20
: Review of Configuration ChangesThe updates to the
HealthDirectorateOrganDonationClientConfig
are well-aligned with the PR's objectives to enhance the organ donation services. The changes to the environment variable key and default value are appropriate and improve the specificity of the configuration. Additionally, the inclusion of a specific scope for organ donations is a positive change.However, it's crucial to ensure that these new configurations are properly integrated and utilized across the application. This includes updating any dependent services or components that rely on the old configuration key.
libs/service-portal/health/src/utils/tagSelector.ts (1)
4-14
: Enhancements totagSelector
FunctionThe modifications to the
tagSelector
function enhance its flexibility and robustness by allowing it to handle optional and null inputs effectively. The use ofisDefined
to check for undefined or null inputs before returning a default color is a good practice, ensuring that the function behaves predictably in various scenarios.The update to the mapping object to include new states ('undetermined' and 'valid') and the removal of the 'vaccinated' state are aligned with the evolving requirements of the application. It's important to ensure that these changes are reflected in the UI components that utilize this function to maintain consistency.
Overall, the changes are positive and improve the function's utility in the application.
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql (1)
1-36
: Refactoring of GraphQL Schema for Organ DonationThe updates to the GraphQL schema in the
OrganDonation
module significantly enhance the structure and clarity of the data returned by the queries and mutation. The introduction of nested objects and detailed fields for donor information and organ lists aligns with best practices for GraphQL.The changes to the queries (
getDonorStatus
andgetOrgansList
) and the mutation (updateOrganDonationInfo
) are well-thought-out and improve the granularity of the data. It's crucial to ensure that these changes are properly supported by the backend and correctly integrated with the frontend components to avoid any disruptions in functionality.libs/service-portal/health/src/screens/OrganDonationRegistration/Loader.tsx (1)
1-32
: Well-structured and responsive loader component.The
Loader
component is well-implemented with clear usage of conditional rendering based on the device type and efficient rendering of multiple loaders using array mapping. The use of TypeScript for props definition enhances type safety and code readability.
- Props Handling: The default prop for
amount
is set correctly, allowing flexibility in how many loader items are displayed.- Responsive Design: The component adjusts the size of the loader based on the device type, which is a good practice for responsive design.
- Performance: Using
React.Fragment
for keying each loader item in the list is a good practice to avoid unnecessary re-renders.Overall, the component adheres to good React and TypeScript practices and should perform well in the service portal environment.
libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts (1)
1-56
: Comprehensive enhancements to organ donation models.The changes to the GraphQL models in the
organ-donation.model.ts
file are well-thought-out and effectively enhance the data structure for organ donation:
- New and Renamed Classes: The transition from
DonorStatus
toDonor
with the addition ofLimitations
andOrgan
classes allows for a more detailed representation of donor preferences and limitations.- Field Decorators: The use of
@Field
decorators with type specifications and descriptions improves the API's self-documentation and usability.- Nullable Fields: The optionality of certain fields like
limitedOrgansList
andcomment
inLimitations
provides flexibility in how data can be provided and stored, which is crucial for handling real-world scenarios where not all data might be available.These changes align well with the objectives of enhancing the clarity and functionality of the organ donation module, ensuring that the data model can accommodate complex scenarios related to organ donation preferences.
libs/clients/health-directorate/src/lib/clients/vaccinations/vaccinations.service.ts (1)
45-45
: Simplified method signature ingetVaccinationDiseaseDetail
.The removal of the
input
parameter from thegetVaccinationDiseaseDetail
method simplifies the method signature and potentially improves the clarity of the service's API. This change should make the method easier to use and maintain, assuming that the necessary data can still be fetched without the removed parameter.
- Clarity and Maintainability: Simplifying method signatures where possible is a good practice, especially in public APIs.
- Error Handling: The continued use of
.catch(handle404)
ensures that the method gracefully handles cases where no data is available, which is crucial for robustness.Ensure that all dependent services and components that use this method are updated to reflect this change in the method signature.
Run the following script to verify the method usage:
Verification successful
Method signature update verified successfully.
The
getVaccinationDiseaseDetail
method's signature change has been correctly reflected in its usage within the codebase. The call inhealth-directorate.service.ts
matches the new signature, confirming that the necessary updates have been made.
- Location of Method Call:
libs/api/domains/health-directorate/src/lib/health-directorate.service.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all method calls to `getVaccinationDiseaseDetail` match the new signature. # Test: Search for the method usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'getVaccinationDiseaseDetail'Length of output: 90
Script:
#!/bin/bash # Description: Verify all method calls to `getVaccinationDiseaseDetail` match the new signature. # Test: Search for the method usage. Expect: Only occurrences of the new signature. rg --type ts -A 5 $'getVaccinationDiseaseDetail'Length of output: 1491
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (4)
4-6
: Enum registration is correct.The registration of
DiseaseVaccinationDtoVaccinationStatusEnum
asHealthDirectorateVaccinationsStatus
is correctly implemented usingregisterEnumType
.
9-13
: ClassAge
is well-defined.The nullable fields
years
andmonths
are appropriate, allowing for partial age information which is a common scenario in health data.
17-35
: ClassInfo
is correctly structured for optional data handling.The use of nullable fields for optional data like
name
,date
,age
,url
, andcomment
is well-implemented, making the API flexible for various data availability scenarios.
74-78
: ClassVaccinations
is correctly implemented as a container forVaccination
objects.This design pattern is effective for handling collections of data items in GraphQL APIs, facilitating easier data management and queries.
libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx (4)
1-12
: Approved import changes.The new imports are essential for the updated functionality of the component, such as handling empty states and sorting capabilities.
22-34
: Approved localization changes.Using
formatMessage
for table headers enhances internationalization support, making the application more accessible to a broader audience.
37-38
: Approved addition of empty state handling.The conditional rendering for an empty state is a user-friendly feature that improves the UX by providing clear feedback when no data is available.
15-15
: Approved change in data prop type.Making the
data
prop optional is a good practice for robustness, especially in asynchronous scenarios. Ensure that all usages ofdata
properly handle the case when it is undefined.Verification successful
Optional
data
prop is handled correctly.The use of optional chaining (
data?.map
) throughout the codebase ensures that the optional nature of thedata
prop is properly managed, preventing runtime errors whendata
is undefined. This confirms the robustness of the implementation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all usages of `data` handle the case when it is undefined. # Test: Search for the usage of `data` in the component. Expect: Proper handling of undefined. rg --type typescript -A 5 $'data\\?\\.map'Length of output: 76
Script:
#!/bin/bash # Description: Verify all usages of `data` handle the case when it is undefined. # Test: Search for the usage of `data` in the component. Expect: Proper handling of undefined. rg --type ts -A 5 $'data\\?\\.map'Length of output: 18530
libs/clients/health-directorate/src/lib/clients/organ-donation/clientConfig.json (4)
4-4
: Endpoint Renaming and Description Updates ApprovedThe renaming of the endpoint to
/v1/me/organ-donor-status
and the updates to the operation descriptions are clear and align with the enhanced focus on organ donation. These changes improve API clarity and specificity.Also applies to: 66-66
8-22
: Addition ofip
andlocale
Parameters ApprovedThe introduction of optional
ip
andlocale
parameters to theget
andpost
operations enhances the API's flexibility and usability, allowing for responses tailored to the user's geographical and language preferences.Also applies to: 71-78
226-229
: Schema Modification inOrganDonorDto
ApprovedThe change in the
OrganDonorDto
schema to referenceOrganDto
objects instead of simple strings for theexceptions
property enhances data representation and validation.Also applies to: 233-233
213-213
: Addition ofLocale
andOrganDto
Schemas ApprovedThe new
Locale
andOrganDto
schemas provide necessary and clear definitions for data types used in the API, enhancing data integrity and validation.Also applies to: 214-220
apps/api/infra/api.ts (1)
50-51
: Addition of Health Directorate Services ApprovedThe integration of
HealthDirectorateOrganDonation
andHealthDirectorateVaccination
into the service setup is correctly implemented and aligns with the PR's objectives to expand health-related functionalities.Also applies to: 432-433
libs/clients/health-directorate/src/lib/clients/vaccinations/clientConfig.json (3)
575-597
: Addition of New Endpoints and Properties ApprovedThe new endpoints
/v1/vaccines
and/v1/vaccines/{vaccineId}
along with the new properties in theVaccineDto
schema enhance the API's functionality and allow for more detailed management and retrieval of vaccine data.Also applies to: 706-730
Line range hint
760-791
: Updates toDiseaseVaccinationDto
Schema ApprovedThe addition of
isFeatured
andvaccinationStatusColor
properties to theDiseaseVaccinationDto
schema enhances the clarity and usability of the API by providing more detailed information about the vaccination status.
841-841
: Changes totype
Properties in Schemas ApprovedThe modification of the
type
property fromstring
toobject
in various schemas allows for a more complex and detailed data representation, aligning with the needs of the API to handle more intricate data structures.Also applies to: 959-959, 1005-1005
charts/islandis/values.staging.yaml (2)
355-355
: Review of New API Path for Organ DonationThe new API path for organ donation has been added correctly under the
api
section. This path is specific to the development environment (IS-DEV
), which aligns with the PR's intent to enhance health-related functionalities.
357-357
: Review of New API Path for VaccinationThe new API path for vaccination services is also correctly placed under the
api
section. It is designated for the development environment, consistent with the organ donation path, ensuring uniformity in the configuration.charts/islandis/values.prod.yaml (2)
345-345
: Review of New API Path for Organ DonationThe addition of the
XROAD_HEALTH_DIRECTORATE_ORGAN_DONATION_PATH
is correctly formatted and follows the established pattern for X-Road API paths. This path is crucial for integrating organ donation functionalities.
347-347
: Review of New API Path for VaccinationThe addition of the
XROAD_HEALTH_DIRECTORATE_VACCINATION_PATH
is correctly formatted and follows the established pattern for X-Road API paths. This path is crucial for integrating vaccination functionalities.charts/islandis/values.dev.yaml (2)
355-355
: Review of New API Path for Organ DonationThe new API path for organ donation has been added correctly. The format and placement are consistent with existing entries, ensuring uniformity in the configuration.
357-357
: Review of New API Path for VaccinationThe new API path for vaccination services has been added correctly. It follows the same format as other API paths in the configuration, maintaining consistency and clarity.
libs/service-portal/health/src/screens/Vaccinations/tables/VaccinationsDetailTable.tsx (1)
52-56
: Enhanced handling of empty states in the UI.The updated conditional rendering logic and the addition of a
Box
component around theEmptyTable
improve the clarity and structure of the UI when no data is present. This change enhances user experience by making the empty state more visually consistent and informative.libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts (3)
34-45
: Improved localization and data structure ingetDonorStatus
.The addition of the
locale
parameter allows for localized responses, enhancing the flexibility and usability of the API. The change in the return type toOrganDonation
aligns with the updated data models, providing a more structured and informative response.
46-53
: Enhanced data retrieval inresolveOrganList
.The use of the
@ResolveField
decorator to resolve a list ofOrgan
objects based on theOrganDonation
context is a robust enhancement. This method improves the API's capability to fetch relevant data efficiently, leveraging user context and locale.
69-74
: Simplified API method ingetVaccinations
.The method now directly returns
Vaccinations
, simplifying the API and potentially enhancing performance by reducing the complexity of data retrieval.libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.service.ts (2)
28-33
: Enhanced functionality with localization ingetOrganDonation
.The addition of the
Locale
parameter allows for localized data retrieval, enhancing the method's functionality and aligning with the PR objectives to provide more tailored services.
48-56
: Improved error handling and data structure inupdateOrganDonation
.The change in input type to
UpdateOrganDonorDto
allows for more structured updates. The inclusion oferror.message
in the error handling provides clearer feedback on issues, enhancing the robustness of the method.libs/service-portal/health/src/screens/OrganDonationRegistration/Limitations.tsx (5)
1-1
: Review of imports and initial setup.The imports are correctly organized, and the component uses appropriate hooks and components from the libraries. The use of
useState
from React for managing state is appropriate for this component's functionality.Also applies to: 3-4
7-8
: Update to interfaceLimitationsProps
.The change in the data type from
HealthDirectorateOrganDonationExceptionObject[]
toHealthDirectorateOrganDonationOrgan[]
and the addition of theselected
prop are aligned with the PR's objectives to handle different data structures and enhance component flexibility.
11-11
: Initialization of theLimitations
component.The component now accepts an additional
selected
prop which is used to initialize thechecked
state. This is a good practice as it allows the component to reflect pre-selected values, enhancing user experience.
13-13
: State management and checkbox handling logic.The state is initialized based on the
selected
prop, which is a robust way to handle optional pre-selections. ThehandleCheckboxChange
function is well-implemented, using functional updates to the state for better performance in asynchronous updates. The use of theid
property for managing checkbox states is a good practice, ensuring that the checkboxes are uniquely identifiable and correctly reflect the component's state.Also applies to: 37-44
30-30
: Rendering logic and checkbox component setup.The rendering logic correctly maps over the
data
array to produce checkboxes for each item. The use of theid
property for both theid
andvalue
attributes of theCheckbox
component ensures that the checkboxes are uniquely identifiable. This is crucial for correctly managing the state of the checkboxes and is a significant improvement in handling potential issues with non-unique names.Also applies to: 37-44
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.tsx (3)
4-4
: Introduction ofCardLoader
and update to data fetching policy.The addition of
CardLoader
enhances the user experience by providing a visual indicator during data loading. The adjustment of thefetchPolicy
to'no-cache'
is a strategic choice to ensure that the component always fetches the latest data, which is essential for displaying accurate donor status.Also applies to: 18-20
22-31
: Refinement of donor status handling and rendering logic.The new implementation simplifies the handling of donor status by directly checking if the donor has limitations and constructing a
cardText
string accordingly. This reduces complexity and enhances clarity in the rendering logic, making the component easier to maintain and understand.
39-81
: Updates to component rendering and conditional logic.The component now conditionally displays different messages based on the donor's status, which improves user feedback. The use of
CardLoader
during the loading state and the simplified conditional rendering logic for displaying theActionCard
are well-implemented, enhancing the responsiveness and clarity of the user interface.libs/service-portal/health/src/screens/OrganDonationRegistration/RegistrationForm.tsx (4)
24-24
: Introduction of new data fetching query and loader component.The use of
useGetOrgansListQuery
simplifies the data fetching process by consolidating the logic into a single query. The introduction of theLoader
component during the loading state enhances user experience by providing visual feedback.Also applies to: 38-38
42-55
: Simplification of state management for donor status.The state management for the donor's registration status has been significantly simplified, directly mapping the donor's status to radio button values. This reduces complexity and enhances the clarity of the component's logic.
68-71
: Refinement of form submission logic and state synchronization.The form submission logic has been adjusted to reflect the new data structure, ensuring that the component functions correctly with the updated backend logic. The synchronization of the
radioValue
state with thedonorStatus
in theuseEffect
hook ensures that the UI is always in sync with the fetched data.Also applies to: 78-87
102-186
: Enhancements to form rendering and user interaction.The form now includes a loading state that displays a
Loader
component, enhancing user experience during asynchronous operations. The conditional rendering logic for the form and the inclusion of theLimitations
component based on the donor's status are well-implemented, improving the clarity and functionality of the user interface.libs/service-portal/health/src/module.tsx (2)
65-66
: Correct implementation of lazy loading for theVaccinations
component.The lazy loading syntax is correctly used, and the path to the component is accurately specified.
223-223
: Proper use of theVaccinations
component in routing configuration.The
Vaccinations
component is correctly integrated into the routing configuration, ensuring that it renders appropriately for the relevant route.infra/src/dsl/xroad.ts (2)
894-903
: Correct configuration ofHealthDirectorateOrganDonation
.The constant is well-defined with appropriate environment-specific paths, ensuring consistent configuration across different deployment stages.
905-913
: Correct configuration ofHealthDirectorateVaccination
.The constant is well-defined with appropriate environment-specific paths, ensuring consistent configuration across different deployment stages.
libs/service-portal/health/src/lib/messages.ts (1)
1001-1020
: Proper addition of new message entries for organ donation and medical prescriptions.The new message entries are correctly defined with unique IDs and provide clear, comprehensive translations for the related features.
Also applies to: 1126-1137
libs/service-portal/health/src/screens/Vaccinations/VaccinationsWrapper.tsx
Outdated
Show resolved
Hide resolved
libs/api/domains/health-directorate/src/lib/health-directorate.service.ts
Outdated
Show resolved
Hide resolved
libs/service-portal/health/src/screens/Vaccinations/tables/SortedVaccinationsTable.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, some GraphQL issues
libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts
Show resolved
Hide resolved
libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts
Show resolved
Hide resolved
libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts
Show resolved
Hide resolved
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts
Outdated
Show resolved
Hide resolved
libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts
Outdated
Show resolved
Hide resolved
libs/api/domains/health-directorate/src/lib/health-directorate.service.ts
Outdated
Show resolved
Hide resolved
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql
Outdated
Show resolved
Hide resolved
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql
Outdated
Show resolved
Hide resolved
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql
Outdated
Show resolved
Hide resolved
libs/service-portal/health/src/screens/OrganDonationRegistration/RegistrationForm.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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, codebase verification and nitpick comments (1)
libs/service-portal/health/src/screens/OrganDonationRegistration/RegistrationForm.tsx (1)
Line range hint
24-186
: Refactoring of Organ Donation Registration FormThe refactoring of the
Form2
component inRegistrationForm.tsx
significantly improves the clarity and efficiency of the organ donation registration process. The use ofuseGetOrgansListQuery
to streamline data fetching and the simplified state management for donor status are notable improvements.Consider further enhancing the component by possibly abstracting some of the logic into custom hooks or utilities if the component grows in complexity. This can help maintain readability and testability.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (10)
- charts/islandis/values.staging.yaml (1 hunks)
- infra/src/dsl/xroad.ts (1 hunks)
- libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts (2 hunks)
- libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts (1 hunks)
- libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.service.ts (3 hunks)
- libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql (1 hunks)
- libs/service-portal/health/src/screens/OrganDonation/OrganDonation.tsx (2 hunks)
- libs/service-portal/health/src/screens/OrganDonationRegistration/RegistrationForm.tsx (4 hunks)
- libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1 hunks)
- libs/service-portal/health/src/screens/Vaccinations/VaccinationsWrapper.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (8)
- charts/islandis/values.staging.yaml
- infra/src/dsl/xroad.ts
- libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts
- libs/api/domains/health-directorate/src/lib/models/vaccinations.model.ts
- libs/clients/health-directorate/src/lib/clients/organ-donation/organDonation.service.ts
- libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql
- libs/service-portal/health/src/screens/OrganDonation/OrganDonation.tsx
- libs/service-portal/health/src/screens/Vaccinations/VaccinationsWrapper.tsx
Additional context used
Path-based instructions (2)
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/OrganDonationRegistration/RegistrationForm.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 not posted (1)
libs/service-portal/health/src/screens/Vaccinations/Vaccinations.graphql (1)
2-24
: GraphQL Query Update: Enhanced Vaccination Data StructureThe modifications to the GraphQL query
getVaccinations
enhance the data structure by focusing more on relevant vaccination details rather than disease-specific information. The addition of fields likeisFeatured
,statusName
,statusColor
, and the nestedvaccinationsInfo
are likely to provide a more comprehensive and useful view of the vaccination records.Please ensure that these changes are well integrated with the backend API and the UI components that consume this data. It might be beneficial to check if the backend supports these new fields and if the UI components are updated to display this new structure effectively.
There was a problem hiding this 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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- libs/api/domains/health-directorate/src/lib/health-directorate.service.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- libs/api/domains/health-directorate/src/lib/health-directorate.service.ts
There was a problem hiding this 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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts (2 hunks)
- libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts
- libs/api/domains/health-directorate/src/lib/models/organ-donation.model.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🥃
* fix: resolver naming and logic * health fixes * refactor: after service added * chore: nx format:write update dirty files * refactor: service update * feat: add loaders * chore: charts update dirty files * fix: charts values for staging * fix: PR comments * fix: pr comments vol 2 * fix: null --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* fix: resolver naming and logic * health fixes * refactor: after service added * chore: nx format:write update dirty files * refactor: service update * feat: add loaders * chore: charts update dirty files * fix: charts values for staging * fix: PR comments * fix: pr comments vol 2 * fix: null --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Service Portal - Health Directorate
What
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Style