Files
aki_prj23_transparenzregister/tmp/transformation.ipynb
2023-11-04 11:24:27 +01:00

9.8 KiB

In [8]:
import json
import dataclasses
from transform import map_unternehmensregister_json

with open('../tmp/json/GEAFarmTechnologiesGmbH.json', "r") as file:
    content = json.load(file)
    company_data = map_unternehmensregister_json(content)
    print(company_data)
    with open('../tmp/transformed/GEAFarmTechnologiesGmbH.json', "w+", encoding="utf-8") as file:
        json.dump(dataclasses.asdict(company_data), file, ensure_ascii=False)
Company(id=CompanyID(district_court=DistrictCourt(name='Amtsgericht Hamm', city='Hamm'), hr_number='HRB 5363'), location=Location(city='Bönen', street='Siemensstraße', house_number='25-27', zip_code='59199'), name='GEA Farm Technologies GmbH', last_update='2023-10-27', relationships=[PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Oelde', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Reinhard', lastname='Gebing'), date_of_birth='1964-04-26'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Wetter', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Markus', lastname='Kreft'), date_of_birth='1966-04-03'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Holzminden', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Kai', lastname='Luntz'), date_of_birth='1970-12-04'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Rheda-Wiedenbrück', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Thomas', lastname='Mader'), date_of_birth='1972-05-24'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.GESCHAEFTSFUEHRER: 'Geschäftsführer(in)'>, location=Location(city='Düsseldorf', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Peter', lastname='Lauwers'), date_of_birth='1970-03-26'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.GESCHAEFTSFUEHRER: 'Geschäftsführer(in)'>, location=Location(city='Erkrath', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Erkul', lastname='Basaran'), date_of_birth='1977-05-06'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Bochum', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Henrik', lastname='Böttner'), date_of_birth='1982-11-07'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Oelde', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Ulrich', lastname='Raßenhövel'), date_of_birth='1969-04-16'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Herdecke', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Andreas', lastname='Naroska'), date_of_birth='1967-03-23'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Witten', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Mark', lastname='Kramps'), date_of_birth='1967-09-04'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Dortmund', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Ralf', lastname='Barkmeyer'), date_of_birth='1974-02-28'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Tönnisvorst', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Holger', lastname='Siegwarth'), date_of_birth='1967-05-13'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Herne', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Oliver', lastname='Liß'), date_of_birth='1981-04-13'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.GESCHAEFTSFUEHRER: 'Geschäftsführer(in)'>, location=Location(city='Göppingen', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Liang', lastname='Cheng'), date_of_birth='1980-12-29'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Beckum', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Astrid', lastname='Dörner-Rodeheger'), date_of_birth='1968-12-24'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Dortmund', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Jon', lastname='Lange'), date_of_birth='1978-04-25'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Werne', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Ralf', lastname='Frombach'), date_of_birth='1977-01-25'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Berlin', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Sven', lastname='Hommel'), date_of_birth='1979-04-22'), PersonToCompanyRelationship(role=<RelationshipRoleEnum.PROKURIST: 'Prokurist(in)'>, location=Location(city='Oberhausen', street=None, house_number=None, zip_code=None), type=<CompanyRelationshipEnum.PERSON: 'Person'>, name=PersonName(firstname='Matthias', lastname='Peters'), date_of_birth='1973-08-28')], company_type=<CompanyTypeEnum.GMBH: 'Gesellschaft mit beschränkter Haftung'>, capital=Capital(value=5115000.0, currency=<CurrencyEnum.EURO: 'EUR'>, type=<CapitalTypeEnum.STAMMKAPITAL: 'Stammkapital'>), business_purpose='Entwicklung, Herstellung und der Vertrieb von Landtechnik, insbesondere von Komponenten und Anlagen (a) zur Gewinnung, Kühlung, Behandlung und Lagerung von Milch; (b) für das Milchvieh-Herdenmanagement; (c) zur Tierhygiene und Sicherung der Milchqualität und (d) zur Aufstallung von Tieren; sowie die Herstellung und der Vertrieb von Anlagen und Fahrzeugen zur Aufbereitung und zum Transport von Gülle.', founding_date='1995-04-25')

Test

In [9]:
import json

result = None
expected_result = None
with open('../tmp/transformed/GEAFarmTechnologiesGmbH.json', 'r') as file_a:
    result = json.load(file_a)
with open('../tmp/tests/GEAFarmTechnologiesGmbH.json', "r") as file:
    expected_result = json.load(file)
    assert result == expected_result
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
c:\Users\trist\Documents\Code\M.Sc\aki_prj23_transparenzregister\tmp\transformation.ipynb Cell 3 line 9
      <a href='vscode-notebook-cell:/c%3A/Users/trist/Documents/Code/M.Sc/aki_prj23_transparenzregister/tmp/transformation.ipynb#W2sZmlsZQ%3D%3D?line=6'>7</a> with open('../tmp/tests/GEAFarmTechnologiesGmbH.json', "r") as file:
      <a href='vscode-notebook-cell:/c%3A/Users/trist/Documents/Code/M.Sc/aki_prj23_transparenzregister/tmp/transformation.ipynb#W2sZmlsZQ%3D%3D?line=7'>8</a>     expected_result = json.load(file)
----> <a href='vscode-notebook-cell:/c%3A/Users/trist/Documents/Code/M.Sc/aki_prj23_transparenzregister/tmp/transformation.ipynb#W2sZmlsZQ%3D%3D?line=8'>9</a>     assert result == expected_result

AssertionError: