...
Sr. No. | Object Type | Object Name | Added Columns | Comments |
1 | DB View | VSO_PatientVisit | EHRComplete | |
2 | DB View | VSO_EncObs | BHWFormType MidwifeFormType | |
3 | SQLlab Query | VSO_Visitswithoutforms | Query - select g.visit_id, sum(case g.concept_id | |
4 | SQLlab Query | VSO_Patient_Visit_Experience | Query - select concat(Year,"/",Month) as YearMon, |
Connecting to Google Sheets as Database
Superset has a feature to connect to Google Sheets as a database. There are certain setups that are necessary to be done in order to make this feature available.
Step1:
To implement Google authentication, create a service account as follows:
Login to Google Console Admin using your intelehealth email id (https://console.cloud.google.com/iam-admin/serviceaccounts)
Ensure you select “Enable G-suite domain wide delegation” checkbox
Download the key created by google for your service account as json file
Manage API client access at https://admin.google.com/${DOMAIN}/AdminHome?chromeless=1#OGX:ManageOauthClients
Add the "Unique ID" from step 1 as the "Client Name"
Add the scope as “
https://www.googleapis.com/auth/spreadsheets.readonly”
Connect to superset server 13.233.116.180 (user: ubuntu)
Run following commands in the sequence mentioned below:
cd superset/my_viz
. bin/activate
pip install gsheetsdb
pip install gsheetsdb[cli]
pip install gsheetsdb[sqlalchemy]
Go to path /home/ubuntu/superset/my_viz/lib/python3.6/site-packages/gsheetsdb
Access file auth.py under this folder
Add the following lines at the start of function “get_credentials_from_auth”:
if not subject:
subject='priya@intelehealth.io'if not service_account_file:
service_account_file='/home/ubuntu/superset/my_viz/intelehealthsuperset-4001d197be72.json/intelehealthsuperset-4001d197be72.json'
stop the superset python process running on the server & restart the same
Connect to Superset application in browser as admin using https://dashboards.intelehealth.io
Go to menu Sources → Databases
Add a new database with below details:
Database Name: Google_Sheets
SQLAlchemy URI : gsheets://
Click the button “Test Connections”
Once the connection is established successfully, save the new database by hitting the save button
Now you can create a table based on google sheets as follows:
Access the menu Sources → Tables
Create a new table where database is “Google_Sheets” and Table Name is the shareable link of the concerned google sheet.