Note |
---|
This module was created by the https://openimis.atlassian.net/wiki/spaces/OP/pages/2161147938/Project+D1+Formal+Sector+Support?pageId=2161147938 the concept and business logic where develop for that scope but the rules are used in other context such as the Project: 2021.T3 Payment Layer |
version
version | date | comment | changes |
---|---|---|---|
1 | 06-2021 | formal sector | |
2 | 08-2021 | payment layer | remove acceptance criteria form FS cleaning FS specifics move calculation rules in a specific table |
Concepts
The rules for the Formal Sector the the calculation of the policy value or payment to HF can be complex and evolving. Therefore, the "Formal Sector" solution should bring flexibility, to avoid complete redesign and databases change when a parameter to define the contribution value is changed.
To bring that flexibility, the solution described here uses a Calculation Rule (the Calculation Rules are defined in additional openIMIS modules extending the Calculation Module). This module is defining a framework to design calculations and to manage their activation and versioning in openIMIS. This solution will deliver a Calculation Module that takes the income (on the level of the Contract’s insuree) and a rate (on the level of the Contribution Plan) as parameters, make the calculation and updates the payment value of the Contract’s insuree.
The value of the parameters will be saved as a JSON string in the json_ext
field.
Later, this module could be used as a framework to create event-based actions
Business process: example of the formal sector
This module will use a "generic contribution" to get the required parameters and the json_ext
database field will be used to save the parameters (generic backend feature). Finally, a signal will trigger the calculation action.
...
Code Block |
---|
my_signal= dispatch.Signal(providing_args=["instance","user"]) |
Use cases (specific to formal sector)
UC14-1: add a new Calculation rule (needs to change the openimis.json).
UC14-2: use the contribution_fe to select a calculation rule.
UC14-3: use the contribution_fe to display the parameters required by multiple calculation for an object.
UC14-4: replace a calculation rule.
UC14-5: remove a calculation rule.
Authorities
This module won't have ad-hoc authorities.
Entities
class CalculationRules
CalculationClassName: strStatus: intDescription: strPriority : intdateValidFrom : date
dateValidTo : date
class CalculationRulesDetails (HistoryModel)
CalculationRulesUUID: uuidStatus: intClassName: strMain: boolParams: DictClassParams: List[CalculationParam]
class CalculationParam
...
Type: str
...
rights: Dict
...
Relevance: str
...
conditions: str
...
Detailed design
Calculations Backend Module
...
return all the returnListClass
Authorities
Calculation (prefix 153)
search → 153 001
update → 153 003 (to activate or not)
...