Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement v2.0.3 conversion #122

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions src/omi/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __convert_oep_152_to_160(metadata: dict) -> dict:
return metadata


def __convert_oep_160_to_200(metadata: dict) -> dict:
def __convert_oep_160_to_201(metadata: dict) -> dict:
"""
Convert metadata with version "OEP-1.6.0" to "OEMetadata-2.0.1" using the v2.0 template.

Expand Down Expand Up @@ -251,7 +251,44 @@ def ___v2_populate_schema_fields(resource_v2: dict, resource: dict) -> None:
schema_field_v2["nullable"] = None




def __convert_oep_201_to_202(metadata: dict) -> dict:
"""
Convert metadata with version "OEP-1.6.0" to "OEMetadata-2.0.1" using the v2.0 template.

Parameters
----------
metadata: dict
Metadata dictionary in v1.6 format

Returns
-------
dict
Updated metadata dictionary in v2.0 format
"""
metadata_v2 = deepcopy(get_metadata_specification("OEMetadata-2.0.2").template)




def __convert_oep_202_to_203(metadata: dict) -> dict:
"""
Convert metadata with version "OEP-1.6.0" to "OEMetadata-2.0.1" using the v2.0 template.

Parameters
----------
metadata: dict
Metadata dictionary in v1.6 format

Returns
-------
dict
Updated metadata dictionary in v2.0 format
"""
metadata_v2 = deepcopy(get_metadata_specification("OEMetadata-2.0.3").template)

METADATA_CONVERSIONS = {
("OEP-1.5.2", "OEP-1.6.0"): __convert_oep_152_to_160,
("OEP-1.6.0", "OEMetadata-2.0.1"): __convert_oep_160_to_200,
("OEP-1.6.0", "OEMetadata-2.0.1"): __convert_oep_160_to_201,
}
Loading