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
Add navigable ordered task and step navigation rules #151
Add navigable ordered task and step navigation rules #151
Conversation
…Coding and NSCopying protocols TODO: Implement NSPredicate JSON serialization.
…sult-matching predicates.
…ds you to a step with a lower or equal index than the current one
…RKNavigableOrderedTask class)
…nd implicitly ORKPredicateStepNavigationRule and ORKDirectStepNavigationRule)
Also: fix ORKStepNavigationRule alignment.
Also moved some code around.
…tion Also: slight API refactor; add exceptions when trying to pass nil values; add removeNavigationRuleForTriggerStepIdentifier: method (with its unit test).
…ue to empty array argument check
Also: added the corresponding unit tests.
… and maximum only numeric and scale methods (With their corresponding unit tests.)
(With their corresponding unit tests.)
…r cross-task navigation logic (Including suitable unit tests.)
…chezsaez-navigationrules-dev # Conflicts: # ResearchKit/Common/ORKVerticalContainerView.m
I managed to rework how predicates are built, and they now must contain a task result identifier and a question result identifier. This supports question results with the same identifier as long as they belong to different task results. I like the code better now, because the new predicates match against the vanilla See the corresponding commit for additional commentary. With this I think I took care of all your feedback, with the exception of this:
As we discussed, But if you have better idea to try and keep things more stateless, I'm all ears. I don't yet see how a separate task state object or a task generator could make things cleaner. |
I've not been through your most recent commit in detail yet. One quick question that popped up on first viewing - do you think it would be nicer for the common case if task identifier could be nullable, and a nil task identifier could match the current task's result? |
Yeah, I initially thought so too. But the problem is that the task identifier needs to be embed into the predicate when you build it, and you don't know the current task identifier at this time (you can potentially build predicates anywhere, but you only know the current task result identifier on the One potential solution to achieve task identifier nullability would be to turn |
…eIntervalValue (instead of DBL_MAX) Also removes some unnecessary casts.
@rsanchezsaez I'd imagined using NSPredicate's See Creating Predicates, search for |
Oh, that's a good idea. I'll look into it. |
If you pass 'nil', the obtained result predicate will have a $TASK_IDENTIFIER substitution variable which will be replaced in ORKPredicateStepNavigationRule by the ongoing task identifier. Also: - Add convenience methods with no 'taskIdentifier' argument to ORKResultPredicate. - Update ORKTest sample code to use convenience methods. - Update Unit Tests to cover both convenience and regular nullable methods.
I made |
|
ok to test |
…erVariableName Also renames ORKTaskIdentifierResultPredicateVariableName to ORKResultPredicateTaskIdentifierVariableName.
3176e3b
to
622af54
Compare
…chezsaez-navigationrules # Conflicts: # ResearchKit.xcodeproj/project.pbxproj # Testing/ORKTest/ORKTest/MainViewController.m
Sorry for the botched commit. Fixed. |
A direct step navigation rule with a nil destination step identifier can be used to finish the ongoing task early. Also adds corresponding Unit Tests.
|
||
typedef NS_OPTIONS(NSUInteger, TestsTaskResultOptions) { | ||
TestsTaskResultOptionSymptomHeadache = 1 << 0, | ||
TestsTaskResultOptionSymptomDiziness = 2 << 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: two z's in Dizziness (seems to be used with one z throughout the file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed.
ok I didn't spot anything new (other than the one nitpick) so r=me |
…sed in step navigation rules when you want to end the ongoing task
Replaced |
… comment Also: add explicit test in ORKNavigableOrderedTask; make ORKResultPredicateTaskIdentifierVariableName safer by prefixing string value by ORK.
r=me |
Add navigable ordered task and step navigation rules
New feature dealing with issues #86 and #138.
See the issue pages, the header documentation, and the researchkit-dev mailing list thread (subject: 'ResearchKit: navigation rules') for implementation details.
For now, this has one follow-on issue: Implement an NSPredicate JSON serializer (#152).