-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
121 lines (81 loc) · 4.25 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
output: github_document
---
<div align="center">
<p align="center">
<img src="inst/app/www/cRew_iphone.png" align=center>
</p>
<p align="center">
## Watch a DEMO on youTube
[![cRew DEMO](https://img.youtube.com/vi/Fobss1YFRFI/0.jpg)](https://www.youtube.com/watch?v=Fobss1YFRFI)
</p>
</div align="center">
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
## Join the cRew
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
**c**o**R**anavirus **e**arly-**w**arning (**cRew**) App tracks Covid-19 / flu like disease symptoms in real-time. The goal of cRew is to map in real-time healthy and symptomatic people. As users enter data about their health status, the app monitors temporal and spatial changes and estimates sudden increases or decreases on local risks. **Experimental use only.**
User input parameters are based on health (fever, coughing, breathing problems), behavioral (such as going outside, staying home and wearing mask) and location based.
The app is built with [shinyMobile](https://rinterface.github.io/shinyMobile/) & [firebase](https://firebase.john-coene.com/),
[echarts4r](https://echarts4r.john-coene.com/) and [fireData]( https://github.com/Kohze/fireData)
## About
The app uses Google firebase authentication. This ensures that only authenticated users are able to interact with the app. Firebase authentication and User specific data access is established through the [firebase R package](https://firebase.john-coene.com/) from John Coene and setting up firebase Database rules [(More information)](https://firebase.google.com/docs/database/security/quickstart?authuser=0).
Features:
* User data are saved to Google **Firebase real-time database.**
* as collections **in user-specific folders.** This is achieved through the use of variables created during the authentication.
Two variables are used:
* **uid**: The user ID, unique to the Firebase project. Generated during authentication. This is used to create a **user specific directory** in firebase database.
access uid in Shiny/firebase app by **f\$signed_in$response\$uid**
* **token**: The Token generated during user authentication
access the token in Shiny/firebase app by **f\$signed_in\$response\$stsTokenManager\$accessToken**
Example:
``` r
fireData::upload(x = user_inputs,
projectURL = databaseURL,
directory = paste0("fire/",uid()), # Combine your target directory with uid
token=token()) # Add token information
```
The second part requires to correctly setup google firebase rules. [More information](https://firebase.google.com/docs/database/security/quickstart?authuser=0).
For example following rules allow only authenticated users to can read data and only save data under their user-specific folder in the database.
``` r
# Example rules to specify that user data can be saved only at a user specific node
# in the database (here 'fire/uid' directory).
{
"rules": {
".read": "auth.uid != null",
".write": false,
"fire":{
"$uid": {
".write": "auth.uid === $uid"
}
}
}
}
```
* Users can access their past inputs from the My history tab.
* Server methods allows only authenticated users to see the plots (e.g. f$req_sign_in() needs to be TRUE)
## cRew App
You can access the app here >> [cRew symptom Tracker](http://tools.dataatomic.com/shiny/cRew)
The app is for experimental purposes and the disease risk estimation via the app are calculated by the users who enter values thus can be biased.
``` r
# install.packages("remotes")
remotes::install_github("korur/cRew")
```
## Set up and run
The code for the app is available as an R package cRew. You can deploy and connect to your own database and run it with your modifications and track other symptoms/diseases.
``` r
# Setting up with your firebase database
firebase::create_config(api_key = "yourfirebase apiKey, project_id = "your firebase projectId")
databaseURL <- "your firebase databaseURL"
# Run the app
cRew::run_app()
```