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

Migration Carpool V2 des APDF #2489

Merged
merged 5 commits into from
May 19, 2024
Merged

Migration Carpool V2 des APDF #2489

merged 5 commits into from
May 19, 2024

Conversation

jonathanfallon
Copy link
Member

@jonathanfallon jonathanfallon commented May 13, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced trip data export with more detailed journey and user identifiers.
  • Improvements

    • Standardized field names for better clarity and consistency in trip data.
    • Added new fields like rpc_journey_id for more comprehensive data tracking.
  • Bug Fixes

    • Corrected inconsistencies in trip data fields to ensure accurate reporting and analysis.

Copy link
Contributor

coderabbitai bot commented May 13, 2024

Walkthrough

The recent updates focus on refining the data normalization process, renaming key identifiers for clarity, and introducing a new rpc_journey_id field. These changes ensure consistent data handling across various modules, improve the readability of identifiers, and enhance the overall structure of trip-related data.

Changes

File Path Change Summary
api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts Renamed driver and passenger ID variables, added rpc_journey_id transformation.
api/src/pdc/services/apdf/interfaces/APDFTripInterface.ts Reorganized trip details properties, added new fields including rpc_journey_id, updated incentive_type.
api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts Added several protected readonly properties to DataRepositoryProvider class.
.../apdf/providers/excel/SlicesWorksheetWriter.ts Renamed journey, trip, datetime, location, driver, and passenger identifiers for clarity.
.../excel/TripsWorksheetWriter.integration.spec.ts Updated exportTripInterface object with new fields, removed outdated ones.
.../excel/TripsWorksheetWriter.ts Added rpc_journey_id to headers, renamed driver and passenger ID fields.

🐇
In fields of code where data flows,
New names arise, as clarity grows.
With journeys marked by rpc,
And drivers, passengers, set free.
The data's clear, the paths refined,
In this bright code, improvements shine.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@jonathanfallon jonathanfallon marked this pull request as ready for review May 18, 2024 21:55
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: 10

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 25e201d and 3e6d40d.
Files selected for processing (6)
  • api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts (1 hunks)
  • api/src/pdc/services/apdf/interfaces/APDFTripInterface.ts (1 hunks)
  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts (6 hunks)
  • api/src/pdc/services/apdf/providers/excel/SlicesWorksheetWriter.ts (2 hunks)
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts (2 hunks)
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • api/src/pdc/services/apdf/providers/excel/SlicesWorksheetWriter.ts
Additional comments not posted (20)
api/src/pdc/services/apdf/interfaces/APDFTripInterface.ts (5)

4-4: Added duration property to APDFTripInterface. Verify that this property is correctly utilized wherever this interface is implemented.


8-8: Added end_location property to APDFTripInterface. Ensure that this property is properly integrated and used in the system.

Verification successful

The APDFTripInterface is used in several files across the codebase. To ensure the end_location property is properly integrated, we need to verify its usage in these files.


The end_location property is indeed used in several files, confirming its integration. However, there was an error with the file api/src/pdc/interfaces/APDFRepositoryProviderInterface.ts not being found. Despite this, the property appears to be integrated correctly in the other files.

  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts

Given the evidence, the integration of the end_location property seems to be properly handled.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of `end_location` property.

# Test: Search for the interface usage. Expect: Proper integration of the new property.
rg --type typescript $'APDFTripInterface'

Length of output: 75



Script:

#!/bin/bash
# Description: Verify integration of `end_location` property.

# Test: Search for the interface usage. Expect: Proper integration of the new property.
rg --type ts $'APDFTripInterface'

Length of output: 2512



Script:

#!/bin/bash
# Description: Verify the usage of `end_location` property in files where `APDFTripInterface` is used.

# List of files where `APDFTripInterface` is used
files=(
  "api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts"
  "api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts"
  "api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts"
  "api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts"
  "api/src/pdc/interfaces/APDFRepositoryProviderInterface.ts"
)

# Search for `end_location` property usage in the listed files
for file in "${files[@]}"; do
  echo "Checking file: $file"
  rg --type ts 'end_location' "$file"
done

Length of output: 2010


9-9: Introduced incentive_type with restricted values ('normale' | 'booster'). Confirm that these values are handled correctly in the business logic.


16-16: Added rpc_journey_id property to APDFTripInterface. Ensure that this new property is correctly handled in all relevant parts of the application.

Verification successful

The APDFTripInterface is used in several files across the codebase. To ensure that the new rpc_journey_id property is correctly handled, we need to inspect these files for proper integration.

Files to check:

  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts
  • api/src/pdc/services/apdf/interfaces/APDFRepositoryProviderInterface.ts
  • api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts

Let's generate a script to search for rpc_journey_id in these files to verify its handling.


The rpc_journey_id property is indeed being handled in the relevant parts of the application. The search results show that it is used in the following files:

  • api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts

This confirms that the new property rpc_journey_id is integrated and utilized appropriately in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify handling of `rpc_journey_id` property.

# Test: Search for the interface usage. Expect: Correct handling of the new property.
rg --type typescript $'APDFTripInterface'

Length of output: 75



Script:

#!/bin/bash
# Description: Verify handling of `rpc_journey_id` property.

# Test: Search for the interface usage. Expect: Correct handling of the new property.
rg --type ts 'APDFTripInterface'

Length of output: 2512



Script:

#!/bin/bash
# Description: Verify handling of `rpc_journey_id` property in relevant files.

# Test: Search for the usage of `rpc_journey_id` in the identified files.
rg 'rpc_journey_id' api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts \
api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts \
api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts \
api/src/pdc/services/apdf/interfaces/APDFRepositoryProviderInterface.ts \
api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts

Length of output: 954


20-20: Added start_location property to APDFTripInterface. Verify that this property is properly integrated and used in the system.

Verification successful

The APDFTripInterface is used in several files across the codebase. To ensure that the start_location property is properly integrated, we need to verify its usage in these files.


The start_location property is indeed used in the codebase, specifically in the following files:

  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts

This confirms that the start_location property has been integrated and utilized in the system.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of `start_location` property.

# Test: Search for the interface usage. Expect: Proper integration of the new property.
rg --type typescript $'APDFTripInterface'

Length of output: 75



Script:

#!/bin/bash
# Description: Verify integration of `start_location` property.

# Test: Search for the interface usage. Expect: Proper integration of the new property.
rg --type ts $'APDFTripInterface'

Length of output: 2512



Script:

#!/bin/bash
# Description: Verify the usage of `start_location` property in files where `APDFTripInterface` is used.

# Test: Search for `start_location` in the relevant files.
rg --type ts 'start_location' api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts \
    api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts \
    api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts \
    api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts \
    api/src/pdc/interfaces/APDFRepositoryProviderInterface.ts

Length of output: 769

api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts (2)

24-24: Updated to use driver_operator_user_id. Ensure that all data sources and consumers are aware of this change.

Verification successful

The driver_operator_user_id property is used in multiple files across the codebase, indicating that it is well-integrated into the system. Here are the locations where it is referenced:

  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts
  • api/src/pdc/services/apdf/providers/excel/SlicesWorksheetWriter.ts
  • api/src/pdc/services/apdf/interfaces/APDFTripInterface.ts
  • api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts
  • api/src/pdc/services/acquisition/commands/MigrateAcquisitionCommand.ts
  • api/src/pdc/services/acquisition/actions/CreateJourneyAction.ts
  • api/src/pdc/providers/seed/Migrator.ts
  • api/src/pdc/providers/carpool/repositories/CarpoolRepository.ts
  • api/src/pdc/providers/carpool/mocks/database/carpool.ts
  • api/src/pdc/providers/carpool/interfaces/database/carpool.ts
  • api/src/db/migrations/arch_carpool/20230920000000-create_carpool_v2.up.sql

This comprehensive usage suggests that the property is correctly handled across various modules and layers of the application.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all data sources and consumers handle the new `driver_operator_user_id`.

# Test: Search for the property usage. Expect: Correct handling of the new property.
rg --type typescript $'driver_operator_user_id'

Length of output: 81



Script:

#!/bin/bash
# Description: Verify that all data sources and consumers handle the new `driver_operator_user_id`.

# Test: Search for the property usage. Expect: Correct handling of the new property.
rg 'driver_operator_user_id'

Length of output: 2033


26-26: Introduced handling for rpc_journey_id. Verify that this property is correctly utilized wherever relevant.

Verification successful

The rpc_journey_id property is correctly utilized in various parts of the codebase, including interfaces, providers, and helper functions. Here are the relevant locations:

  • api/src/pdc/services/apdf/interfaces/APDFTripInterface.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts
  • api/src/pdc/services/apdf/providers/excel/SlicesWorksheetWriter.ts
  • api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts
  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct utilization of `rpc_journey_id`.

# Test: Search for the property usage. Expect: Correct handling.
rg --type typescript $'rpc_journey_id'

Length of output: 72



Script:

#!/bin/bash
# Description: Verify correct utilization of `rpc_journey_id`.

# Test: Search for the property usage. Expect: Correct handling.
rg --type ts $'rpc_journey_id'

Length of output: 818

api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts (2)

14-14: Updated column headers to include rpc_journey_id. Ensure that all data processing and reporting tools are updated to handle this new column.

Verification successful

The rpc_journey_id column is referenced in multiple files, indicating that it is being handled in various parts of the codebase. Here are the locations where rpc_journey_id is used:

  • api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.ts
  • api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts
  • api/src/pdc/services/apdf/providers/excel/SlicesWorksheetWriter.ts
  • api/src/pdc/services/apdf/interfaces/APDFTripInterface.ts
  • api/src/pdc/services/apdf/helpers/normalizeAPDFData.helper.ts

This suggests that the new column is integrated into the data processing and reporting tools.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all data processing and reporting tools handle the new `rpc_journey_id` column.

# Test: Search for the column usage. Expect: Correct handling.
rg --type typescript $'rpc_journey_id'

Length of output: 72



Script:

#!/bin/bash
# Description: Verify that all data processing and reporting tools handle the new `rpc_journey_id` column.

# Test: Search for the column usage. Expect: Correct handling.
rg 'rpc_journey_id'

Length of output: 808


30-30: Added passenger_operator_user_id to column headers. Ensure that all data processing and reporting tools are updated to handle this new column.

api/src/pdc/services/apdf/providers/excel/TripsWorksheetWriter.integration.spec.ts (10)

18-18: Added distance property to exportTripInterface. Ensure that the test accurately reflects the expected data structure.


20-20: Added duration property to exportTripInterface. Verify that the test setup and assertions reflect this addition accurately.


24-24: Added end_location property to exportTripInterface. Ensure that the test setup and assertions reflect this addition accurately.


26-26: Added operator_class property to exportTripInterface. Confirm that the test setup and assertions reflect this addition accurately.


29-29: Updated to use operator. Confirm that all references to the old property name are updated in the test setup.

Verification successful

The script executed successfully but did not produce any output, indicating that the old property name was not found in the codebase. This suggests that all references to the old property name have likely been updated.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to the old property name are updated in the test setup.

# Test: Search for the old property usage. Expect: No occurrences.
rg --type typescript $'old_property_name'  # Replace 'old_property_name' with the actual old property name.

Length of output: 75



Script:

#!/bin/bash
# Description: Verify all references to the old property name are updated in the test setup.

# Test: Search for the old property usage. Expect: No occurrences.
rg --type ts 'old_property_name'  # Replace 'old_property_name' with the actual old property name.

Length of output: 32


32-32: Added rpc_journey_id property to exportTripInterface. Ensure that the test setup and assertions reflect this addition accurately.


33-33: Added start_datetime property to exportTripInterface. Verify that the test setup and assertions reflect this addition accurately.


34-34: Added start_epci property to exportTripInterface. Ensure that the test setup and assertions reflect this addition accurately.


35-35: Added start_insee property to exportTripInterface. Verify that the test setup and assertions reflect this addition accurately.


36-36: Added start_location property to exportTripInterface. Ensure that the test setup and assertions reflect this addition accurately.

api/src/pdc/services/apdf/providers/APDFRepositoryProvider.ts (1)

17-17: Marked carpoolV1Table as deprecated. Ensure that all references to this property are planned for removal or migration.

@jonathanfallon jonathanfallon merged commit 50bb296 into main May 19, 2024
8 checks passed
@jonathanfallon jonathanfallon deleted the migrate/carpool_v2_apdf branch May 19, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant