czbiohub-sf / Rapid-QC-MS

Realtime quality control for mass spectrometry data acquisition
https://czbiohub-sf.github.io/Rapid-QC-MS
Other
13 stars 2 forks source link

Sync SQL database with Google Drive #26

Closed wasimsandhu closed 2 years ago

wasimsandhu commented 2 years ago

Currently, MS-AutoQC is configured to read our Google Drive folders. This needs to be changed so that any user can authenticate and have the SQL database (and relevant .csv files) stored in their Drive.

Relevant PyDrive2 documentation

Relevant Google Drive API documentation

Helpful StackOverflow threads

wasimsandhu commented 2 years ago

Handling user opt-in for Google Drive sync. The current plan for the workflow is as follows:

  1. A folder is created in their Google Drive storage
  2. The folder link is saved in the instruments table
  3. A user is created in the gdrive_users table
  4. Database is written to the folder on every run completion, settings change, and etc.
wasimsandhu commented 2 years ago

Need to fix user sign-in to workspace. Relevant documentation: https://developers.google.com/drive/api/guides/search-files

wasimsandhu commented 2 years ago

Fixed database search in Google Drive on user sign-in to workspace: https://github.com/czbiohub/MS-AutoQC/commit/95b57de5ae09f6cbfdf361710d427c15a607617f

wasimsandhu commented 2 years ago

Overlooked one aspect of Google Drive sync: if the user opts to complete first-time setup without enabling cloud sync, but then later decides they want to opt in from Settings > General, this needs to be handled appropriately.

If user opts in to cloud sync from Settings > General, a workspace associated with their Google account either exists or does not exist.

  1. If a workspace exists, inform the user that workspaces cannot be merged and they must login with a different account.
  2. If a workspace does not exist, proceed with cloud sync setup as usual.