ts_ids_core.mapping_table.sync module

create_mapping_table_json(schema_file: Path | TextIO | dict = PosixPath('schema.json'), mapping_table_path: Path = PosixPath('mapping_table.json'), default_record_visibility: bool = True) str[source]

Create the mapping table json for the field paths in schema.json Steps

  • Read the field paths from the schema

  • Create mapping for the old records in the mapping table: dict[path, element]

  • For each property, generate a template record

  • Transfer data from old record to new record, if the old exists

create_readme(readme_path: Path, mapping_table_path: Path, mapping_table_section_heading: str = 'Raw to IDS Mapping') str[source]

Insert the mapping table into the README Steps:

  • Generate a markdown table from the mapping_table.json

  • Find the existing mapping table in the README

  • Remove the existing table

  • Insert the new table

replace_mapping_table_in_readme_lines(readme_lines: List[str], mapping_table_json: MappingTable, mapping_table_section_heading: str = 'Raw to IDS Mapping') List[str][source]

Replace the mapping table lines in the readme with lines generated from a MappingTable instance.