-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading External Reference Data into CDM - FpML Coding Schemes #879
Comments
Some questions:
|
|
@brianlynn2 - an interesting approach - there are couple of implications in my view:
|
@plamen-neykov thanks for the questions. Some feedback on your comments.
|
The version of the code lists used for building the model can be included automatically in the output json - this is nothing the user has to manage himself. Even if this information is ignored at ingestion by the software, it still can be used by the user to identify quickly the issue and minimize the time required to diagnose why particular messages do not deserialize. I'm pretty sure, that investing the couple of hours needed to include the version(s) of the codelists in the serialised object will save quite sizeable amount of investigation time across the industry. Note - the new serialisation already carries the version of the CDM model and it will not be a huge effort to include this additional information. |
Just to clarify, the scope of the project is not to change functionally the reference data model that is consumed currently in FpML. CDM currently consumes the latest version of the FpML coding schemes available and generates the enumerated lists. For example: We are not planning to change that "latest version" consumption behaviour. Implementers can override the default implementation if they want and use specific versions but that's not the scope of the project. |
If the implementers of the serialization logic want to store the version of each codelist that was in effect when the trade was created, that's fine by me. Perhaps someday that could be used for a smarter validation. But as Marc says, that's not our project. |
@brianlynn2 I agree, that including the code list(s) versions in the serialisation output should be implemented by the serialisation developers (and I wasn't eluding it should be part of your project). |
Overall I think the idea of supporting custom validation logic on basic types is great. I do have some remarks/ideas about how we could declare it, so below are a few iterations of my thought process. As an example, I will use currency codes. Current proposal (completed with the actual function definition)typeAlias CurrencyCode:
string(validationRule: "ValidateCodeList", domain: "currency-code")
func ValidateCodeList: // this function will be implemented in Java
inputs:
inputToValidate string (1..1)
domain string (1..1)
output:
isValid boolean (1..1) Remarks:
Iteration 1typeAlias CurrencyCode:
string(validationRule: ValidateCodeList(item, "currency-code")) Note that we are just calling the function directly with the "currency-code" argument. It doesn't have to be a function call though - it can be an arbitrary expression that evaluates to a boolean. In this instance
Iteration 2typeAlias CurrencyCode:
string
condition IsCurrencyCode:
ValidateCodeList(item, "currency-code") The good thing is we're reusing an existing well-thought through concept, with all of its benefits:
Additionally, instead of defining a type alias for every FpML coding scheme, which is over 200, we could use the existing (but not well known) feature of parameterized type aliases: typeAlias FpMLCodingScheme(domain string):
string
condition IsFpMLCodingScheme:
ValidateCodeList(item, domain) Note that the type Foo:
currencyCode FpMLCodingScheme("currency-code") (1..1) Or, if modellers prefer to name it more explicitly, they can still reuse the typeAlias CurrencyCode:
FpMLCodingScheme("currency-code")
type Foo:
currencyCode CurrencyCode (1..1) Open for feedback. |
Hi @SimonCockx ... Thanks for these ideas. In general I like the idea of using a "condition" on a string typeAlias if this is possible. We'd considered the possibility but didn't know how to implement it, so proposed what we thought was a simpler solution. Is it possible to do this without a Rune syntax change or enhancement? If so, that could work very well for us. I agree that directly using the Rune validation function name rather than a string code would be preferable, but wasn't sure how to implement that easily; so we proposed something we thought might be simpler to implement. But from your comment it looks like it can be done using existing Rune syntax. If so, that would be perfect. Both of your ideas look good. The parameterized typeAlias is particularly clever, while the more explicit representation is also very straightforward. We'll try testing those approaches to see if they work for us. Of the 200 FpML coding schemes, it looks like only a subset (about 40) are in use by CDM in a way that we would want to map to the new approach, in the short term. But having a solution that could work for the 200 would be super, as CDM grows. |
@SimonCockx I looked at this in more detail and now I understand that you meant we should add the "condition" capability to a typeAlias, that it's not already possible to do so. Can you please advise what would be entailed in imlementing that? Our current solution is quite simple to implement, and we're not keen to do something more complex. But if adding "condition" to typeAlias would be simple, that might be a good direction to pursue. |
@SimonCockx @brianlynn2 We looked at this in a bit more detail. Simon's option 1 is what we (@manel-martos and @arnauoller) are exploring. We are interested in completing the research in changing rune-dsl. However, we see the benefits of Simon's option 2 since we wouldn't need to change the rune-dsl syntax. We don't have a strong preference for either of the two options since functionally they are equivalent. |
Hi @brianlynn2, happy to give a quick overview of what would change if we were to add conditions to type aliases.
These are specific to this solution. The rest is common: changes to the type system and changes to the Java generator. Note that there are many things you get for free - function reference resolution (including functions from other namespaces which are imported), support for arbitrary expressions, type checking inside your condition, a condition name to display in the validation report, syntax highlighting, ... - all things which you'll have to think about if you follow a different path. In that sense, I think the Other than that, because of the central role this project takes in many other projects (CDM/DRR/...), we only accept high quality contributions, so the argument of having an easier implementation does not weigh up to that. Happy to help along the way though, whichever direction we end up going! |
@SimonCockx ... thanks for the description. It does not sound particularly easy, but we'll look at it. When you say "we only accept high quality contributions, so the argument of having an easier implementation does not weigh up to that." you sound a bit like a Mafia don rather than someone trying to help. The existing solution for the reference data (using a hard coded enumeration for lists that change often monthly to quarterly) is an utterly unacceptable solution, not "high quality" in any way in our opinion. Our efforts to get that changed that resulted in a complex REGnosys-designed solution to update some of the enumerations automatically at build time, but didn't actually solve the underlying problem. If we can't make a solution with a syntax change with a reasonable amount of effort, we replace it with a string and find another way to trigger validation. |
I did not intend to come across like that, nor do I wish to enter a conflict. To be able to collaborate effectively and comfortably on this issue, I would like it if we would be able to find an agreement on the path forward. Perhaps we can plan a chat when everyone is back from their holidays? |
@SimonCockx thank you for your words. I agree that a face to face discussion early in the New Year would be helpful. Meanwhile Manuel and company at TradeHeader can look into your ideas and see how easily they can implement them. To give you some context for my frustration:
The point of this story is that technical perfection and elegance of a solution is only part of the decision making process. We also need to meet business requirements. And because of the challenges of getting funding for this, one of the requirements we needed to meet is to make the solution relatively affordable. If we were to create a basic solution using typeAlias to a slightly enhanced string type, as in our initial proposal , it would be trivial to adjust that solution to base the typeAlias on some better syntax, like either of your proposals, and then everything else should continue to work without change. Much more of our work in this project is about other things unrelated to the Rune syntax, like getting valid JSON from FpML lists and loading it and validating against it. So there's nothing about the basic solution that prevents making it better in the future, once there is funding to make a technically better (i.e. more general and all encompassing) Rune enhancement. Or perhaps with your assistance Manuel and his colleague can make one of your (I agree, technically superior) solutions work in a reasonable time frame. I am very supportive of creating the best technical solutions we can to address business problems, as long as those solutions can be within the constraints given to us. Sometimes the "best" technical solutions may not be able to be implemented as soon as we like, due to real world constraints. Like money. Best regards, |
We at TradeHeader are focused on completing our learning curve with the Rune upgrade, as we recognize that the complexity inherent in all projects requires time and careful resolution. We are adhering to our planned calendar and aim to deliver technical conclusions to @brianlynn2 before the end of the year. Following the holidays, I will continue to review Simon’s proposals. Our objective is to fully meet requirements while also mitigating potential contingencies, with DSL being one of them. @SimonCockx – thank you for your valuable input during Wednesday’s call. It significantly clarified our initial changes and allowed us to enhance our testing scenarios. I am currently investigating the build, having intentionally modified the type creator to conduct a deeper inspection of the built-in type-related features we discussed. At this stage, we do not plan to submit any contributions. Regarding the notion of high-quality contributions – we fully align with the understanding that contributions should be comprehensive, meet all functional requirements, include thorough documentation via release notes, and expand testing scenario coverage for the proposed changes or additions. This is the approach TradeHeader intends to maintain for all future work. I kindly ask for patience as we continue this process. Should there be any need for clarification, we will let you all know with enough time. |
Problem Statement
CDM currently loads FpML coding schemes and compiles them generating a static enumerated list using the Rune DSL
docReference
annotations.Lists in Scope
There are currently 15 CDM enumerations automatically regenerated by CDM on each release based on the FpML coding scheme. These all should be converted to the new mechanism.
10 CDM enumerated lists look like good candidates to be moved to the new mechanism because the schemes are relatively large (10+ values) and are expected to change relatively frequently, and the values are used infrequently in the code in most cases. However, they require further analysis and discussion.
Proposed Implementation
The proposed implementation changes the Rune syntax by extending the
string
data type (details subject to refinement based on detailed design and implementation work and feedback from the CDM TAWG and Rune working groups):string
type would be enhanced to include a new user-defined validation mechanism.string
type supports validated properties (constraints) forminLength
,maxLength
, andpattern
.validationRule
would be a string that identifies the name of a user-defined validation rule that would be executed when thestring
is set, similar to the existing validation constraints. For the purposes of this project, we would always set this to the same value, something like "CodeListValidation
”. Different values of this property could be used for other types of validation, such as CRCs/CheckSums, or database or API lookups.domain
would be a string that identifies the list of values to validate against, e.g. “currency-code” or “business-center” or “floating-rate-index”, and could be used by the validation rule to refine its validation.ValidateString
with the parametersvalidationRule
,domain
, and the value of the string to be validated.IsValidString
user-defined function written in Rune to override the default validation logic from the Rune run-time and apply the appropriate user-defined validation logic, depending on thevalidationRule
parameter. For theCodeListValidation
rule it would validate the string value against a value retrieved based on the supplied and domain. For example, this could be a request to validate the code value “XYZ” or “USD” against the “currency-code” code list domain.ValidateString
function to the CDMIsValidString
UDF implementation, so that when the string validation logic is triggered by the generated code and Rune runtime, it will call out to the CDM validation function.typeAlias
including the appropriate constraint properties. For example:typeAlias Currency : string (validationRule: “CodeListValidation”, domain: “currency-code”)
typeAlias BusinessCenter : string (validationRule: “CodeListValidation”, domain: “business-center”)
IsValidString
function would be a single function written in Rune as part of the CDM base functionality that could be used to check against any code list.typeAlias
.The text was updated successfully, but these errors were encountered: