From 12a047ad36e627ed0f8b6a476a87140a1a989276 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 8 Nov 2022 13:44:08 +0000 Subject: [PATCH] schema: Pass schema to flatten tool https://github.com/Open-Telecoms-Data/cove-ofds/issues/15#issuecomment-1306403827 https://github.com/Open-Telecoms-Data/lib-cove-ofds/issues/10 --- cove_ofds/process.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cove_ofds/process.py b/cove_ofds/process.py index 9b67dac..9ac188c 100644 --- a/cove_ofds/process.py +++ b/cove_ofds/process.py @@ -63,10 +63,13 @@ def process(self, process_data: dict) -> dict: os.makedirs(output_dir, exist_ok=True) + schema = OFDSSchema + unflatten_kwargs = { "output_name": os.path.join(output_dir, "unflattened.json"), "root_list_path": "networks", "input_format": _get_file_type(input_filename), + "schema": schema.data_schema_url, } flattentool.unflatten(input_filename, **unflatten_kwargs) @@ -112,10 +115,13 @@ def process(self, process_data: dict) -> dict: os.makedirs(output_dir, exist_ok=True) + schema = OFDSSchema + unflatten_kwargs = { "output_name": os.path.join(output_dir, "unflattened.json"), "root_list_path": "networks", "input_format": "csv", + "schema": schema.data_schema_url, } flattentool.unflatten(self.supplied_data.upload_dir(), **unflatten_kwargs) @@ -302,9 +308,12 @@ def process(self, process_data: dict) -> dict: os.makedirs(self.output_dir, exist_ok=True) + schema = OFDSSchema + flatten_kwargs = { "output_name": self.output_dir, "root_list_path": "networks", + "schema": schema.data_schema_url, } flattentool.flatten(process_data["json_data_filename"], **flatten_kwargs)