ResearchKit / SageResearch

BSD 3-Clause "New" or "Revised" License
21 stars 20 forks source link

Add picker data source for Month/Year input fields. #43

Open syoung-smallwisdom opened 6 years ago

syoung-smallwisdom commented 6 years ago

Implement a picker data source that is appropriate to displaying Month/Year selection and converting that selection to a Date answer value.

I recommend implementing a picker that implements the RSDMultipleComponentPickerDataSource protocol. RSDUSMeasurementPickerDataSource has an example implementation for using a picker to select height and weight in US customary units. This would then need to be returned by func dataSource() -> (RSDPickerDataSource?, Formatter) which is defined in an extension of RSDDateRange.

Erin-Mounts commented 6 years ago

Just a thought, would it make any sense to allow, say, form steps (or table item groups) to be presented with a multiple component picker, or in other words to have say a Month/Year picker that fills in two values on a form for Month and Year separately, or a blood pressure picker that fills in Systolic and Diastolic form items? This wouldn't make sense for heights and weights, which are inherently single measurements that sometimes are presented as multiple values in large and small units, but maybe for cases like these where we really want to capture them as two separate-but-related values?

syoung-smallwisdom commented 6 years ago

@Erin-Mounts Yes, that's what the refactor last month was for. You can set up a RSDTableItemGroup with multiple RSDTableItem fields and then compose an answer from them. This is how multiple choice selection is already handled.

syoung-smallwisdom commented 6 years ago

We did not pursue this issue in large part b/c we didn't have a use-case for it that Bridge services supported. ie: We cannot report Date as Month/Year only so these either (a) have to be separate fields (b) record as a string or (c) Record with 1st day of the month.