Documentation for ToMeDa
tomeda.t101_derive_dataverse_key
This script is used to create a mapping table from dataset keys to dataverse keys, using both dataset metadata and manually matched metadata.
Functions:
-
get_args() -> argparse.Namespace: This function parses command-line arguments which include paths to dataset keys, manually matched entries, an administration directory, a metadata information table, and an output file.
-
create_mapping_table(dataset_metadata: Path, manual_matched_metadata: Path | list[Path] = None) -> tuple[list[list[str, str]], list[str], list[str]]: This function creates the mapping table using the dataset metadata and manually matched metadata.
-
_read_manual_matched_entries(manual_matched_metadata: Path | list[Path] = None) -> dict[str, str]: This function reads manually matched entries from given files.
-
_create_mapping_table(info_table: dict[str, Any], manual_matched_entries: dict[str, str]) -> apping_rt_type: This function creates the mapping table based on the information table and manually matched entries.
-
camel_case(st: list[str]) -> str: This function converts a list of strings to camelCase.
The main driver of this script is the 'main' function which processes command line arguments, creates the mapping table, writes the mapping table to a JSON file, and updates the metadata information table file by adding a new field 'dataverse_name' to each entry.
logger
module-attribute
logger: TraceLogger = getLogger(__name__)
mapping_rt_type
module-attribute
mapping_rt_type = tuple[
list[list[str]], list[str], list[str]
]
create_mapping_table
create_mapping_table(
info_table: dict,
manual_matched_metadata: Path | list[Path] = None,
) -> tuple[dict[str, str], list[str], list[str]]
Create a mapping table using the dataset metadata and manually matched metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_metadata |
Path
|
Path to the dataset metadata. |
required |
manual_matched_metadata |
Path or list[Path]
|
Path(s) to the manually matched metadata. |
None
|
Returns:
Type | Description |
---|---|
tuple
|
Tuple containing the mapping table, new dataverse keys, and split keys. |
Source code in tomeda/t101_derive_dataverse_key.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
main
main(param: TomedaParameter) -> None
Source code in tomeda/t101_derive_dataverse_key.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
string_list_to_camelCase
string_list_to_camelCase(st: list[str]) -> str
Convert a list of strings to camelCase. Args: st:
Returns:
Type | Description |
---|---|
str
|
A camelCase string. |
Source code in tomeda/t101_derive_dataverse_key.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|