avniproject / avniproject/rules-server
Unable to execute decision rule for Goonj Distribution entity
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
## Need
Goonj org needs its Avni source entities, Address Text fields to be in "StartCase".
We have implemented the logic as Decision rule for each of those Entity Types.
This works as expected in Avni-client,for all entity types.
It works fine for Activity on DEA.
But, for Distribution entityType, decisionRule exection on rules-server fails, with following error-stack-trace.
```
rulesController catchRuleError TypeError: Cannot read property 'name' of undefined
at Function.fromResource (/opt/rules-server/node_modules/openchs-models/dist/Concept.js:121:36)
at Function.constructConceptModel (/opt/rules-server/node_modules/openchs-models/dist/observation/QuestionGroup.js:63:38)
at _lodash.default.map (/opt/rules-server/node_modules/openchs-models/dist/observation/QuestionGroup.js:52:43)
at arrayMap (/opt/rules-server/node_modules/lodash/lodash.js:639:23)
at Function.map (/opt/rules-server/node_modules/lodash/lodash.js:9554:14)
at Function.fromObs (/opt/rules-server/node_modules/openchs-models/dist/observation/QuestionGroup.js:47:36)
at Concept.getValueWrapperFor (/opt/rules-server/node_modules/openchs-models/dist/Concept.js:247:129)
at mapObservation (/opt/rules-server/src/models/observationModel.js:74:56)
at /opt/rules-server/src/models/observationModel.js:12:20
at Array.map ()
```
## Additional info
Complex elements used in Distribution entity are:
- - QuestionGroup
- - RepeatableQuestionGroup
- - SubjectFormElement
## AC
- Decision rule execution for Distribution Entity Type of Goonj works as expected.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at src/models/observationModel.js, especially mapObservation, and follow the stack trace through QuestionGroup and Concept while reproducing decision-rule execution for the Distribution entity. Done means the Goonj Distribution decision rule executes successfully on the rules server without the undefined name error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100