Core API Reference
This page documents the core classes and functions of the MTNA RDS Toolkit.
Server Connection
- class dartfx.mtnards.MtnaRdsServer(*, host, base_path='rds', api_path='api', api_key=None, ssl_verify=True)[source]
Bases:
BaseModel- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property catalogs: dict[str, MtnaRdsCatalog]
Returns the server’s catalogs, loading them on first access.
- property info: MtnaRdsServerInfo
- api_request(path, method='GET', headers=None, params=None, body_json=None)[source]
Makes an HTTP request to this server’s API.
- create_catalog(id, name=None, description=None, is_private=True, lang='en')[source]
Creates a new catalog on the server.
- get_ddi_codebook(catalog_id, product_id, include_variables=True, include_statistics=False)[source]
Returns the DDI Codebook XML for a data product.
- get_import_configuration(catalog_uri, product_uri, file_info)[source]
Returns import configuration for a data product.
- get_postman_collection(catalog_id=None, data_product_id=None)[source]
Returns a Postman collection for the server, a catalog, or a data product.
- import_file(catalog_uri, product_uri, import_configuration)[source]
Imports data into a data product.
- wait_for_process(pid, sleep=1, timeout=300, max_get_errors=10)[source]
Waits for a server-side process to complete.
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
Catalog
- class dartfx.mtnards.MtnaRdsCatalog(*, uri, id, name=None, description=None, reference=None, revisionNumber=None, lastUpdate, isPrivate, dataProducts=None)[source]
Bases:
MtnaRdsResource- data_products: list[MtnaRdsDataProduct] | None
- property data_products_by_id: dict[str, MtnaRdsDataProduct]
Returns data products indexed by their id.
- get_ddi_codebook(product_id, include_variables=True, include_statistics=False)[source]
Returns the DDI Codebook XML for a data product in this catalog.
- get_import_configuration(product_uri, file_info)[source]
Returns import configuration for a data product.
- create_sql_data_product(id, connection_string, table_name, username, password, name=None, description=None, is_private=True, lang='en')[source]
Creates a SQL-backed data product in this catalog.
- get_postman_collection(data_product_id=None)[source]
Returns a Postman collection for this catalog or one of its data product.
- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
Data Product
- class dartfx.mtnards.MtnaRdsDataProduct(*, uri, id, name=None, description=None, reference=None, revisionNumber=None, abbreviation=None, cached=None, doi=None, changeLog=None, citation=None, dataProductType=None, isPrivate=None, keywords=None, lastUpdate=None, provenance=None, urls=None)[source]
Bases:
MtnaRdsResource- property classifications: dict[str, MtnaRdsClassificationStub | MtnaRdsClassification]
- property variables: dict[str, MtnaRdsVariableStub | MtnaRdsVariable]
- get_classification_variables(classification)[source]
Returns all variables that use the given classification.
- get_croissant(include_codes=True, max_codes=100)[source]
Generates a Croissant ML metadata object for this data product.
- get_ddi_codebook(include_variables=True, include_statistics=True)[source]
Returns the DDI Codebook XML for this data product.
- get_import_configuration(file_info)[source]
Returns import configuration for uploading data into this product.
- get_markdown(sections=None, max_codes=10)[source]
Returns the markdown description of the data product.
- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
Variable
- class dartfx.mtnards.variable.MtnaRdsVariableStub(*, uri, id, name=None, description=None, reference=None, revisionNumber=None)[source]
Bases:
MtnaRdsResource- property croissant_data_type: DataType
Returns the Croissant data type for this variable.
- property classification: MtnaRdsClassificationStub | MtnaRdsClassification | None
- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- class dartfx.mtnards.MtnaRdsVariable(*, uri, id, name=None, description=None, reference=None, revisionNumber=None, classificationId=None, classificationUri=None, dataType=None, isDimension=None, isMeasure=None, isRequired=None, isWeight=None, label=None, lastUpdate=None, storageType=None)[source]
Bases:
MtnaRdsVariableStub- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
Classification
- class dartfx.mtnards.MtnaRdsClassificationStub(*, uri, id, name=None, description=None, reference=None, revisionNumber=None)[source]
Bases:
MtnaRdsResource- property codes: list[MtnaRdsClassificationCode]
- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- class dartfx.mtnards.classification.MtnaRdsClassification(*, uri, id, name=None, description=None, reference=None, revisionNumber=None, code_count=None)[source]
Bases:
MtnaRdsClassificationStub- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- class dartfx.mtnards.classification.MtnaRdsClassificationCode(*, uri, id=None, name=None, description=None, reference=None, revisionNumber=None, codeValue=None, isPrivate=None)[source]
Bases:
MtnaRdsResource- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
Process
- class dartfx.mtnards.process.MtnaRdsProcess(*, server=None, completed, id, failure=None, methodId, methodName, resourceName, resourceUri, status, completionDetails=None)[source]
Bases:
BaseModel- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- server: MtnaRdsServer | None
Base Classes
- class dartfx.mtnards.base.MtnaRdsResource(*, uri, id, name=None, description=None, reference=None, revisionNumber=None)[source]
Bases:
BaseModel- model_config = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Type Definitions
The module uses type hints extensively. Common types include:
str | None- Optional string valuesdict[str, T]- Dictionary with string keyslist[T]- List of objects of type Tbool | None- Optional boolean values
All public APIs include complete type hints for parameters and return values.