Skip to content

Commit

Permalink
Implement questionnaire-unit and questionnaire-unitOption extensions (#…
Browse files Browse the repository at this point in the history
…2014)

* Implement questionnaire-unit and questionnaire-unitOption extensions

* Fix instrumentation tests

* Run spotless

* Fix wrong dimen after sync

* Fix quantity questionnaire with validation

* Update the text field questionnaire with validation

* Reorder extensions in questionnaire

* Add link to spec in for unit extensions.

* Add kdoc

* Fix build

* Add helper text

* Add unit tests

* Fix quantity widget expresso tests
  • Loading branch information
jingtang10 committed Aug 21, 2023
1 parent 14e1277 commit 7f79e26
Show file tree
Hide file tree
Showing 18 changed files with 1,056 additions and 334 deletions.
28 changes: 28 additions & 0 deletions catalog/src/main/assets/component_quantity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1",
"text": "Enter length",
"type": "quantity",
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "cm",
"display": "centimeter"
}
},
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "[in_i]",
"display": "inch"
}
}
]
}
]
}
29 changes: 29 additions & 0 deletions catalog/src/main/assets/component_quantity_with_validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1",
"text": "Enter length",
"type": "quantity",
"required": true,
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "cm",
"display": "centimeter"
}
},
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "[in_i]",
"display": "inch"
}
}
]
}
]
}
73 changes: 59 additions & 14 deletions catalog/src/main/assets/component_text_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1.1",
"text": "Register new patient",
"linkId": "1",
"type": "string",
"item": [
{
"linkId": "1-first-name",
"text": "First Name",
"linkId": "1.1",
"text": "Enter a string",
"type": "display",
"extension": [
{
Expand All @@ -29,12 +28,12 @@
]
},
{
"linkId": "2.2",
"type": "string",
"linkId": "2",
"type": "integer",
"item": [
{
"linkId": "1-family-name",
"text": "Family Name",
"linkId": "2.1",
"text": "Enter an integer",
"type": "display",
"extension": [
{
Expand All @@ -55,12 +54,48 @@
]
},
{
"linkId": "3.3",
"linkId": "3",
"type": "decimal",
"item": [
{
"linkId": "3.1",
"text": "Enter a decimal",
"type": "display",
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http:https://hl7.org/fhir/questionnaire-item-control",
"code": "flyover",
"display": "Fly-over"
}
],
"text": "Flyover"
}
}
]
}
]
},
{
"linkId": "4",
"type": "integer",
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unit",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "kg",
"display": "kilogram"
}
}
],
"item": [
{
"linkId": "1-id-number",
"text": "ID number",
"linkId": "4.1",
"text": "Enter an integer (with unit)",
"type": "display",
"extension": [
{
Expand All @@ -81,12 +116,22 @@
]
},
{
"linkId": "4.4",
"linkId": "5",
"type": "decimal",
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unit",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "kg",
"display": "kilogram"
}
}
],
"item": [
{
"linkId": "1-mobile-number",
"text": "Mobile number",
"linkId": "5.1",
"text": "Enter a decimal (with unit)",
"type": "display",
"extension": [
{
Expand Down
74 changes: 60 additions & 14 deletions catalog/src/main/assets/component_text_fields_with_validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1.1",
"text": "Register new patient",
"linkId": "1",
"type": "string",
"required": true,
"item": [
{
"linkId": "1-first-name",
"text": "First Name",
"linkId": "1.1",
"text": "Enter a string",
"type": "display",
"extension": [
{
Expand All @@ -30,13 +29,40 @@
]
},
{
"linkId": "2.2",
"type": "string",
"linkId": "2",
"type": "integer",
"required": true,
"item": [
{
"linkId": "2.1",
"text": "Enter an integer",
"type": "display",
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http:https://hl7.org/fhir/questionnaire-item-control",
"code": "flyover",
"display": "Fly-over"
}
],
"text": "Flyover"
}
}
]
}
]
},
{
"linkId": "3",
"type": "decimal",
"required": true,
"item": [
{
"linkId": "1-family-name",
"text": "Family Name",
"linkId": "3.1",
"text": "Enter a decimal",
"type": "display",
"extension": [
{
Expand All @@ -57,13 +83,23 @@
]
},
{
"linkId": "3.3",
"linkId": "4",
"type": "integer",
"required": true,
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unit",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "kg",
"display": "kilogram"
}
}
],
"item": [
{
"linkId": "1-id-number",
"text": "ID number",
"linkId": "4.1",
"text": "Enter an integer (with unit)",
"type": "display",
"extension": [
{
Expand All @@ -84,13 +120,23 @@
]
},
{
"linkId": "4.4",
"linkId": "5",
"type": "decimal",
"required": true,
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-unit",
"valueCoding": {
"system": "http:https://unitsofmeasure.org",
"code": "kg",
"display": "kilogram"
}
}
],
"item": [
{
"linkId": "1-mobile-number",
"text": "Mobile number",
"linkId": "5.1",
"text": "Enter a decimal (with unit)",
"type": "display",
"extension": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ class ComponentListViewModel(application: Application, private val state: SavedS
"component_slider.json",
"component_slider_with_validation.json"
),
QUANTITY(
R.drawable.ic_unitoptions,
R.string.component_name_quantity,
"component_quantity.json",
"component_quantity_with_validation.json"
),
ATTACHMENT(
R.drawable.ic_attachment,
R.string.component_name_attachment,
Expand Down Expand Up @@ -151,6 +157,7 @@ class ComponentListViewModel(application: Application, private val state: SavedS
ViewItem.ComponentItem(Component.DATE_PICKER),
ViewItem.ComponentItem(Component.DATE_TIME_PICKER),
ViewItem.ComponentItem(Component.SLIDER),
ViewItem.ComponentItem(Component.QUANTITY),
ViewItem.ComponentItem(Component.ATTACHMENT),
ViewItem.ComponentItem(Component.REPEATED_GROUP),
ViewItem.HeaderItem(Header.MISC_COMPONENTS),
Expand Down
11 changes: 6 additions & 5 deletions catalog/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
<string name="component_nav_heading">Components</string>
<string name="layout_nav_heading">Layouts</string>
<string name="behavior_nav_heading">Behaviors</string>
<string name="component_name_multiple_choice">Multiple choice</string>
<string name="component_name_single_choice">Single choice</string>
<string name="component_name_boolean_choice">Boolean choice</string>
<string name="component_name_single_choice">Single choice</string>
<string name="component_name_multiple_choice">Multiple choice</string>
<string name="component_name_dropdown">Dropdown</string>
<string name="component_name_modal">Modal</string>
<string name="component_name_open_choice">Open choice</string>
<string name="component_name_text_field">Text field </string>
<string name="component_name_auto_complete">Auto Complete</string>
<string name="component_name_date_picker">Date picker</string>
<string name="component_name_date_time_picker">DateTime picker</string>
<string name="component_name_modal">Modal</string>
<string name="component_name_slider">Slider</string>
<string name="component_name_dropdown">Dropdown</string>
<string name="component_name_auto_complete">Auto Complete</string>
<string name="component_name_quantity">Quantity</string>
<string name="component_name_help">Help</string>
<string name="component_name_item_media">Item Media</string>
<string name="component_name_item_answer_media">Item Answer Media</string>
Expand Down
Loading

0 comments on commit 7f79e26

Please sign in to comment.