This application is used to generate card key data that can be received by UC Berkeley’s Facilities. The data is populated in their “Facilities Services Electronic Access Control Card Key Request” template. The app can be run as a CLI tool.
Installation¶
Install directly from the GitHub repository:
pip install git+https://github.com/berkeley-cdss/cardgate.gitSetup¶
Obtain API credentials: You will need to obtain API credentials for the following UC Berkeley SIS services.
SIS_TERMS_ID/SIS_TERMS_KEYSIS_CLASSES_ID/SIS_CLASSES_KEYSIS_ENROLLMENTS_ID/SIS_ENROLLMENTS_KEY
Configure the application: Create a
cardgate.yamlconfiguration file:
clearances:
- Gateway Exterior Door
- Gateway Classroom
- Gateway L1 West
# Buffer days to add to term dates for activation/expiration
# Negative values mean before the date, positive means after it
date_buffer:
activation_days: -7 # 7 days before semester starts
expiration_days: 4 # 4 days after semester endsConfigure environment variables: Create a
.envfile in your working directory with these credentials:
SIS_TERMS_ID=your_terms_id
SIS_TERMS_KEY=your_terms_key
SIS_CLASSES_ID=your_classes_id
SIS_CLASSES_KEY=your_classes_key
SIS_ENROLLMENTS_ID=your_enrollments_id
SIS_ENROLLMENTS_KEY=your_enrollments_keyQuick Start¶
Generate card key requests for all Statistics Department courses in the Gateway building for Fall 2026:
cardgate courses \
--unit STAT --building Gateway \
--year 2026 --semester Fall \
--output stat-gateway-2026-fall.csvTo only include evening sections (starting at 6:00 PM or later):
cardgate courses \
--unit STAT --building Gateway \
--year 2026 --semester Fall \
--from-time 18:00 \
--output stat-evening-2026-fall.csvCSV Output¶
The CSV output is formatted to match the “Facilities Services Electronic Access Control Card Key Request” template. The columns are:
| Column | Description |
|---|---|
| Date Submitted | Left blank for the requestor to fill in |
| Last Name | Person’s last name |
| First Name | Person’s first name |
| MI | Middle initial (if available) |
| Department | Academic unit passed via --unit |
| SID/EID Number | Student ID or Employee ID |
| Prox Number | Left blank (populated by Card Key API in Phase 2) |
| Type of Card | “CalID” |
| Action | “Add Clearance” |
| Clearance Name | Location from cardgate.yaml |
| Activation Date | Term begin date + buffer |
| Expiration Date | Term end date + buffer |
The remaining clearance columns are repeated for each location defined in clearances.