Skip to content

Commit

Permalink
🎨 Use kebab case for flags (#249)
Browse files Browse the repository at this point in the history
* 🎨 Use kebab case for flags

* 🩹 search and replace new flags
  • Loading branch information
hf-krechan authored Mar 27, 2024
1 parent 7791609 commit 9aeaf8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ If you want to extract all prüfidentifikatoren, you can run the following comma
For the following steps we assume that you cloned our [edi_energy_mirror](https://github.com/Hochfrequenz/edi_energy_mirror/) to a neighbouring directory.

```bash
kohlrahbi --input_path ../edi_energy_mirror/edi_energy_de/current --output_path ./output/ --file-type flatahb
kohlrahbi --input-path ../edi_energy_mirror/edi_energy_de/current --output-path ./output/ --file-type flatahb
```

This will extract all prüfidentifikatoren listed in [all_known_pruefis.toml](src/kohlrahbi/all_known_pruefis.toml) and save them in the provided output path.
Expand All @@ -101,21 +101,21 @@ The easiest way to be compliant with this naming schema is to clone our [edi_ene
If you want to extract a specific prüfidentifikator, you can run the following command.

```bash
kohlrahbi --input_path ../edi_energy_mirror/edi_energy_de/current --output_path ./output/ --pruefis 13002 --file-type xlsx
kohlrahbi --input-path ../edi_energy_mirror/edi_energy_de/current --output-path ./output/ --pruefis 13002 --file-type xlsx
```

You can also provide multiple prüfidentifikatoren.

```bash
kohlrahbi --input_path ../edi_energy_mirror/edi_energy_de/current --output_path ./output/ --pruefis 13002 --pruefis 13003 --pruefis 13005 --file-type csv
kohlrahbi --input-path ../edi_energy_mirror/edi_energy_de/current --output-path ./output/ --pruefis 13002 --pruefis 13003 --pruefis 13005 --file-type csv
```
### Results
There is a kohlrahbi based CI pipeline from the edi_energy_mirror mentioned above to the repository [machine-readable_anwendungshandbuecher](https://github.com/Hochfrequenz/machine-readable_anwendungshandbuecher) where you can find scraped AHBs as JSON, CSV or Excel files.

### Export ConditionKeys and ConditionTexts
For example to export condition.json files to [edi_energy_ahb_conditions_and_packages](https://github.com/Hochfrequenz/edi_energy_ahb_conditions_and_packages). Works best if no flags for "Prüfindentifikatoren" (--pruefis). In this case all known "Prüfidentifikatoren" are scanned. Thus all related conditions are gathered.
```bash
kohlrahbi --file-type conditions --input_path ../edi_energy_mirror/edi_energy_de/current --output_path ./output/edi_energy_ahb_conditions_and_packages/aktuelleFV
kohlrahbi --file-type conditions --input-path ../edi_energy_mirror/edi_energy_de/current --output-path ./output/edi_energy_ahb_conditions_and_packages/aktuelleFV
```

## Workflow
Expand Down
4 changes: 2 additions & 2 deletions src/kohlrahbi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ def scrape_pruefis(
)
@click.option(
"-i",
"--input_path",
"--input-path",
type=click.Path(exists=True, dir_okay=True, file_okay=False, path_type=Path),
prompt="Input directory",
help="Define the path to the folder with the docx AHBs.",
)
@click.option(
"-o",
"--output_path",
"--output-path",
type=click.Path(exists=False, dir_okay=True, file_okay=False, path_type=Path),
default="output",
prompt="Output directory",
Expand Down
6 changes: 3 additions & 3 deletions unittests/test_kohlrahbi_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def test_kohlrahbi_cli_with_invalid_arguments(
argument_options: list[str] = [
"--pruefis",
pruefis,
"--input_path",
"--input-path",
str(input_path),
"--output_path",
"--output-path",
str(output_path),
]

Expand Down Expand Up @@ -113,7 +113,7 @@ def test_kohlrahbi_cli_with_valid_arguments(
input_path: Path = Path(datafiles) / Path(input_folder_name)
output_path: Path = Path(datafiles) / Path(output_folder_name)

argument_options.extend(["--input_path", str(input_path), "--output_path", str(output_path)])
argument_options.extend(["--input-path", str(input_path), "--output-path", str(output_path)])

# Call the CLI tool with the desired arguments
response: Result = runner.invoke(main, argument_options)
Expand Down

0 comments on commit 9aeaf8d

Please sign in to comment.