opened
eschramm
username_0
The goal of this request is to create a specialized, extendable `ORKAnswerFormat` for medications. Original development was aimed to merge against Apple's ResearchKit, but this is not a necessity. This is an early prototype being presented for feedback. Ultimately, I'd like the medication picker that we make to work with this poll Rosetta in the cloud for RxNorm concepts. Discussing with @dkonson, it may be several months or more before this is possible. In the meantime, I've been able to make this work with an updated RxNorm SQL store with local code for converting raw RxNorm data files for periodic updates that can more easily handle a predicate such as "filter the search to only show opioids", etc. See [here](https://github.com/CareEvolution/CEVResearchKit/pull/137) for a CEV implementation.

The new `ORKMedicationAnswerFormat` takes a Bool `singleChoice` and an `ORKMedicationPicker` which it will present when the user attempts to add a medication to the list. The corresponding `ORKMedicationQuestionResult` returns an array of `ORKMedication` which has 3 pieces currently:

1. `medicationIdentifier` - a codifed representation of the medication; in our case, we will use an RxCUI via `ORKMedicationRxNormIdentifier`
2. `medicationDescription` - a human readable description of the medication
3. `detailedDescription` - detailed descriptive text that will display in the `longlabel` of the `ORKChoiceViewCell`

In order to present a clean list of the selected medication(s) to the user with a consistent look, this implementation riffs off of `ORKChoiceCellView`. If medications can be added to the list, a special cell with a title of `[Add a medication]` appears. When a medication is to be added, the `ORKMedicationPicker` (a subclass of `UITableViewController`) is pushed to the user to martial selection of a medication or cancelling the action. In this repository, a DummyMedPicker is provided in the `ORKCatalog` app to demonstrate how these pieces work together. While not ideal, a selection may be removed by tapping on it.

![rkmedpicker](https://user-images.githubusercontent.com/1008462/52498333-29f10800-2b9e-11e9-91be-54a9efcb2574.png)
Adding a Medication Answer Format for ORKQuestions
issue
created
eschramm
username_0
Have done a pretty major overhaul on this. I think I'm not really looking for something to push back to Apple's root branch at this point. The changes here attempt to utilize code from `ORKTextChoiceCellGroup` by setting up `ORKMedicationChoiceCellGroup` as a subclass. This cleans up some of the branching and minimizes code required.

Originally, I wanted to make `ORKMedicationPicker` as a protocol, but I was struggling with doing it in Objective-C (rusty). I think, however, I was able to get a decent working prototype where the picker coordinates the presentation of whatever UI is desired using a presentingViewController. This also meant some significant changes needed to be done in `CEVResearchKit` and `RKStudio-Participant` PRs based on these changes. But I feel it's a better product :)
comment
created
eschramm
username_0
Will close for now to clean up - can reopen if the need arises.
comment