Skip to content

Commit

Permalink
schema: Pass schema to flatten tool
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Nov 8, 2022
1 parent dcc1335 commit 12a047a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cove_ofds/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 12a047a

Please sign in to comment.