Skip to content

Commit

Permalink
Address Jing's Review
Browse files Browse the repository at this point in the history
  • Loading branch information
FikriMilano committed Oct 14, 2023
1 parent 41a957d commit 8a2a52a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,15 @@ object ResourceMapper {

questionnaireItem.initialExpression
?.let {
fhirPathEngine.evaluate(launchContexts, null, null, null, it.expression).firstOrNull()
fhirPathEngine
.evaluate(
/* appContext= */ launchContexts,
/* focusResource= */ null,
/* rootResource= */ null,
/* base= */ null,
/* path= */ it.expression,
)
.firstOrNull()
}
?.let {
// Set initial value for the questionnaire item. Questionnaire items should not have both
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,16 +812,6 @@ class ResourceMapperTest {
runBlocking {
val questionnaire =
Questionnaire()
.apply {
addExtension().apply {
url = EXTENSION_SDC_QUESTIONNAIRE_LAUNCH_CONTEXT
extension =
listOf(
Extension("name", Coding(EXTENSION_LAUNCH_CONTEXT, "mother", "Mother")),
Extension("type", CodeType("Patient")),
)
}
}
.addItem(
Questionnaire.QuestionnaireItemComponent().apply {
linkId = "patient-dob"
Expand All @@ -839,9 +829,7 @@ class ResourceMapperTest {
},
)

val patientId = UUID.randomUUID().toString()
val patient = Patient().apply { id = "Patient/$patientId/_history/2" }
val questionnaireResponse = ResourceMapper.populate(questionnaire, mapOf("mother" to patient))
val questionnaireResponse = ResourceMapper.populate(questionnaire, emptyMap())

assertThat((questionnaireResponse.item[0].answer[0].value as DateType).localDate)
.isEqualTo((DateType(Date())).localDate)
Expand Down

0 comments on commit 8a2a52a

Please sign in to comment.