Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOB validation - Date of Birth should be <= today() #845

Closed
f-odhiambo opened this issue Dec 7, 2021 · 10 comments
Closed

DOB validation - Date of Birth should be <= today() #845

f-odhiambo opened this issue Dec 7, 2021 · 10 comments
Assignees
Labels
Enhancement New feature or request

Comments

@f-odhiambo
Copy link
Contributor

f-odhiambo commented Dec 7, 2021

Name of feature to enhance
A client's date of birth should be <= today()

Description of feature

  1. A person cannot be born in the future
  2. This validation should happen prior to saving a client's details

Should apply to all DOB fields currently available in

  1. Quest / G6PD
  2. LMH e-CBIS
@f-odhiambo f-odhiambo added Enhancement New feature or request foundation labels Dec 7, 2021
@f-odhiambo f-odhiambo changed the title DOB validation - Add date of birth should be <= today() DOB validation - Date of Birth should be <= today() Dec 7, 2021
@f-odhiambo
Copy link
Contributor Author

f-odhiambo commented Dec 7, 2021

  1. Might be a min-max value that is set on the Questionnaire and computed by SDC. More details here http://hl7.org/fhir/uv/sdc/2019May/behavior.html
  2. Need to confirm support on Android FHIR SDK

maxValue | Core | date, dateTime, time, decimal, integer | as per question type

This extension is used for questions with simple quantitative types. It does not currently support the Quantity data type. The extension allows establishing the upper bound for an answer. For example, ensuring that birth dates are >= 1990-01-01 or an integer is greater than or equal to 0. (Note that the integer and decimal types both allow negative numbers if not constrained.) This extension can be used together with the cqf-calculatedValue extension to establish a dynamic limit. For example, ensuring that a date of birth will result in a minimum age by setting maxValue with an expression of 'today() - 18 years'.The minValue SHALL be less than or equal to the maxValue, if both are specified.

@pld
Copy link
Member

pld commented Dec 8, 2021

Can we do this in the Questionniare and not in code?

@f-odhiambo
Copy link
Contributor Author

Can we do this in the Questionnaire and not in code?

Yes. This is accurate, We should be able to update the Questionnaire with min/max values and then check if the SDC Lib can be able to translate it correctly or raise an issue if we have any bugs/enhancements for it.

@f-odhiambo
Copy link
Contributor Author

f-odhiambo commented Dec 14, 2021

We could add the following extensions for

min value

"extension": [
  {
    "url": "http://hl7.org/fhir/StructureDefinition/minValue",
    "valueDate": "2022-05-20"
  }]

& max value

"extension": [
  {
    "url": "http://hl7.org/fhir/StructureDefinition/maxValue",
    "valueDate": "2022-09-20"
  }]

and the resulting questionnaire validation
Screenshot 2021-12-09 at 09 05 43

NB. We could set a date for min value. Looking into whether we could use today() as a function for max value

@f-odhiambo
Copy link
Contributor Author

ill pick this up

@RaaziaTarique
Copy link
Member

RaaziaTarique commented Jan 12, 2022

As per the SDK we can add extensions for min-max value validation in the questionnaire but as per my findings we can't make those validations dynamic i.e use current date as maxValue. CC: @f-odhiambo

@pld
Copy link
Member

pld commented Jan 12, 2022

if you haven't yet can you please ask on zulip (I think there's an SDC channel), how people handle dynamic max?

also is there an issue on the sdk repo for this? if not, can yea please create one, thanks!

@f-odhiambo
Copy link
Contributor Author

f-odhiambo commented Jan 13, 2022

Yes, @pld. We had a discussion on the Android FHIR SDK Developers call today Jan 13th 2022, will create a ticket on SDK and tag here as well

cc @Tarun-Bhardwaj @jingtang10

@jingtang10
Copy link

jingtang10 commented Jan 13, 2022

if you haven't yet can you please ask on zulip (I think there's an SDC channel), how people handle dynamic max?

#questionnaire channel:
https://chat.fhir.org/#narrow/stream/179255-questionnaire

@jingtang10
Copy link

Yes, @pld. We had a discussion on the Android FHIR SDK Developers call today Jan 13th 2022, will create a ticket on SDK and tag here as well

cc @Tarun-Bhardwaj @jingtang10

As discussed there are 2 things to consider in this ticket:

  1. to be able to resolve expressions such as today() in the min max value extension
  2. to use the min max value extension in the actual date picker pop-up. at the moment the pop up dialog allows the user to put in any date and the error message only kicked in once the user has input a date. it would be much better if the date picker already doesn't allow the user to input a date outside the allowed range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants