Skip to content

Commit

Permalink
remove validation
Browse files Browse the repository at this point in the history
  • Loading branch information
lincmba committed Dec 20, 2024
1 parent b7f5246 commit 95082b8
Showing 1 changed file with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,35 +80,8 @@ class TextToForm(private val geminiClient: GeminiClient) {
* Validates the QuestionnaireResponse structure.
*/
private fun validateQuestionnaireResponse(qr: QuestionnaireResponse): Boolean {
if (qr.resourceType.toString() != "QuestionnaireResponse") {
logger.warning("Resource type is not QuestionnaireResponse.")
return false
}
if (qr.status == null) {
logger.warning("QuestionnaireResponse must have a status.")
return false
}
if (qr.questionnaire == null) {
logger.warning("QuestionnaireResponse must reference a Questionnaire.")
return false
}
if (qr.item.isNullOrEmpty()) {
logger.warning("QuestionnaireResponse must contain at least one item.")
return false
}
//todo use SDC validation

qr.item.forEach { item ->
if (item.linkId.isNullOrEmpty()) {
logger.warning("Each item must have a linkId.")
return false
}
item.answer?.forEach { answer ->
if (answer.value == null) {
logger.warning("Item ${item.linkId} has an invalid or empty answer.")
return false
}
}
}
return true
}
}

0 comments on commit 95082b8

Please sign in to comment.