Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Integrate Google Sheet as an alternative input source #70

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/data-rookery-309413-5578c70a0a89.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "data-rookery-309413",
"private_key_id": "5578c70a0a89c52d560b1440cb8716b73b5fbc4e",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCkFUQB130xZQ8V\nEQ2XrUny1jry6lcix+0EalPkkAMj9Ltvg3CFy8dxr2sYX3S3n+EROg6yd/ZDfHm8\nlfAb2vyjHfI73ahqVFsAueTTFHAxqK2CQr8YgotOecTDTS6VRwiASHNZQiuTMn2t\nlWvZz+WTaxof7SthlUTCdojaW45Uo9JQCHjVjnDlNI8JD3JwwIZacOdpNkAUuQr8\nA6QC5mt5G3F5lxz7Qfu7DMEEl6uUIJFczuRHOXcT8yr8GT3rp7S4Ool9+p8VxiSU\nnbbfo5b86nEi9zKes7j6dHgPrH9gHff+RIJB5x4ZcwBjO7wreeFByhxlyugNn2Pw\ngtlYMt1NAgMBAAECggEAJlih8BxAMc8AW1gE6TGiWpIebK6/dm1qwuFmgb/2O+zx\n8PmyzlH1ZmgsiyGj0VYX70K2NJc8gkEQ4jXYS2o+KJDTD5KZzV+xdNX82CeqoLBe\n/FZE+qFnlQt4JHxhKpnTLse/zVhdfqUKIgsNjXW8nVsmW9e9j6ymyRuSmBVVignv\nIU4pu2FJNqU9jC3nu8VAIfkNXfS2eeRt3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client_id": "104706978080795181705",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gatorminersheet%40data-rookery-309413.iam.gserviceaccount.com"
}
32 changes: 32 additions & 0 deletions src/integratesheet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from __future__ import print_function
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
import json

SCOPE = ['https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive',
'https://spreadsheets.google.com/feeds']
SECRETS_FILE = 'data-rookery-309413-5578c70a0a89.json'
SPREADSHEET = 'Ethical Benefits and Implications (Responses)'

json_key = json.load(open(SECRETS_FILE))
# Authenticate using the signed key
credentials = ServiceAccountCredentials(json_key['client_email'], json_key['private_key'], SCOPE)

#print(type(json_key['private_key']))
gc = gspread.authorize(credentials)
workbook = gc.open(SPREADSHEET)
# Get the first sheet
sheet = workbook.sheet1
data = pd.DataFrame(sheet.get_all_records())

column_names = {'Timestamp': 'timestamp',
'What future technology is featured in your synopsis?': 'future-tech',
'What are the potential social implications and/or ethical issues and/or regulatory challenges with this technology?': 'ethical-issues',
'What do you think might be a cautionary tale related to this technology?': 'cautionary'
}

data.rename(columns=column_names, inplace=True)
data.timestamp = pd.to_datetime(data.timestamp)
print(data.head())
12 changes: 12 additions & 0 deletions src/pbppython-9c80d2999710.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "pbppython",
"private_key_id": "9c80d29997100e0c0b7d67e092c79e97d21fc66c",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCIjkScedniZi9p\nFu5KCVXtoLQQ+2se5mDKAbrTOn3D5JcybSUJQQA0y3wGx9GM81zM2ZLfhm+5KX9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OdU3RlcCJlhQZwe1R42rjFg2i/xvBKtWo0g+p\n24+Tj9SkW26+2tr+6If93jGH4FTNaRPJFvGNRSLS8364/fRrz4iYNlpzgQKBgA0W\narsH44BhWPnA05ohObMQUerEjU+ISFC/8+waL5vYhGcs3TLejGVvKiVBarTAACxN\n/trRa8WQ6YJh5utSzn+ho1c1KASAsG64ddyGjbW8jOvQwPM9b2tQQ0AmbF0TgKbf\nLNuNhBwIPZRwwGHMw5eIcTSBlvlNHVUwZo8WiQrbAoGBAL1jR9Bd8+1WLA+fmbYN\n0xWqLbfZBp8V5v/vW5t9ifIQRD+6acD3qjqbymo2E+djgLoTmnjRoZLkD8iftqbe\nx2ovFdnhyPdcdCgcVoPJBjtTxP6qhV3ZmbETZN5ZjJq2DtJwQ5TW+ey9yBLBChs8\nDGbEa6Q+5yzLR/sPDuZg+LRD\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "111476297928215914603",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/deversz3770%40pbppython.iam.gserviceaccount.com"
}