narrowizard commented on issue #8400:
URL:
https://github.com/apache/incubator-devlake/issues/8400#issuecomment-2823327115
## Solution Proposal: Extend customize plugin to sync account creation
during issues.csv import
This proposal outlines a solution to extend the DevLake `customize` plugin's
functionality. The goal is to process and create relevant account information
simultaneously with the import of issues data via the
`/plugins/customize/csvfiles/issues.csv` interface, and then link these created
accounts to the imported issue data.
The implementation steps and data processing involved are as follows:
1. **Account Data Insertion:**
* When issues.csv data is received via the
`/plugins/customize/csvfiles/issues.csv` interface, the plugin will first
process the account-related information.
* Extract all unique account names from the `creator_name` and
`assignee_name` fields within the issues.csv (e.g., Alice Smith, Bob Johnson).
* For each extracted account name, perform a data insertion operation
into DevLake's `accounts` table (if the account does not already exist).
* The key fields to be populated in the `accounts` table and their data
sources/mapping rules are as follows:
* `id`: Generate a unique ID based on the account name using the
rule `csv:CsvAccount:0:${accountName}`.
* `_raw_data_params`: Use the rule `csv:CsvBoard:0:${projectName}`.
This might require obtaining project name information from the import context.
* `full_name`: Map to the `accountName` extracted from the CSV
(i.e., the value of creator_name or assignee_name).
* `user_name`: Also map to the `accountName` extracted from the CSV.
* `created_date`: Record the data import time.
* `status`: Set to `0`.
* Other fields (such as `created_at`, `updated_at`, `raw_data_id`,
`raw_data_remark`, `email`, `avatar_url`, `organization`, `status`) should be
populated as `null` or default values since corresponding information is not
available in the CSV or specified in the plan.
2. **Issue Data Update/Association:**
* After creating the relevant account entries in the `accounts` table,
the plugin will proceed to process the main issues.csv data.
* When mapping the issues.csv data to DevLake's `issues` domain layer
entities, leverage the account information created in the first step.
* Use the `creator_name` from issues.csv to look up the corresponding
account `id` created in the `accounts` table, and populate the `creator_id`
field in the `issues` table with this ID.
* Use the `assignee_name` from issues.csv to look up the corresponding
account `id` created in the `accounts` table, and populate the `assignee_id`
field in the `issues` table with this ID.
By following these steps, we can ensure that when importing issues.csv data
via the customize plugin, not only is the issues data itself correctly
imported, but the related creator and assignee account information is also
automatically created and associated, providing a more complete view of the
DevOps data.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]