Skip to content

Survey Submission API #30

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

Open
Murkantilism opened this issue Jun 8, 2020 · 4 comments
Open

Survey Submission API #30

Murkantilism opened this issue Jun 8, 2020 · 4 comments
Labels
Backend enhancement New feature or request good first issue Good for newcomers

Comments

@Murkantilism
Copy link
Contributor

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

  • A new webserivce resource that can be passed Tripetto output from the frontend and writes it to database, parsing or normalizing it first (if needed)
@Murkantilism Murkantilism added Backend enhancement New feature or request good first issue Good for newcomers labels Jun 8, 2020
@vchu22
Copy link
Member

vchu22 commented Jun 9, 2020

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

@Murkantilism
Copy link
Contributor Author

@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
Copy link
Member

vchu22 commented Jun 9, 2020

@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
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants