new: Script to transform Azure DevOps export csv to an importable csv for workitems.
This commit is contained in:
commit
02bcb22c5c
3 changed files with 180 additions and 0 deletions
38
README.md
Normal file
38
README.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Python Azure DevOps Work Item CSV
|
||||
|
||||
## Run Example
|
||||
|
||||
```bash
|
||||
# 1 Create and activate an isolated Python environment
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
|
||||
# 2 Install runtime dependencies
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r requirements.pip
|
||||
|
||||
# 3 Convert the CSV
|
||||
python reorder_requirements.py "input.csv" "output.csv"
|
||||
|
||||
python reorder_requirements.py -v "/Users/jj/Downloads/input.csv" "/Users/jj/Downloads/output.csv"
|
||||
```
|
||||
|
||||
## Execution Logic Summary
|
||||
|
||||
1. **build\_level\_map** walks up the `Parent` chain to assign every row its depth (1, 2, 3, …).
|
||||
1. **depth\_first\_order** produces a depth-first sequence of IDs so that each parent is immediately followed by its children (and grandchildren).
|
||||
1. **restructure** creates the empty `ID` column plus the mutually-exclusive `Title 1 – 3` columns and appends every *other* original column (except the old `ID`, `Parent`, and `Title`).
|
||||
1. The script writes the new CSV; nothing is printed except a final “Wrote … rows” confirmation.
|
||||
|
||||
You’ll get a file whose first four columns are:
|
||||
|
||||
| ID | Title 1 | Title 2 | Title 3 | …other original fields… |
|
||||
| -- | ------- | ------- | ------- | ----------------------- |
|
||||
|
||||
where:
|
||||
|
||||
* Top-level items fill **Title 1**.
|
||||
* Second-level items fill **Title 2**.
|
||||
* Third-level (and deeper) items fill **Title 3**.
|
||||
|
||||
All hierarchy constraints you specified are enforced automatically. Feel free to adapt the column names or add CLI switches if you ever need variations (e.g., different max depth).
|
||||
Loading…
Add table
Add a link
Reference in a new issue