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

Printing support #672

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open

Printing support #672

wants to merge 49 commits into from

Conversation

oliverschaefer
Copy link
Contributor

This PR adds basic printing support to ResearchKit (#479). To try the functionality run the ORKTest app and hit Learn more on a step of your choice.

@oliverschaefer
Copy link
Contributor Author

@umerkhan-apple @YuanZhu-apple I've pushed some major updates to this PR which now makes the printing functionality working for question steps and form steps (including images). I've also added the possibility of attaching HTML headers and footers to the printed page. One common use case would be the inclusion of an institutional logo. Before I proceed please let me know, what you think about the general design.

Oliver Schäfer and others added 2 commits May 12, 2016 21:14
@oliverschaefer
Copy link
Contributor Author

@umerkhan-apple @YuanZhu-apple any news?

@md0u80c9
Copy link
Member

@oliverschaefer @YuanZhu-apple @umerkhan-apple

Been watching some of WWDC this week. Really excited about a feature that didn't make either the Keynote of the Platforms speeches - HLA CDA support in HealthKit - and that has led me to rethink Printing support in ResearchKit.

Instead of implementing printing support, we could achieve a closely related thing and implement HLA CDAv2 export to HealthKit.

This would achieve two goals - firstly it would be a major feature for ResearchKit; it would tightly integrate ResearchKit and HealthKit; it would enable data sharing between ResearchKit and any integration solutions implemented to HealthKit in the future; and it will give us printing support for free.

Some of the Printing implementation started here is similar - to create a structured XML document.

Some of them are problems we need to think about slightly differently. As an example, for Boolean survey fields, we could add support to return a SNOMED code, or omit a SNOMED code or use a different SNOMED code for the opposite response (embedding the SNOMED codes into the results objects reduces the post-processing). Allowing survey tasks to return whole XML blocks to reduce post-processing of results would be another step towards this.

And printing support would then be free and consistent.

@oliverschaefer
Copy link
Contributor Author

@md0u80c9 Hi Andrew, thanks for your input. This is a great idea, which in my opinion deserves a PR of its own

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple friendly ping :-)

@md0u80c9
Copy link
Member

Thanks oliver: I have been thinking about the implementation for it. I've got a fair idea how to do it tidily enough in Swift through use of some of its protocol features; I must confess in Obj C it feels trickier. I will write up my thoughts so far as a PR shortly.

The proposals I've got so far go between ResearchKit and CareKit; I don't know how @YuanZhu-apple and @umerkhan-apple feel regarding how 'hard' or 'soft' the division is between the two projects; to me they naturally should be sharing a lot of code.

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple TODOs done. Added a Toggle Learn More button to ORKTest.

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple ORKHTMLPrintFormatter is a subclass of UIMarkupTextPrintFormatter. Once you call setSteps: WithResult: on the formatter, it will generate the markup and store it in it's inheritedmarkupText property. From there you could pass the HTML to ORKHTMLPDFWriter. Should we expose ORKHTMLPDFWriter?

@YuanZhu-apple
Copy link
Member

@oliverschaefer Thanks!
Maybe you can separate html generation out of ORKHTMLPrintFormatter.

self.perPageContentInsets = UIEdgeInsetsMake(POINTS_PER_INCH * 0.5f, POINTS_PER_INCH * 0.5f, POINTS_PER_INCH * 0.5f, POINTS_PER_INCH * 0.5f);

Because this is the only piece of code I found relevant to UIPrintFormatter.
For everything else I don't think need to be in the subclass.

Propose a new flow:

  1. New HTML writer ( accepts template and steps, delegate, generates html)
  2. ORKHTMLPrintFormatter ( accepts html )
  3. Give ORKHTMLPrintFormatter to UIPrintPageRenderer

I am OK to expose ORKHTMLPDFWriter.

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple Let's name it ORKHTMLWriter and rename ORKHTMLPDFWriter to ORKPDFWriter to keep it consistent?

I'll do the changes over the weekend and let you know.

@YuanZhu-apple
Copy link
Member

Sounds good!

On Fri, Aug 19, 2016 at 3:13 PM, Oliver Schäfer notifications@github.com
wrote:

@YuanZhu-apple https://github.com/YuanZhu-apple Let's name it
ORKHTMLWriter and rename ORKHTMLPDFWriter to ORKPDFWriter to keep it
consistent?

I'll do the changes over the weekend and let you know.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#672 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AK730Cg1u7gSAS9ClLxftkr5AWnS6qpaks5qhip7gaJpZM4IWUx1
.

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple Changes done.

@YuanZhu-apple
Copy link
Member

@oliverschaefer Thanks for the update!
So far, I have seen the test to print single step, but do you think you can create a test to print all steps from a completed task?

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple This was easy buddy. I've added a button to the review step section, that lets you print out all the step results of a completed embedded review task. Happy testing :-)

@oliverschaefer
Copy link
Contributor Author

@YuanZhu-apple friendly ping

@umerkhan-apple
Copy link
Member

Merge conflicts need to be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants