|
ORE Studio 0.0.4
|
Variables | |
| list | CURRENCY_DEFAULTS_POOL |
Simple code generator that loads data and applies templates.
| load_data | ( | data_dir | ) |
Load all data files from the data directory.
Args:
data_dir (str): Path to the data directory
Returns:
dict: Dictionary containing loaded data

| format_comment_block | ( | text, | |
lang = 'sql' |
|||
| ) |
Format text as a comment block with language-specific syntax.
Args:
text (str): Text to format as comments
lang (str): Programming language for comment syntax
Returns:
str: Formatted comment block
| generate_license_with_header | ( | license_text, | |
| modeline_info, | |||
lang = 'sql' |
|||
| ) |
Generate a license comment block with modeline and copyright header.
Args:
license_text (str): Raw license text
modeline_info (str): Modeline information
lang (str): Language for comment formatting
Returns:
str: Complete license comment block with header

| render_template | ( | template_path, | |
| data | |||
| ) |
Render a mustache template with the provided data.
Args:
template_path (str): Path to the template file
data (dict): Data to use for rendering
Returns:
str: Rendered template content

| get_template_mappings | ( | ) |
Define the mapping between model filenames and their corresponding templates.
Returns:
dict: Mapping of model filenames to lists of template names

| get_schema_template_mappings | ( | ) |
Define the mapping for entity schema templates.
Returns:
list: List of tuples (template_name, output_suffix) for schema generation

| is_entity_schema_model | ( | model_filename | ) |
Check if a model file is an entity schema model.
Args:
model_filename (str): The model filename
Returns:
bool: True if this is an entity schema model

| is_entity_data_model | ( | model_filename | ) |
Check if a model file is an entity data model (for populate scripts).
Args:
model_filename (str): The model filename
Returns:
bool: True if this is an entity data model

| is_domain_entity_model | ( | model_filename | ) |
Check if a model file is a domain entity model.
Args:
model_filename (str): The model filename
Returns:
bool: True if this is a domain entity model

| is_junction_model | ( | model_filename | ) |
Check if a model file is a junction table model.
Args:
model_filename (str): The model filename
Returns:
bool: True if this is a junction table model

| get_model_type | ( | model_filename | ) |
Determine the model type from the filename.
Args:
model_filename (str): The model filename
Returns:
str: The model type ('domain_entity', 'junction', 'schema', 'data', or 'unknown')

| load_profiles | ( | base_dir | ) |
Load profile definitions from profiles.json.
Args:
base_dir (Path): Base directory of the codegen project
Returns:
dict: Dictionary of profile definitions

| snake_to_pascal | ( | snake_str | ) |
Convert a snake_case string to PascalCase.
Args:
snake_str (str): Snake case string (e.g., "dataset_bundle")
Returns:
str: PascalCase string (e.g., "DatasetBundle")

| resolve_output_path | ( | output_pattern, | |
| model_data, | |||
| model_type | |||
| ) |
Resolve placeholders in an output path pattern.
Args:
output_pattern (str): Output path pattern with placeholders
model_data (dict): The loaded model data
model_type (str): The model type ('domain_entity', 'junction', etc.)
Returns:
str: Resolved output path

| resolve_profile_templates | ( | profile_name, | |
| profiles, | |||
model_type = None, |
|||
resolved = None |
|||
| ) |
Resolve all templates for a profile, including any included profiles.
Args:
profile_name (str): Name of the profile to resolve
profiles (dict): Dictionary of all profile definitions
model_type (str): The model type for filtering templates
resolved (set): Set of already resolved profile names (for cycle detection)
Returns:
list: List of template info dicts with 'template' and optional 'output' keys

| validate_profile_for_model | ( | profile_name, | |
| profiles, | |||
| model_type | |||
| ) |
Check if a profile is compatible with a model type.
Args:
profile_name (str): Name of the profile
profiles (dict): Dictionary of all profile definitions
model_type (str): The model type
Returns:
tuple: (is_valid, error_message)

| list_profiles | ( | profiles | ) |
Print a formatted list of available profiles.
Args:
profiles (dict): Dictionary of profile definitions

| get_domain_entity_template_mappings | ( | ) |
Define the mapping for domain entity schema templates.
Returns:
list: List of tuples (template_name, output_suffix) for domain entity generation

| get_junction_template_mappings | ( | ) |
Define the mapping for junction table schema templates.
Returns:
list: List of tuples (template_name, output_suffix) for junction table generation

| get_qt_domain_entity_template_mappings | ( | ) |
Define the mapping for Qt domain entity templates.
Returns:
list: List of tuples (template_name, output_dir, output_suffix) for Qt generation

| get_cpp_domain_entity_template_mappings | ( | ) |
Define the mapping for C++ domain entity templates.
Returns:
list: List of tuples (template_name, output_dir, output_suffix) for C++ generation

| get_cpp_junction_template_mappings | ( | ) |
Define the mapping for C++ junction table templates.
Returns:
list: List of tuples (template_name, output_dir, output_suffix) for C++ generation

| get_populate_template_mappings | ( | ) |
Define the mapping for entity populate templates (per-dataset).
Returns:
list: List of tuples (template_name, output_prefix, output_suffix) for populate generation

| get_non_iso_currency_template_mappings | ( | ) |
Define the mapping for non-ISO currency populate templates.
Non-ISO currencies use the shared dq_currencies_artefact_tbl instead of
having their own entity-specific artefact table.
Returns:
list: List of tuples (template_name, output_prefix, output_suffix) for populate generation

| load_model | ( | model_path | ) |
Load a model from the specified path.
Args:
model_path (str or Path): Path to the model file
Returns:
dict: The loaded model data

| get_relative_path | ( | abs_path, | |
| base_path | |||
| ) |
Get the relative path of abs_path from base_path.
Args:
abs_path (Path): Absolute path
base_path (Path): Base path to calculate relative path from
Returns:
str: Relative path string

|
protected |
Mark the last item in a list of dictionaries with a 'last' flag.
Args:
data_list (list): List to process

|
protected |
Format a multi-line description as SQL comment block content.
Adds ' * ' prefix to each line after the first, handling empty lines
as ' *' (just asterisk).
Args:
description (str): Multi-line description text
Returns:
str: Formatted description with comment prefixes

|
protected |
Prepare table_display items by adding iterator_var to each item.
Mustache can't access parent context variables from within a loop,
so we add the iterator_var to each table_display item.
Args:
cpp_section (dict): The 'cpp' section of the model

|
protected |
Format a multi-line detail string for doxygen comments.
Adds ' * ' prefix to continuation lines.
Args:
detail (str): Multi-line detail text
Returns:
str: Formatted detail with proper doxygen prefixes

|
protected |
Format detail fields in columns for doxygen comments.
Args:
columns (list): List of column dictionaries

| generate_from_model | ( | model_path, | |
| data_dir, | |||
| templates_dir, | |||
| output_dir, | |||
is_processing_batch = False, |
|||
prefix = None, |
|||
target_template = None, |
|||
target_output = None |
|||
| ) |
Generate output files from a model using the appropriate templates.
Args:
model_path (str or Path): Path to the model file
data_dir (Path): Path to the data directory
templates_dir (Path): Path to the templates directory
output_dir (Path): Path to the output directory
is_processing_batch (bool): Flag to indicate if we're already processing a batch
prefix (str): Optional prefix for output filenames
target_template (str): Optional override for the template to use
target_output (str): Optional override for the output filename

| generate_flag_svg | ( | country_code_num | ) |
Generate a deterministic SVG flag based on a country code number.
Args:
country_code_num (int or str): A number representing the country code
Returns:
str: SVG string for the flag

|
protected |
Resolve file references in the model data by reading content from external files.
Args:
model_data (dict or list): The model data that may contain file references
model_dir (Path): Directory where the model file is located
global_data (dict): Global data dictionary to update with resolved content

| main | ( | ) |
Main function to run the code generator.

| list CURRENCY_DEFAULTS_POOL |