cph-cachet / research.package

A Flutter package implementing support for surveys like ResearchStack and ResearchKit
MIT License
51 stars 43 forks source link

Downloadable surveys #85

Closed pmagnuson closed 5 months ago

pmagnuson commented 1 year ago

We are looking into adding this to an existing Flutter app.

Has any thought gone into making the surveys a downloadable resource from a server?

Thanks,

bardram commented 1 year ago

Hi @pmagnuson - thanks for your interest in RP.

As for your question, RP supports JSON serialization. All the survey classes (RPTask, RPStep, etc.) all contains the toJson and fromJson methods, making them serializable on the fly. This can be used for downloading a survey from a server.

We use this ourselves in our CARP Studies app, which is an app that can download a study configuration (incl. surveys) and show this to the user.

The app is a little complicated (and not really documented yet), since it relies heavily on the CARP Mobile Sensing Framework. But it basically downloads an RPTask object for each survey and shows it to the user.

bardram commented 1 year ago

Note also, that all the RPResult classes has a toJson() method, which allow you to upload the results back to the server (or save it on the phone).