Skip to content

Commit

Permalink
adds component reference section
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Jan 18, 2024
1 parent 2b2d119 commit 3f7eccf
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Requirements

- [ ] This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a [conventional commit](https://o3-dev.docs.openmrs.org/#/getting_started/contributing?id=your-pr-title-should-indicate-the-type-of-change-it-is) label. See existing PR titles for inspiration.
- [ ] My work conforms to the [OpenMRS 3.0 Styleguide](https://om.rs/styleguide) and [design documentation](https://zeroheight.com/23a080e38/p/880723-introduction).
- [ ] My work includes tests or is validated by existing tests.

## Summary
<!-- Please describe what problems your PR addresses. -->

## Screenshots / Video Recording
<!-- Required if you are making UI changes. -->

## Related Issue
<!-- Paste the link to the Jira ticket here if one exists. -->
<!-- https://issues.openmrs.org/browse/O3- -->

## Other
<!-- Anything not covered above -->
74 changes: 72 additions & 2 deletions pages/docs/core-concepts/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The resulting component json will be as shown below;
"questions": [
{
"label": "Current HIV status",
"id": "currentHivStatus",
"type": "obs",
"questionOptions": {
"rendering": "select",
Expand All @@ -66,6 +67,7 @@ The resulting component json will be as shown below;
},
{
"label": "Was the visit scheduled?",
"id": "wasVisitScheduled",
"type": "obs",
"questionOptions": {
"rendering": "select",
Expand Down Expand Up @@ -95,6 +97,74 @@ The resulting component json will be as shown below;

## Referencing Components

You can construct forms in the Form Builder by referencing components that have already been saved in the system. To do this, follow the steps below:
You can reference components that have already been saved in the system by adding it the `referencedForms` key to your json form.

TBD
```json copy
"referencedForms": [
{
"formName": "component_preclinic-review",
"alias": "pcr"
},
{
"formName": "component_art",
"alias": "art"
}
]
```

### Available visual options

- `form` : The alias of the referenced component form as defined in the `referencedForms` key
- `page` : The page label of the referenced component form
- `section` : The section label of the referenced component form to be displayed
- `excludeQuestions` : An array of question id(s) to be excluded from the referenced section of component form


### Example
Below is the complete json form with 2 components referenced;

```json copy
{
"name": "ART Enrollment Form",
"uuid": "xxxx",
"encounterType": "xxxx",
"processor": "EncounterFormProcessor",
"referencedForms": [
{
"formName": "component_preclinic-review",
"alias": "pcr"
},
{
"formName": "component_art",
"alias": "art"
}
],
"pages": [
{
"label": "Pre-Clinic Review",
"sections": [
{
"reference": {
"form": "pcr",
"page": "Pre-clinic Review",
"section": "Pre-clinic Review"
}
}
]
},
{
"label": "ART History",
"sections": [
{
"reference": {
"form": "art",
"page": "ART ",
"section": "ART History",
"excludeQuestions": ["currentArtRegimen"]
}
}
]
}
]
}
```

0 comments on commit 3f7eccf

Please sign in to comment.