diff --git a/README.md b/README.md index ae35a15..e95e38f 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,8 @@ View documentation - https://worldbank.github.io/metadata-schemas/ To update the pydantic schemas so that they match the json schemas run - `python pydantic_schemas\\utils\\generate_pydantic_schemas.py` \ No newline at end of file + `python pydantic_schemas\\generators\\generate_pydantic_schemas.py` + +Then to update the Excel sheets run + + `python pydantic_schemas\\generators\\generate_excel_files.py` \ No newline at end of file diff --git a/excel_sheets/Document_metadata.xlsx b/excel_sheets/Document_metadata.xlsx deleted file mode 100644 index 1c31afd..0000000 Binary files a/excel_sheets/Document_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Script_metadata.xlsx b/excel_sheets/Script_metadata.xlsx deleted file mode 100644 index 0ff2eda..0000000 Binary files a/excel_sheets/Script_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Series_metadata.xlsx b/excel_sheets/Series_metadata.xlsx deleted file mode 100644 index 526917b..0000000 Binary files a/excel_sheets/Series_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Survey_microdata_metadata.xlsx b/excel_sheets/Survey_microdata_metadata.xlsx deleted file mode 100644 index 03f5fea..0000000 Binary files a/excel_sheets/Survey_microdata_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Table_metadata.xlsx b/excel_sheets/Table_metadata.xlsx deleted file mode 100644 index 830958a..0000000 Binary files a/excel_sheets/Table_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Timeseries_DB_metadata.xlsx b/excel_sheets/Timeseries_DB_metadata.xlsx deleted file mode 100644 index d5696f7..0000000 Binary files a/excel_sheets/Timeseries_DB_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Timeseries_metadata.xlsx b/excel_sheets/Timeseries_metadata.xlsx deleted file mode 100644 index eb5ca74..0000000 Binary files a/excel_sheets/Timeseries_metadata.xlsx and /dev/null differ diff --git a/excel_sheets/Video_metadata.xlsx b/excel_sheets/Video_metadata.xlsx deleted file mode 100644 index b549c7d..0000000 Binary files a/excel_sheets/Video_metadata.xlsx and /dev/null differ diff --git a/pydantic_schemas/excel_interface.py b/pydantic_schemas/excel_interface.py index 9111f0e..49c98dc 100644 --- a/pydantic_schemas/excel_interface.py +++ b/pydantic_schemas/excel_interface.py @@ -64,6 +64,9 @@ class ExcelInterface: "video": excel_single_sheet_to_pydantic, # one sheet } + def get_metadata_types(self): + return list(self._TYPE_TO_READER.keys()) + @staticmethod def _merge_dicts(base, update): if len(update) == 0: diff --git a/pydantic_schemas/generators/generate_excel_files.py b/pydantic_schemas/generators/generate_excel_files.py new file mode 100644 index 0000000..83fb6f7 --- /dev/null +++ b/pydantic_schemas/generators/generate_excel_files.py @@ -0,0 +1,12 @@ +import os + +from pydantic_schemas.excel_interface import ExcelInterface + +ei = ExcelInterface() + +for metadata_type in ei.get_metadata_types(): + filename = f"excel_sheets/{metadata_type.capitalize()}_metadata.xlsx" + print(f"Writing {metadata_type} outline to {filename}") + if os.path.exists(filename): + os.remove(filename) + ei.write_outline_metadata_to_excel(metadata_type=metadata_type, filename=filename) diff --git a/pydantic_schemas/utils/generate_pydantic_schemas.py b/pydantic_schemas/generators/generate_pydantic_schemas.py similarity index 100% rename from pydantic_schemas/utils/generate_pydantic_schemas.py rename to pydantic_schemas/generators/generate_pydantic_schemas.py