{ "cells": [ { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "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=, location=Location(city='Oelde', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Reinhard', lastname='Gebing'), date_of_birth='1964-04-26'), PersonToCompanyRelationship(role=, location=Location(city='Wetter', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Markus', lastname='Kreft'), date_of_birth='1966-04-03'), PersonToCompanyRelationship(role=, location=Location(city='Holzminden', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Kai', lastname='Luntz'), date_of_birth='1970-12-04'), PersonToCompanyRelationship(role=, location=Location(city='Rheda-Wiedenbrück', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Thomas', lastname='Mader'), date_of_birth='1972-05-24'), PersonToCompanyRelationship(role=, location=Location(city='Düsseldorf', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Peter', lastname='Lauwers'), date_of_birth='1970-03-26'), PersonToCompanyRelationship(role=, location=Location(city='Erkrath', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Erkul', lastname='Basaran'), date_of_birth='1977-05-06'), PersonToCompanyRelationship(role=, location=Location(city='Bochum', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Henrik', lastname='Böttner'), date_of_birth='1982-11-07'), PersonToCompanyRelationship(role=, location=Location(city='Oelde', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Ulrich', lastname='Raßenhövel'), date_of_birth='1969-04-16'), PersonToCompanyRelationship(role=, location=Location(city='Herdecke', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Andreas', lastname='Naroska'), date_of_birth='1967-03-23'), PersonToCompanyRelationship(role=, location=Location(city='Witten', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Mark', lastname='Kramps'), date_of_birth='1967-09-04'), PersonToCompanyRelationship(role=, location=Location(city='Dortmund', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Ralf', lastname='Barkmeyer'), date_of_birth='1974-02-28'), PersonToCompanyRelationship(role=, location=Location(city='Tönnisvorst', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Holger', lastname='Siegwarth'), date_of_birth='1967-05-13'), PersonToCompanyRelationship(role=, location=Location(city='Herne', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Oliver', lastname='Liß'), date_of_birth='1981-04-13'), PersonToCompanyRelationship(role=, location=Location(city='Göppingen', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Liang', lastname='Cheng'), date_of_birth='1980-12-29'), PersonToCompanyRelationship(role=, location=Location(city='Beckum', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Astrid', lastname='Dörner-Rodeheger'), date_of_birth='1968-12-24'), PersonToCompanyRelationship(role=, location=Location(city='Dortmund', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Jon', lastname='Lange'), date_of_birth='1978-04-25'), PersonToCompanyRelationship(role=, location=Location(city='Werne', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Ralf', lastname='Frombach'), date_of_birth='1977-01-25'), PersonToCompanyRelationship(role=, location=Location(city='Berlin', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Sven', lastname='Hommel'), date_of_birth='1979-04-22'), PersonToCompanyRelationship(role=, location=Location(city='Oberhausen', street=None, house_number=None, zip_code=None), type=, name=PersonName(firstname='Matthias', lastname='Peters'), date_of_birth='1973-08-28')], company_type=, capital=Capital(value=5115000.0, currency=, type=), 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')\n" ] } ], "source": [ "import json\n", "import dataclasses\n", "from transform import map_unternehmensregister_json\n", "\n", "with open('../tmp/json/GEAFarmTechnologiesGmbH.json', \"r\") as file:\n", " content = json.load(file)\n", " company_data = map_unternehmensregister_json(content)\n", " print(company_data)\n", " with open('../tmp/transformed/GEAFarmTechnologiesGmbH.json', \"w+\", encoding=\"utf-8\") as file:\n", " json.dump(dataclasses.asdict(company_data), file, ensure_ascii=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Test" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "ename": "AssertionError", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mAssertionError\u001b[0m Traceback (most recent call last)", "\u001b[1;32mc:\\Users\\trist\\Documents\\Code\\M.Sc\\aki_prj23_transparenzregister\\tmp\\transformation.ipynb Cell 3\u001b[0m line \u001b[0;36m9\n\u001b[0;32m 7\u001b[0m \u001b[39mwith\u001b[39;00m \u001b[39mopen\u001b[39m(\u001b[39m'\u001b[39m\u001b[39m../tmp/tests/GEAFarmTechnologiesGmbH.json\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m\"\u001b[39m\u001b[39mr\u001b[39m\u001b[39m\"\u001b[39m) \u001b[39mas\u001b[39;00m file:\n\u001b[0;32m 8\u001b[0m expected_result \u001b[39m=\u001b[39m json\u001b[39m.\u001b[39mload(file)\n\u001b[1;32m----> 9\u001b[0m \u001b[39massert\u001b[39;00m result \u001b[39m==\u001b[39m expected_result\n", "\u001b[1;31mAssertionError\u001b[0m: " ] } ], "source": [ "import json\n", "\n", "result = None\n", "expected_result = None\n", "with open('../tmp/transformed/GEAFarmTechnologiesGmbH.json', 'r') as file_a:\n", " result = json.load(file_a)\n", "with open('../tmp/tests/GEAFarmTechnologiesGmbH.json', \"r\") as file:\n", " expected_result = json.load(file)\n", " assert result == expected_result" ] } ], "metadata": { "kernelspec": { "display_name": "aki-prj23-transparenzregister-jVJfu35g-py3.11", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.3" } }, "nbformat": 4, "nbformat_minor": 2 }