Skip to content

Commit

Permalink
Example using Smartsheet Python SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
curt-mitch-census committed Aug 23, 2024
1 parent 6a139d3 commit 0d5a028
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 0 deletions.
126 changes: 126 additions & 0 deletions _data/test_smartsheet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
- Name: 'Responsible AI: Model Cards'
Status: Inactive
Description: Working with the GSA AI COE to develop guidance for creating model
cards.
Participants: Willow Hagen
xD's Role: Participant
Meeting Frequency: null
Start Date: '2021-10-01'
End Date: null
Contacts: null
- Name: 'Transformation: Data Management & Technology Track'
Status: Active
Description: To identify opportunities to improve how Census manages data an deploys
technology.
Participants: Luke Keller
xD's Role: Lead
Meeting Frequency: Bi-weekly
Start Date: '2021-09-01'
End Date: null
Contacts: null
- Name: 'Transformation: Data Futures Studio'
Status: Active
Description: "Creating a new way/model for successful \ninvesting in innovation\
\ at the Bureau"
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Lead
Meeting Frequency: Monthly
Start Date: '2021-09-01'
End Date: null
Contacts: null
- Name: COIL Collaboratory
Status: Inactive
Description: Sharing success stories of how to navigate red tape at Census.
Participants: Luke Keller
xD's Role: Participant
Meeting Frequency: One-time Event
Start Date: '2021-09-30'
End Date: '2021-09-30'
Contacts: null
- Name: NITRD Privacy FTAC Co-Chair Meeting
Status: Active
Description: Setting all of gov strategy for Privacy-Enhancing Technologies. Draft
due to OSTP/WH by Oct 1 2022
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Co-Chair
Meeting Frequency: Weekly
Start Date: '2022-01-06'
End Date: null
Contacts: James Joshi,Naomi Levkovitz,Tess DeBlanc-Knowles
- Name: NITRD Privacy FTAC Full Meeting
Status: Active
Description: Setting all of gov strategy for Privacy-Enhancing Technologies. Draft
due to OSTP/WH by Oct 1 2022
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Co-Chair
Meeting Frequency: Bi-weekly
Start Date: '2022-01-06'
End Date: null
Contacts: James Joshi,Josh Baron,Simson Garfinkel
- Name: Data Equity Executive Order Working Group
Status: Active
Description: A group supporting the implementation of the Data Equity EO from the
Biden administration.
Participants: Kate McCall-Kiley
xD's Role: Participant
Meeting Frequency: null
Start Date: '2021-06-01'
End Date: null
Contacts: null
- Name: AI Steering Committee - AI CoP
Status: Active
Description: A group of 6 advisors for the AI CoP at GSA https://digital.gov/communities/artificial-intelligence/
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Advisory
Meeting Frequency: Monthly
Start Date: null
End Date: null
Contacts: null
- Name: AI Working Group (TTC)
Status: Active
Description: AI subgoup of the EU-US Trade and Tech Council (https://ec.europa.eu/commission/presscorner/detail/en/STATEMENT_21_4951)
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Participant
Meeting Frequency: Quarterly
Start Date: null
End Date: null
Contacts: Teddy Collins
- Name: UN PET Lab
Status: Active
Description: Discussing the UN PETs Pilot project(s).
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Participant
Meeting Frequency: Weekly
Start Date: null
End Date: null
Contacts: null
- Name: Chief Data Officer Council
Status: Active
Description: Mostly Data Sharing Working Group that would like to use our work as
a pilot
Participants: Kate McCall-Kiley, Luke Keller
xD's Role: Participant
Meeting Frequency: Monthly
Start Date: null
End Date: null
Contacts: null
- Name: 'NITRD Privacy FTAC: Adoption Subgroup'
Status: Active
Description: Conducting industry research and reporting findings on how best to
promote adoption of PETs nationally.
Participants: Luke Keller
xD's Role: Lead
Meeting Frequency: Weekly
Start Date: '2022-04-05'
End Date: null
Contacts: null
- Name: Data Visualization Standards Working Group
Status: Inactive
Description: Developing a set of data visualization standards across the Census
Bureau.
Participants: Luke Keller
xD's Role: Lead
Meeting Frequency: Monthly
Start Date: '2017-03-01'
End Date: '2017-10-01'
Contacts: null
35 changes: 35 additions & 0 deletions smartsheet_cms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import yaml
from dotenv import load_dotenv
import smartsheet

load_dotenv() # load env variables to get Smartsheet token
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, '_data/test_smartsheet.yaml')
# access gov instance at https://api.smartsheetgov.com/2.0/
api_base = smartsheet.__gov_base__
smart = smartsheet.Smartsheet( # Create a Smartsheet client
access_token=os.environ.get('SMARTSHEET_ACCESS_TOKEN'),
api_base=api_base
)

response = (
smart.Sheets.list_sheets()
) # Call the list_sheets() function and store the response object
sheetId = response.data[27].id # Get the ID of the 10x working groups sheet in the response
sheet = smart.Sheets.get_sheet(sheetId) # Load the sheet by using its ID
rows = [sheet.get_row(row.id) for row in sheet.rows]
cells = [row.cells for row in rows]
data = []
# create list of data points where each entry is the row of the working groups sheet with column
# title as the key and cell text as the value, i.e. 'Portfolio: Responsible AI'
for cell in cells:
data_point = {}
for cell_value in cell:
column = sheet.get_column(cell_value.column_id)
data_point[column.title] = cell_value.value
data.append(data_point)

with open(filename, 'w') as outfile:
# the default_flow_style and sort_keys attrs set to False to ensure consistent data order
yaml.dump(data, outfile, default_flow_style=False, sort_keys=False)

0 comments on commit 0d5a028

Please sign in to comment.