|
ORE Studio 0.0.4
|
Classes | |
| class | CodeList |
| class | CodeListRow |
| class | CodingScheme |
| class | MergedEntity |
Functions | |
| str | get_subject_area (str entity_dir_name) |
| Optional[ET.Element] | find_element (ET.Element parent, str local_name) |
| str | find_text (ET.Element parent, str local_name, str default='') |
| list[ET.Element] | find_all_elements (ET.Element parent, str local_name) |
| CodingScheme | parse_coding_scheme (ET.Element root) |
| list[CodeListRow] | parse_rows (ET.Element root, CodingScheme coding_scheme, str source_file) |
| CodeList | parse_xml_file (Path file_path) |
| tuple[str, str] | derive_entity_name (str directory_name) |
| MergedEntity | process_entity (Path input_dir, str entity_name) |
| dict | load_manifest (Path manifest_path) |
| str | load_methodology_text (Path methodology_path) |
| generate_catalog_sql (dict manifest, Path output_path) | |
| generate_methodology_sql (dict manifest, str methodology_text, Path output_path) | |
| generate_coding_schemes_dataset_sql (dict manifest, Path output_path) | |
| generate_dataset_dependency_sql (dict manifest, Path output_path) | |
| generate_fpml_sql (Path output_dir, list[str] dataset_files, list[str] artefact_files) | |
| generate_coding_schemes_sql (list[MergedEntity] entities, Path output_path) | |
| generate_entity_model (MergedEntity entity, Path output_dir) | |
| generate_populate_data (MergedEntity entity, Path output_dir) | |
| main () | |
Variables | |
| str | GCL_NS = '{http://docs.oasis-open.org/codelist/ns/genericode/1.0/}' |
| str | DOC_NS = '{http://www.fpml.org/coding-scheme/documentation}' |
| dict | NAMESPACES |
| dict | ENTITY_SUBJECT_AREA_MAP |
| dict | ENTITY_FILE_PATTERNS |
| dict | NON_ISO_CURRENCY_ENRICHMENT |
| dict | ENTITIES_WITH_SHARED_TABLES |
FPML Genericode XML Parser
Parses FPML coding scheme XML files (OASIS Genericode format) and generates:
1. JSON entity models for SQL schema generation
2. SQL populate scripts for reference data
3. Coding scheme entries for dq_coding_schemes_tbl
Usage:
python fpml_parser.py <input_dir> <output_dir> [--coding-schemes-only]
The parser handles directories with multiple XML files by merging them,
tracking the source coding scheme for each row.
| str get_subject_area | ( | str | entity_dir_name | ) |
Get the subject area for an entity based on its directory name.

| Optional[ET.Element] find_element | ( | ET.Element | parent, |
| str | local_name | ||
| ) |
Find element by local name, handling both namespaced and non-namespaced elements.

| str find_text | ( | ET.Element | parent, |
| str | local_name, | ||
| str | default = '' |
||
| ) |
Find element text by local name.

| list[ET.Element] find_all_elements | ( | ET.Element | parent, |
| str | local_name | ||
| ) |
Find all elements by local name.

| CodingScheme parse_coding_scheme | ( | ET.Element | root | ) |
Extract coding scheme metadata from XML root element.

| list[CodeListRow] parse_rows | ( | ET.Element | root, |
| CodingScheme | coding_scheme, | ||
| str | source_file | ||
| ) |
Extract code list rows from XML root element.

| CodeList parse_xml_file | ( | Path | file_path | ) |
Parse a single FPML XML file.

| tuple[str, str] derive_entity_name | ( | str | directory_name | ) |
Derive singular and plural entity names from directory name.
Examples:
party-roles -> (party_role, party_roles)
business-centres -> (business_centre, business_centres)
entity-classifications -> (entity_classification, entity_classifications)

| MergedEntity process_entity | ( | Path | input_dir, |
| str | entity_name | ||
| ) |
Process FPML XML files for a given entity from a flat directory. Uses ENTITY_FILE_PATTERNS to find matching files. If multiple files exist, merge them tracking each row's source coding scheme.

| dict load_manifest | ( | Path | manifest_path | ) |
Load the data manifest JSON file.

| str load_methodology_text | ( | Path | methodology_path | ) |
Load the methodology text file.

| generate_catalog_sql | ( | dict | manifest, |
| Path | output_path | ||
| ) |
Generate SQL file with catalog upsert from manifest.

| generate_methodology_sql | ( | dict | manifest, |
| str | methodology_text, | ||
| Path | output_path | ||
| ) |
Generate SQL file with methodology upsert from manifest.

| generate_coding_schemes_dataset_sql | ( | dict | manifest, |
| Path | output_path | ||
| ) |
Generate SQL file with coding schemes dataset upsert from manifest.

| generate_dataset_dependency_sql | ( | dict | manifest, |
| Path | output_path | ||
| ) |
Generate SQL file with dataset dependency upserts from manifest.

| generate_fpml_sql | ( | Path | output_dir, |
| list[str] | dataset_files, | ||
| list[str] | artefact_files | ||
| ) |
Generate populate_fpml.sql master include file with all FPML files in correct order.

| generate_coding_schemes_sql | ( | list[MergedEntity] | entities, |
| Path | output_path | ||
| ) |
Generate SQL file with coding scheme artefact inserts.

| generate_entity_model | ( | MergedEntity | entity, |
| Path | output_dir | ||
| ) |
Generate JSON model file for entity schema generation.

| generate_populate_data | ( | MergedEntity | entity, |
| Path | output_dir | ||
| ) |
Generate JSON data files for populate script generation. Generates one file per coding scheme/dataset. For entities with multiple coding schemes, multiple files are created.

| dict NAMESPACES |
| dict ENTITY_SUBJECT_AREA_MAP |
| dict ENTITY_FILE_PATTERNS |
| dict ENTITIES_WITH_SHARED_TABLES |