Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3f870bf
feat(quantitative): Import make_quantitative_bulk_load_file.py script.
nshandra Jun 6, 2023
cb1eb4b
feat(qualitative): Import make_qualitative_bulk_load_file.py script.
nshandra Jun 6, 2023
77b1096
chore: Apply pep 8 style.
nshandra Jun 6, 2023
2c5d62c
feat(qualitative): Ignore fields which names start with "Internal"
nshandra Jun 7, 2023
8088629
fix: Fix Czech Republic code, fix extract_values_from_csv exception m…
nshandra Sep 8, 2023
1b14e15
feat(currency): Add currency calculation option to script.
nshandra Sep 8, 2023
84876f7
feat(currency): Update requirements.txt
nshandra Sep 11, 2023
03a421d
fix(temp): update hard-coded category option combo default ID
nshandra Sep 13, 2023
0a950f1
feat: Add better debug output
nshandra Sep 19, 2023
4266c97
feat(qualitative): Add better error control to get_country_and_year
nshandra Sep 19, 2023
8df7a7f
feat(qualitative): Add extract_charges_in_coverage
nshandra Sep 19, 2023
ca87513
feat(qualitative): Add extract_user_charges_by_type_table
nshandra Sep 19, 2023
e8cd265
fix(qualitative): Avoid storing empty tables data
nshandra Sep 21, 2023
4873aa1
fix(qualitative): Add cleanup_string function
nshandra Sep 21, 2023
5a98e42
feat(qualitative): Add better errors messages, add string cleanup to …
nshandra Sep 21, 2023
694a04d
fix(qualitative): Add special condition for Date updated DE having "(…
nshandra Sep 25, 2023
5e9cadc
feat(quantitative): Adjust the script to the existing metadata.
nshandra Sep 25, 2023
6c3cf92
feat(quantitative): Get the category option combo default ID from the…
nshandra Sep 25, 2023
dd83ec8
fix(temp): Added temporal fix to make_quantitative_bulk_load_file unt…
nshandra Oct 6, 2023
e0c4716
feat(qualitative): Now coverage tables data is written to the corresp…
nshandra Oct 6, 2023
c27b905
feat(qualitative): Add --coverage_max option and extend default entri…
nshandra Oct 25, 2023
aa70945
fix: changes in coverage policy function had wrong column/DE mapping.…
nshandra Nov 6, 2023
8f4806b
feat: Add transformations, docstrings and refactors to make_quantitat…
nshandra Nov 15, 2023
d1f5976
fix: lint changes to make_qualitative_bulk_load_file.py
nshandra Nov 20, 2023
66a8cb7
feat: add latest DE storage
nshandra Nov 20, 2023
bb94981
fix: add "missing" DE to latest dict
nshandra Nov 20, 2023
c541c84
feat: add closest candidates to get_indicator_id error message and ch…
nshandra Nov 20, 2023
97e8907
fix: fix latest DEs being stored in several years instead of the latest
nshandra Nov 20, 2023
82c58b2
fix: households DEs had a error in the transformation formula
nshandra Nov 21, 2023
4db5a9e
fix: OTHER_CHE transformation not saving data if no reference in CSV
nshandra Nov 21, 2023
6abdcc9
fix: Store latest by combo, fix xlsx cell write position resulting in…
nshandra Nov 21, 2023
d0bebf5
fix: check for empty lines and malformed lines in fix_references_format
nshandra Dec 7, 2023
1982e2d
fix: update Netherlands country code
nshandra Dec 11, 2023
00ab903
fix: typos in README
nshandra Jul 4, 2024
75879c2
feat: add include internal option, update hard-coded fields, remove c…
nshandra Jul 30, 2024
66b3e79
feat: update README
nshandra Jul 30, 2024
7c70e7b
fix: remove verbose message, fix extract_user_charges_by_type_table
nshandra Jul 30, 2024
15d7c92
feat: add Date updated (YYYY-MM-DD) checker and rudimentary fixer
nshandra Jul 30, 2024
936183f
feat: add check_date_updated_format function. Remove the --internal o…
nshandra Jul 30, 2024
982abea
fix: write_indicator was applying the incorrect offset when importing…
nshandra Sep 13, 2024
5b5dc18
Merge pull request #4 from EyeSeeTea/feature/uhcw_qualitative_templat…
Ramon-Jimenez Sep 13, 2024
3ae0d33
make 20 default value for max coverage policy changes per year
Ramon-Jimenez Apr 28, 2025
0fa2f4d
Merge pull request #5 from EyeSeeTea/feature/uhcw_qualitative_templat…
Ramon-Jimenez Apr 28, 2025
ef1e1ff
feat: switch hard coded COMBO_LIST to creating it from the xlsx_templ…
nshandra May 13, 2025
f6c36f3
feat: add find_total_quintile_indicator function to identify the indi…
nshandra May 20, 2025
fd7242f
feat: add insert_value_if_valid, copy total value to matching quintile
nshandra May 20, 2025
0a3c551
Merge pull request #7 from EyeSeeTea/feat/add_consumption_quintile_to…
Ramon-Jimenez Jun 13, 2025
7c24446
feat: print error messages to stderr
nshandra Jul 21, 2025
5a1a533
feat: improve error control for the coefficient retrieval
nshandra Jul 21, 2025
bbabf8d
Merge pull request #8 from EyeSeeTea/fix/handle_empty_currency_conver…
Ramon-Jimenez Jul 22, 2025
6d72715
update Contry Dict with BIH sub-entities and KOS
Ramon-Jimenez Sep 22, 2025
a195aa9
feat: add EU org unit and entries for countries with non-standard cou…
nshandra Feb 24, 2026
b7fdaea
feat: add indicator_id (DE code) matching via dict to the name mapping
nshandra Feb 24, 2026
f7b3766
Merge pull request #9 from EyeSeeTea/feat/add_code_dict_name_map
Ramon-Jimenez Feb 25, 2026
0d82022
feat: add two new DEs
nshandra Feb 26, 2026
02b73d8
feat: add three new DEs, add EU country code
nshandra Mar 6, 2026
914c1ee
feat: add cata DE codes
nshandra Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# vscode settings
.vscode
118 changes: 117 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,118 @@
# Bulk-Load-pytools
# Bulk Load Pytools

Python tools to generate Bulk Load Templates

## Installation

To install the dependencies required to run this script, use the `requirements.txt` file:

```bash
pip install -r requirements.txt
```

If you prefer to use a virtual environment, you can create one and activate it before installing the dependencies:

```bash
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
```

## make_quantitative_bulk_load_file.py

This script processes CSV files from the "Data Extraction Tool" into "Bulk Load" XLSX files.
The script needs a Bulk Load template. It can either be supplied with the `--xlsx_template` argument or by placing a template named "Quantitative_Data_UHCPW_Template.xlsx" in the same folder as the script.
The output file will be named as the input CSV file, but with XLSX extension.

The script will print the number of entries from the CSV file processed and the number of values written to EXCEL.
The first number can indicate an issue with the CSV data, the second one with the metadata that generates the xlsx template. The `log.json` file can be useful, specially the "matched_values:" section.

There's two options to get the adjusted value, either from the CSV file real_value column or calculating it from the value column. The data for the `--currency` is retrieved from: [google sheet](https://docs.google.com/spreadsheets/d/1lEHQ9i-LO7gl0RWaJgYcfOJHjPefVXJbhgJ0Gn3iUPQ#gid=56805701).

### Usage

```
python3 make_quantitative_bulk_load_file.py [-h | --help] [-x | --xlsx_template <XLSX_TEMPLATE>] [-r | --real_value | -c | --currency] [-d | --debug] indicators_csv
```

#### Positional Arguments

`indicators_csv`: The source CSV file.

#### Options

`-h`, `--help`: Show the help message and exit.

`-x XLSX_TEMPLATE`, `--xlsx_template XLSX_TEMPLATE`: The Bulk Load Quantitative XLSX template file path. If empty, the script will try to open "Quantitative_Data_UHCPW_Template.xlsx".

`-r`, `--real_value`: Use `real_value` instead of `value` from the CSV source file, cant be used with `-c`/`--currency`.

`-c`, `--currency`: Apply currency adjustment to the applicable values, cant be used with `-r`/`--real_value`.

`-d`, `--debug`: Print debug logs into a `log.json` file.

### Examples

Simple use:

```bash
python3 make_quantitative_bulk_load_file.py SPA_fp_indicators.csv
```

Specifying a template and using the 'real_value' column (if not 'NA') from the source file:

```bash
python3 make_quantitative_bulk_load_file.py SPA_fp_indicators.csv -r --xlsx_template=~/docs/Quantitative_Template.xlsx
```

Specifying a template and using the currency adjustment when applicable:

```bash
python3 make_quantitative_bulk_load_file.py SPA_fp_indicators.csv -c --xlsx_template=~/docs/Quantitative_Template.xlsx
```

Using debug flag:

```bash
python3 make_quantitative_bulk_load_file.py SPA_fp_indicators.csv -d
```

## make_qualitative_bulk_load_file.py

This script processes DOCX files into "Bulk Load" XLSX files.
The script needs a Bulk Load template. It can either be supplied with the `--xlsx_template` argument or by placing a template named "Qualitative_Data_UHCPW_Template.xlsx" in the same folder as the script.
The output file will be a XLSX file named _\<COUNTRY>\_\<YEAR>\_Qualitative_Data.xlsx_.

### Usage

```
python3 make_qualitative_bulk_load_file.py [-h] [-x XLSX_TEMPLATE] [-d] [-c COVERAGE_MAX] docx_filename
```

#### Positional Arguments

`docx_filename`: The path to the DOCX source file.

#### Options

`-h`, `--help`: Show the help message and exit.

`-x XLSX_TEMPLATE`, `--xlsx_template XLSX_TEMPLATE`: The Bulk Load Qualitative XLSX template file path. If empty, the script will try to open "Qualitative_Data_UHCPW_Template.xlsx".

`-d`, `--debug`: Print debug logs into a `log.json` file.

`-c`, `--coverage_max`: Number of coverage policy table entries per year, by default 10, must be positive.

### Examples

Simple use:

```bash
python3 make_qualitative_bulk_load_file.py summary_tables.docx
```

Specifying a template and using debug flag:

```bash
python3 make_qualitative_bulk_load_file.py summary_tables.docx --xlsx_template=~/docs/Qualitative_Template.xlsx -d
```
Loading