finos / finos/rune-python-generator

Standard Library for External Data (Codelist Support)

Open
#150 10 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
1
Forks
6
Avg merge
3d 1h
Merged PRs (30d)
13

Description

### Problem Description:
Rune models can rely on external data sources, such as FpML coding schemes or ISO code lists, for validating field values. In the Java implementation, this is handled by a standard `CodelistLoader`. The Python generator and runtime currently lack an equivalent mechanism to load, cache, and query these external data sources during validation.

### Steps to Reproduce:

Example Rune code: (see codelists in CDM)[https://github.com/finos/common-domain-model/blob/master/rosetta-source/src/main/rosetta/base-staticdata-codelist-func.rosetta]

```rosetta
namespace cdm.base.staticdata.codelist
version "${project.version}"

func LoadCodeList: <"Loads a code list JSON resource into memory in the form of cdm.base.staticdata.codelist.CodeList Rune object">
[codeImplementation]
inputs:
domain string (1..1) <"The identifier of the code list resource to retrieve. e.g. The cdm.base.staticdata.codelist.FpMLCodingScheme domain parameter">
output:
codelist CodeList (0..1) <"The loaded code list (or null if not found) ">

func ValidateFpMLCodingSchemeDomain: <"Validates an FpMLCodingScheme code against the resource code list defined by the domain. It leverages LoadCodeList internally.">
[codeImplementation]
inputs:
code FpMLCodingScheme (1..1) <"The code to be evaluated">
domain string (1..1) <"The code list domain">
output:
isValid boolean (1..1) <"The result of the external resource validation. retrieves 'True' if the code list is not found for the specified domain">
```

### Expected Result:
A standard Python library or runtime utility should be available to handle external data loading, allowing the generator to emit consistent validation calls.

### Actual Result:
Likely to be an issue like "NameError: name 'x.y.z' is not defined

### Additional Context:
This has a major impact on the **Common Domain Model (CDM)**, which uses external schemes for validating critical fields such as Business Centers. Without this support, any types using code lists will not be supported in the Python-generated CDM.

### Related CDM Issues:

[Issue #4277](https://github.com/finos/common-domain-model/issues/4277)
[Issue #3932](https://github.com/finos/common-domain-model/issues/3932)
[Issue #3929 ](https://github.com/finos/common-domain-model/issues/3929)
[Issue #3287](https://github.com/finos/common-domain-model/issues/3287)
[Issue # 3904](https://github.com/finos/common-domain-model/issues/3904)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.