Skip to content

Commit

Permalink
Update register card (#1496)
Browse files Browse the repository at this point in the history
* ✨ Add fontSize configuration to the register card font, update the tasks register configuration to display the patient and practitioner

* ♻️ Fix code formatting

* ✅ Update failing tests

Co-authored-by: Peter Lubell-Doughtie <peter@ona.io>
  • Loading branch information
dubdabasoduba and pld authored Aug 2, 2022
1 parent 213080e commit cdc5853
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ data class CompoundTextProperties(
val secondaryText: String? = null,
val secondaryTextColor: String? = null,
val separator: String? = null,
val fontSize: Float = 16.0f
) : RegisterCardViewProperties()
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ data class ServiceButton(
val text: String? = null,
val status: String,
val smallSized: Boolean = false,
val questionnaire: QuestionnaireConfig? = null
val questionnaire: QuestionnaireConfig? = null,
val fontSize: Float = 12.0f
)
2 changes: 1 addition & 1 deletion android/quest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ android {
applicationIdSuffix ".ecbis"
versionNameSuffix "-ecbis"
versionCode 3
versionName "0.0.6"
versionName "0.1.1"
}
g6pd {
dimension "apps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@
"fhirResource": {
"baseResource": {
"resource": "Task"
}
},
"relatedResources": [
{
"resource": "Patient",
"fhirPathExpression": "Task.for"
},
{
"resource": "Practitioner",
"fhirPathExpression": "Task.owner"
}
]
},
"searchBar": {
"visible": true,
"display": "Search task by name",
"display": "Search by Task, Practitioner & Patient Name",
"computedRules": [
"taskName"
"taskName", "practitionerName", "patientName"
]
},
"registerCard": {
Expand Down Expand Up @@ -43,6 +53,20 @@
"actions": [
"data.put('taskStatusColorCode', data.get('taskStatus').equals('ready') ? 'DUE' : data.get('taskStatus').equals('failed') || data.get('taskStatus').equals('cancelled') ? 'OVERDUE' : data.get('taskStatus').equals('requested') ? 'UPCOMING' : data.get('taskStatus').equals('completed') ? 'COMPLETED' : 'UPCOMING')"
]
},
{
"name": "patientName",
"condition": "true",
"actions": [
"data.put('patientName', fhirPath.extractValue(Patient.get(0), \"Patient.name.select(given + ' ' + family)\"))"
]
},
{
"name": "practitionerName",
"condition": "true",
"actions": [
"data.put('practitionerName', fhirPath.extractValue(Practitioner.get(0), \"Practitioner.name.select(given + ' ' + family)\"))"
]
}
],
"views": [
Expand All @@ -60,7 +84,20 @@
{
"viewType": "COMPOUND_TEXT",
"primaryText": "Start date: @{taskStartDate}",
"primaryTextColor": "#5A5A5A"
"primaryTextColor": "#5A5A5A",
"fontSize": 14.0
},
{
"viewType": "COMPOUND_TEXT",
"primaryText": "Patient: @{patientName}",
"primaryTextColor": "#5A5A5A",
"fontSize": 14.0
},
{
"viewType": "COMPOUND_TEXT",
"primaryText": "Practitioner: @{practitionerName}",
"primaryTextColor": "#5A5A5A",
"fontSize": 14.0
}
],
"showVerticalDivider": false,
Expand Down
14 changes: 13 additions & 1 deletion android/quest/src/main/assets/configs/app/sync_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
"expression": "#organization"
}
},
{
"resource": {
"resourceType": "SearchParameter",
"name": "_id",
"code": "_id",
"base": [
"Practitioner"
]
},
"type": "token",
"expression": "130845,94398"
},
{
"resource": {
"resourceType": "SearchParameter",
Expand Down Expand Up @@ -112,4 +124,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ fun CompoundText(
Text(
text = compoundTextProperties.primaryText!!.interpolate(computedValuesMap),
color = compoundTextProperties.primaryTextColor.parseColor(),
modifier = modifier.wrapContentWidth(Alignment.Start)
modifier = modifier.wrapContentWidth(Alignment.Start),
fontSize = compoundTextProperties.fontSize.sp,
)
}
if (compoundTextProperties.secondaryText != null) {
Expand All @@ -204,7 +205,8 @@ fun CompoundText(
Text(
text = compoundTextProperties.secondaryText!!.interpolate(computedValuesMap),
color = compoundTextProperties.secondaryTextColor.parseColor(),
modifier = modifier.wrapContentWidth(Alignment.Start).padding(end = 8.dp)
modifier = modifier.wrapContentWidth(Alignment.Start).padding(end = 8.dp),
fontSize = compoundTextProperties.fontSize.sp,
)
}
}
Expand Down Expand Up @@ -336,7 +338,7 @@ private fun SmallServiceButton(
Text(
text = serviceButton.text ?: "",
color = contentColor,
fontSize = 12.sp,
fontSize = serviceButton.fontSize.sp,
fontWeight = FontWeight.Bold,
modifier = modifier.padding(4.dp).wrapContentHeight(Alignment.CenterVertically),
overflow = TextOverflow.Visible,
Expand All @@ -360,21 +362,28 @@ private fun BigServiceButton(
modifier =
modifier
.fillMaxSize()
.padding(8.dp)
.padding(4.dp)
.clip(RoundedCornerShape(4.dp))
.background(
if (extractedStatus == ServiceStatus.OVERDUE) contentColor else Color.Unspecified
),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
if (extractedStatus == ServiceStatus.COMPLETED)
Icon(imageVector = Icons.Filled.Check, contentDescription = null, tint = contentColor)
Text(
text = serviceButton.text?.interpolate(computedValuesMap) ?: "",
color = if (extractedStatus == ServiceStatus.OVERDUE) Color.White else contentColor,
textAlign = TextAlign.Center
)
Column(
verticalArrangement = Arrangement.Center,
modifier = modifier.fillMaxSize().padding(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
if (extractedStatus == ServiceStatus.COMPLETED)
Icon(imageVector = Icons.Filled.Check, contentDescription = null, tint = contentColor)
Text(
text = serviceButton.text?.interpolate(computedValuesMap) ?: "",
color = if (extractedStatus == ServiceStatus.OVERDUE) Color.White else contentColor,
textAlign = TextAlign.Center,
fontSize = serviceButton.fontSize.sp
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class QuestConfigServiceTest : RobolectricTest() {
ResourceType.Questionnaire,
ResourceType.QuestionnaireResponse,
ResourceType.StructureMap,
ResourceType.Task
ResourceType.Task,
ResourceType.Practitioner
)
.sorted()

Expand Down

0 comments on commit cdc5853

Please sign in to comment.