CitizenHealth / COVIDx

Using wearables to predict & prevent COVID-19
https://trello.com/b/iaHAdHFK/covidx
MIT License
10 stars 8 forks source link

Survey Submission API #30

Open Murkantilism opened 4 years ago

Murkantilism commented 4 years ago

Create a Node JS webservice to accept Tripetto submissions and write results to database.

Here is sample of the JSON output from Tripetto:

Object
fields: Array(33)
0: {name: "How are you feeling today?", type: "tripetto-block-multiple-choice", version: "1.0.2", slot: "choice", …}
1: {name: "Fever", type: "tripetto-block-multiple-choice", version: "1.0.2", slot: "fca2fe706fe806e2d6da76aa3b11db94f1b48c7b88483f1559c9da0541962ad5", …}
2: {name: "Chills", type: "tripetto-block-multiple-choice", version: "1.0.2", slot: "605bd01e6e45d13d24c62ede47dea75fe288cbca8a9e590b34bc7b31744b6541", …}
3: {name: "Fatigue", type: "tripetto-block-multiple-choice", version: "1.0.2", slot: "b18f61e6f5c7fd6b45723780f3c5a542ec23ccc5bb70e792fb543016d69c619a", …}

Acceptance Criteria

vchu22 commented 4 years ago

@Murkantilism Do we want to create a separate repo for the API?

Murkantilism commented 4 years ago

@vchu22 I see no reason to, there's already a separate repo for the server-side (here). Putting webservices into a separate repo just further fractures the overall codebase, plus the end state won't be large enough to warrant using a submodule repo.

vchu22 commented 4 years ago

@Murkantilism Since the server-side code is written in Flask but we want the webservice to be written in Node.js, do we want to write Python code that automatically start the Node.js server when we start the Flask server?

And I saw the Flask code already has an API route named /create_survey_response. How is our Node webservices going to do differently from the /create_survey_response route?

Murkantilism commented 4 years ago

@vchu22 to your first question - no I don't think we need to autostart the Node server

To the 2nd question - going with your example, something in this codebase needs to POST survey data to the /create_survey_response server route. A nodejs webservice is a good choice for doing that, rather than doing it directly on frontend.