GoCorona-org / Backend

GNU General Public License v3.0
0 stars 2 forks source link

Create well defined API for medical history questions and data #18

Closed codeJRV closed 4 years ago

theTechie commented 4 years ago

is this API ready yet?

I see the form here - http://52.66.156.232:8000/corona_app/medmap/

  1. Able to submit the form (perform POST) with all default values (most of them not provided)
    • will we support this behavior?
    • thought answers to all questions are mandatory?
  2. The response is currently an HTML page
    • can we change it to a JSON response?
  3. When will the probability/score returned to the user?
    • immediately OR async?

@sanjanamoha @Aakashv6 @codeJRV

wadkar commented 4 years ago

I can answer the immediate vs async part. Currently the django backend is not async, it will process your request and make you wait for response.

This, however, I don't think is scalable in the long run. We would like to use Django 3.0's ASGI interface and convert this interface into async. However, this has issue for the database connections because Django's ORM is not threadsafe so something like redis worker is required to manage the data processing.

Long story short - assume it's "immediate". If, and when, we change the backend to async we'll revisit this issue.

theTechie commented 4 years ago

I can answer the immediate vs async part. Currently the django backend is not async, it will process your request and make you wait for response.

This, however, I don't think is scalable in the long run. We would like to use Django 3.0's ASGI interface and convert this interface into async. However, this has issue for the database connections because Django's ORM is not threadsafe so something like redis worker is required to manage the data processing.

Long story short - assume it's "immediate". If, and when, we change the backend to async we'll revisit this issue.

Ok. thanks for the reply @wadkar What's the status on this API though? Doesn't look like its functioning as expected?

Also, i observed i am not able to do a simple POST call through a API client. Getting a CSRF verification error (403 - Forbidden). When are we going to RESTify these APIs ? these APIs are hard to consume with Django i believe?

image

sanjanamoha commented 4 years ago

The async functionality is not required for medical data but for intersection calculation. The result is found in the response of "/medmap/result/{med_uuid}" URL. The HTML format was removed and JSON format has been factored in the API

The most crucial issue of API/UI mismatch has been shifted to: https://github.com/GoCorona-org/Backend/issues/35