6
6
import altair as alt
7
7
import numpy as np
8
8
import pandas as pd
9
-
9
+ import penn_chime . spreadsheet as sp
10
10
from .constants import (
11
11
CHANGE_DATE ,
12
12
DATE_FORMAT ,
@@ -355,14 +355,16 @@ def display_sidebar(st, d: Parameters) -> Parameters:
355
355
max_y_axis = max_y_axis_input ()
356
356
357
357
current_date = current_date_input ()
358
+ ####ToDo
358
359
#Subscribe implementation
359
360
st_obj .subheader ("Subscribe" )
360
361
email = st_obj .text_input (label = "Enter Email" , value = "" , key = "na_lower_1" )
361
362
name = st_obj .text_input (label = "Enter Name" , value = "" , key = "na_upper_1" )
362
363
affiliation = st_obj .text_input (label = "Enter Affiliation" , value = "" , key = "na_upper_2" )
363
364
if st_obj .button (label = "Submit" , key = "ta_submit_1" ):
364
- send_subscription_to_google_sheet (email , name , affiliation )
365
+ send_subscription_to_google_sheet (st_obj , email , name , affiliation )
365
366
367
+ #####ToDo
366
368
return Parameters (
367
369
current_hospitalized = current_hospitalized ,
368
370
hospitalized = Disposition (hospitalized_rate , hospitalized_days ),
@@ -380,9 +382,14 @@ def display_sidebar(st, d: Parameters) -> Parameters:
380
382
population = population ,
381
383
)
382
384
383
- def send_subscription_to_google_sheet (email , name , affiliation ):
385
+ #ToDo
386
+ def send_subscription_to_google_sheet (st_obj ,email , name , affiliation ):
384
387
print ("send email:" + email + " name:" + name + " affiliation:" + affiliation + " to google sheet" )
385
- #implement sending the data to googlesheet
388
+ spr = sp .spreadsheet (st_obj , 'penn_chime/client_secret.json' )
389
+ header = ["ContactEmail" ,"Name" ,"Affiliation" ]
390
+ sheet = spr .createsheet ("SheetnameToDo" , header )
391
+ row = [email ,name ,affiliation ]
392
+ spr .writeToSheet (sheet , row )
386
393
387
394
def write_definitions (st ):
388
395
st .subheader ("Guidance on Selecting Inputs" )
0 commit comments