generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation and transformation ADRs (#1142)
* wip: add adrs for rule engines * Updated template with Impact section - added Impact section for revision improvement * Updated template format for clarity * Modified ADR #20 - modified wording and format - added additional context for Impact * Modified ADR #21 - reworded and modified format to include Impact * Modified ADR #22 - Updated format - Added content * Updated validation engine ADR * Updated transformation engine ADR * Fixed a few typos * Added another plus * Fixed formatting and added impact considerations for ADR 001 --------- Co-authored-by: tjohnson7021 <tjohnson@flexion.us> Co-authored-by: Tiffini Johnson <86614374+tjohnson7021@users.noreply.github.com>
- Loading branch information
1 parent
f418aff
commit 219bfbd
Showing
4 changed files
with
131 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 21. Validation Engine | ||
|
||
Date: 2024-06-11 | ||
|
||
## Decision | ||
|
||
We will implement a Validation Engine using the [Rules Engine Pattern](https://deviq.com/design-patterns/rules-engine-pattern) to validate incoming FHIR messages, based on given conditions. Each validation will be represented as a rule, specifying conditions that must be met, and the corresponding failure message if validation fails. | ||
|
||
Initially, rules will be stored in a JSON resource file, but the plan is to migrate them to a database or or other type of external storage in the future, which would allow to update the rules without the need for deploying the application. | ||
|
||
## Status | ||
|
||
Accepted. | ||
|
||
## Context | ||
|
||
The intermediary needs to validate FHIR messages based on SME research and partner-specific requirements, which are subject to change. The Rules Engine Pattern enables flexible, scalable, and maintainable validation management. | ||
|
||
## Impact | ||
|
||
### Positive | ||
|
||
- Easy to update and scale validations. Easy to refine scope for validations (general or partner-specific) | ||
- Validation rules could be reused by multiple partners. | ||
- It should make it easier to add a UI in the future, which could potentially allow partners to self-serve and add their own validations. | ||
- The framework can be leveraged to implement transformations as well. | ||
- Separation of concerns and code reusability. | ||
- It's modular enough that in the future we could decide to spin-off the Validation Engine into its own microservice that could be used to validate any FHIR (and potentially HL7) message. | ||
|
||
### Negative | ||
|
||
- There's added overhead code for the engine, but this code should seldom be required to maintain compared to the actual rules which should be a lot easier to maintain. | ||
- We'll need to deploy the application to have any changes to the validations available in production, at least until we migrate to a database or external storage. | ||
|
||
### Risks | ||
|
||
- The engine will need to iterate over all rules to decide which ones to apply, which could impact performance if the rules grow substantially. | ||
- If the conditions are not well defined there could be potential leakage (validations misapplied), but this should be identified in staging while onboarding. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 22. Transformation Engine | ||
|
||
Date: 2024-06-11 | ||
|
||
## Decision | ||
|
||
As with the [Validation Rule Engine](021-validation-engine.md), we will use a variation of the [Rules Engine Pattern](https://deviq.com/design-patterns/rules-engine-pattern) to design and implement a transformation rule engine that can transform incoming FHIR messages, given a condition. Each transformation will be represented as a rule, specifying conditions that must be met, with a name and arguments. The name of the rule will match a Java function in [/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/](/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/) that will apply the transformation, using the given arguments. | ||
|
||
Failed transformations will not interrupt the flow of the message. Any transformations that have errors will be skipped instead, making sure to log the error. | ||
|
||
Initially, rules will be stored in a JSON resource file, but the plan is to migrate them to a database or external storage in the future, which would allow to update the rules without the need for deploying the application. | ||
|
||
## Status | ||
|
||
Accepted. | ||
|
||
## Context | ||
|
||
The intermediary needs to transform incoming FHIR messages based on partner-specific requirements, which are subject to change. The Rules Engine Pattern enables flexible, scalable, and maintainable management for transformations. | ||
|
||
## Impact | ||
|
||
### Positive | ||
|
||
- Easy to update and scale transformations. Easy to refine scope for transformations (general or partner-specific) | ||
- Transformation rules could be reused by multiple partners. | ||
- It should make it easier to add a UI in the future, which could potentially allow partners to self-serve and add their own transformations. | ||
- Leverages on existing code from the Validation Rules Engine. | ||
- Separation of concerns and code reusability. | ||
- It's modular enough that in the future we could decide to spin-off the Transformation Engine into its own microservice that could be used to transform any FHIR (and potentially HL7) message. | ||
|
||
### Negative | ||
|
||
- There could potentially be conflicts between rules. Order of execution matters. | ||
- There's added overhead code for the engine, but this code should seldom be required to maintain compared to the actual rules which should be a lot easier to maintain. | ||
- We'll need to deploy the application to have any changes to the transformations available in production, at least until we migrate to a database or external storage. | ||
|
||
### Risks | ||
|
||
- The engine will need to iterate over all rules to decide which ones to apply, which could impact performance if the rules grow substantially. | ||
- If the conditions are not well defined there could be potential leakage (transformations misapplied), but this should be identified in staging while onboarding. |