add display script, fix critical cleanup bug, first exports

This commit is contained in:
2025-06-12 11:04:24 +02:00
parent fb104f9790
commit 1859f0913b
9 changed files with 67 additions and 33 deletions

View File

@@ -1,34 +1,28 @@
#!/usr/bin/env python3
import argparse
import csv
import sys
import json
import logging
import requests
import hashlib
import io
import datetime
import pandas as pd
from rich import progress
from rich.logging import RichHandler
from rich.console import Console
from rich.traceback import install
install(show_locals=True, locals_max_length=150, locals_max_string=300)
global YEARS
YEARS = [2020, 2021, 2022, 2023, 2024]
YEARS = [2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024]
global INFLATION_RATES
#Harmonisierter Verbraucherpreisindex des statistischen Bundesamts
INFLATION_RATES = {
2014: 0.8,
2015: 0.7,
2016: 0.4,
2017: 1.7,
2018: 1.9,
2019: 1.4,
2020: 0.4,
2021: 3.2,
2022: 8.7,
2023: 6.0,
2024: 2.5,
2014: 0.008,
2015: 0.007,
2016: 0.004,
2017: 0.017,
2018: 0.019,
2019: 0.014,
2020: 0.004,
2021: 0.032,
2022: 0.087,
2023: 0.060,
2024: 0.025,
}
class Company:
@@ -78,11 +72,8 @@ class Company:
def calculate_all_tax(self) -> None:
"""Calculate tax for all relevant years."""
self.calculate_tax(2020)
self.calculate_tax(2021)
self.calculate_tax(2022)
self.calculate_tax(2023)
self.calculate_tax(2024)
for year in YEARS:
self.calculate_tax(year)
def calculate_tax(self, year: int) -> None:
"""Calculate simple tax from provided values."""
@@ -111,14 +102,7 @@ class Company:
def write(self) -> None:
"""Write the current dataset to CSV"""
with open(self.report.output) as out_csv:
try:
output_reader = pd.read_csv(out_csv)
bvd_id = output_reader["bvd_id"]
if not self.cleaned_data.get("bvd_id") in bvd_id:
self.writer.writerow(self.cleaned_data)
except pd.errors.EmptyDataError:
self.writer.writerow(self.cleaned_data)
self.writer.writerow(self.cleaned_data)
class dataimport: