NTX-McGill / NeuroTechX-McGill-2021

Other
16 stars 5 forks source link

Software (Backend): Route to stop collecting for a given character. #89

Closed mlej8 closed 2 years ago

mlej8 commented 2 years ago

@TheFloatingString already started it in his branch for this task, checkout to his branch and rebase main

This route is called by the front end when it highlights a character for the second time.

Create a POST route that receives the following information: (process_id: int)

  1. set the shared variable "collecting" to False in order to stop collecting in the BCI process.
  2. flush everything inside of bci_processes_states[process_id]["queue"] to the database. See NeuroTechX-McGill-2021/software/data_collection_platform/backend/dcp/tasks.py for reference on how to write to the database.

Tagging @HassanKanj16 @TheMatrixMaster to keep frontend in the loop on progress for backend routes

wykzhang commented 2 years ago

Any reason why this route is a post?

mlej8 commented 2 years ago

Reasoning behind this is GET requests shouldn't modify the state of the backend. However, this route does modify the state of the backend, hence we can either go with POST or PUT.

image

Regarding POST vs PUT, I think both would work but maybe PUT might be better suited as we are modifying the state of something in the backend here.

wykzhang commented 2 years ago

Just making sure, we don't need to retain the order of the BCI data? (I saw that we were keeping track of order last year) @mlej8

mlej8 commented 2 years ago

Actually, we do want the order of the data points, good catch! For each batch of points, we want to label each point with their order in the queue, so we also need to update the schema for CollectedData. We know that we get the points in order from PyLSL since it is using TCP and that guarantees we've gotten the data in order.