Skip to content

Commit

Permalink
run_tasks.py: More statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed (ODSC) committed Nov 13, 2024
1 parent 2a3d340 commit a90e648
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
6 changes: 6 additions & 0 deletions libcovebods/additionalfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ def process(self, data_reader: libcovebods.data_reader.DataReader) -> list:

schema_fields = self._schema.get_package_schema_fields()

for field in schema_fields:
#if "interestedParty" in field:
print(field)

print("Total:", len(schema_fields))

additional_fields = get_additional_fields_info(
data_reader.get_all_data(), schema_fields
)
Expand Down
2 changes: 2 additions & 0 deletions libcovebods/run_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
libcovebods.tasks.statistics.StatisticsCountEntityRecordStatements,
libcovebods.tasks.statistics.StatisticsCountPersonStatements,
libcovebods.tasks.statistics.StatisticsCountPersonRecordStatements,
libcovebods.tasks.statistics.StatisticsCountOwnershipOrControlStatements,
libcovebods.tasks.statistics.StatisticsCountOwnershipOrControlRecordStatements,
libcovebods.tasks.statistics.StatisticAddress,
libcovebods.tasks.statistics.StatisticOwnershipOrControlInterestDirectOrIndirect,
libcovebods.tasks.statistics.StatisticOwnershipOrControlWithAtLeastOneInterestBeneficial,
Expand Down
54 changes: 53 additions & 1 deletion tests/test_additional_fields_0_4_0.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import json
import os
import tempfile

from tests.api import bods_json_output

import libcovebods.data_reader
from libcovebods.schema import SchemaBODS
from libcovebods.config import LibCoveBODSConfig
from libcovebods.additionalfields import AdditionalFields


def test_additional_fields_1():

Expand All @@ -24,3 +28,51 @@ def test_additional_fields_1():
assert results["additional_checks_count"] == 0

assert False

def test_additional_fields_2():

cove_temp_folder = tempfile.mkdtemp(
prefix="lib-cove-bods-tests-", dir=tempfile.gettempdir()
)
json_filename = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "fixtures", "0.4", "additional_fields_2.json"
)

results = bods_json_output(cove_temp_folder, json_filename)

print(results)

assert results["schema_version"] == "0.4"
assert results["validation_errors_count"] == 0
assert results["additional_fields_count"] == 0
assert results["additional_checks_count"] == 0

assert False

def test_additional_fields_3():

json_filename = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "fixtures", "0.4", "additional_fields_2.json"
)

process_data = {}

process_data['sample_mode'] = False
process_data["json_data_filename"] = json_filename
process_data['config'] = process_data['config'] = LibCoveBODSConfig()

process_data['data_reader'] = libcovebods.data_reader.DataReader(
process_data["json_data_filename"], sample_mode=process_data['sample_mode']
)

process_data['schema'] = SchemaBODS(process_data['data_reader'], process_data['config'])

worker = AdditionalFields(process_data['schema'])

output = worker.process(process_data['data_reader'])

print("Schema:", process_data['schema'])

print(output)

assert False

0 comments on commit a90e648

Please sign in to comment.