Skip to content

Commit c206375

Browse files
committed
Merge from develop again
2 parents 52cb83d + 713a855 commit c206375

File tree

17 files changed

+631
-22
lines changed

17 files changed

+631
-22
lines changed

.env.template

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ LOGIN_ASTRA_USERNAME=
55
LOGIN_ASTRA_PASSWORD=
66
#Login to https://east.mymazevo.com/main-home then go to https://east.mymazevo.com/api/tenantsettings/GetApiKey
77
MAZEVO_API_KEY=
8+
#Academic Calendars
9+
GOOGLE_GENAI_USE_VERTEXAI=
10+
GOOGLE_CLOUD_PROJECT=
11+
GOOGLE_APPLICATION_CREDENTIALS=
12+
GEMINI_SERVICE_ACCOUNT=
13+
NEBULA_API_URL=
14+
NEBULA_API_STORAGE_BUCKET=
15+
NEBULA_API_KEY=
16+
NEBULA_API_STORAGE_KEY=
817

918
# Uploader
1019
MONGODB_URI=

.github/workflows/deploy.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ jobs:
5555
job: 'daily-prod'
5656
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/runner'
5757
region: us-central1
58+
59+
- name: Upload to weekly dev job
60+
uses: google-github-actions/deploy-cloudrun@v2
61+
with:
62+
job: 'weekly-dev'
63+
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/runner'
64+
region: us-central1
65+
66+
- name: Upload to weekly prod job
67+
uses: google-github-actions/deploy-cloudrun@v2
68+
with:
69+
job: 'weekly-prod'
70+
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/runner'
71+
region: us-central1
5872

5973
- name: Upload to monthly dev job
6074
uses: google-github-actions/deploy-cloudrun@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ yarn-error.log*
3030
*.env.development.local
3131
*.env.test.local
3232
*.env
33+
*service-account.json
3334

3435
# vercel
3536
.vercel

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ RUN apt-get update && apt-get install -y chromium
2323
ENV CHROMIUM_BIN=/usr/bin/chromium
2424
ENV GOOGLE_CHROME_BIN=/usr/bin/chromium
2525

26+
# Install poppler-utils for pdftotext for academic calendar parsing
27+
RUN apt-get install -y poppler-utils
28+
2629
# Copy build file from builder
2730
COPY --from=builder /app/api-tools /app/api-tools
2831

@@ -32,5 +35,5 @@ RUN chmod +x /app/runners/setup.sh
3235
ENTRYPOINT ["/app/runners/setup.sh"]
3336

3437
# Optional .env copy for development
35-
FROM base AS dev
38+
FROM base AS local
3639
COPY .env /app/.env

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ Docker is used for automated running on Google Cloud Platform. More info [here](
9898

9999
To build the container for local testing first make sure all scripts in the `runners` folder have LF line endings then run:
100100
```
101-
docker build --target dev -t my-runner:local .
102-
docker run --rm -e ENVIRONMENT=dev -e RUNNER_SCRIPT_NAME=daily.sh my-runner:local
101+
docker build --target local -t my-runner:local .
102+
docker run --rm -e ENVIRONMENT=local -e RUNNER_SCRIPT_NAME=daily.sh my-runner:local
103103
```
104104

105105
## Questions?

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/valyala/fastjson v1.6.4
1313
go.mongodb.org/mongo-driver v1.17.3
1414
golang.org/x/net v0.43.0
15+
google.golang.org/genai v1.32.0
1516
)
1617

1718
require (
@@ -54,6 +55,7 @@ require (
5455
github.com/google/uuid v1.6.0 // indirect
5556
github.com/googleapis/enterprise-certificate-proxy v0.3.5 // indirect
5657
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
58+
github.com/gorilla/websocket v1.5.3 // indirect
5759
github.com/josharian/intern v1.0.0 // indirect
5860
github.com/json-iterator/go v1.1.12 // indirect
5961
github.com/klauspost/compress v1.17.8 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.5 h1:VgzTY2jogw3xt39CusE
109109
github.com/googleapis/enterprise-certificate-proxy v0.3.5/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
110110
github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=
111111
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
112+
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
113+
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
112114
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
113115
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
114116
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@@ -243,6 +245,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
243245
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
244246
google.golang.org/api v0.224.0 h1:Ir4UPtDsNiwIOHdExr3fAj4xZ42QjK7uQte3lORLJwU=
245247
google.golang.org/api v0.224.0/go.mod h1:3V39my2xAGkodXy0vEqcEtkqgw2GtrFL5WuBZlCTCOQ=
248+
google.golang.org/genai v1.32.0 h1:kku/m3kWOncjnw8EIa2sgmrPLhaxFHaP+uqOq5ZckvI=
249+
google.golang.org/genai v1.32.0/go.mod h1:7pAilaICJlQBonjKKJNhftDFv3SREhZcTe9F6nRcjbg=
246250
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb h1:ITgPrl429bc6+2ZraNSzMDk3I95nmQln2fuPstKwFDE=
247251
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:sAo5UzpjUwgFBCzupwhcLcxHVDK7vG5IqI30YnwX2eE=
248252
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=

main.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ func main() {
3939
// Flag for soc scraping
4040
scrapeOrganizations := flag.Bool("organizations", false, "Alongside -scrape, signifies that SOC organizations should be scraped.")
4141
// Flag for calendar scraping and parsing
42-
calendar := flag.Bool("calendar", false, "Alongside -scrape or -parse, signifies that calendar should be scraped.")
42+
cometCalendar := flag.Bool("cometCalendar", false, "Alongside -scrape or -parse, signifies that the Comet Calendar should be scraped/parsed.")
4343
// Flag for astra scraping and parsing
4444
astra := flag.Bool("astra", false, "Alongside -scrape or -parse, signifies that Astra should be scraped/parsed.")
4545
// Flag for mazevo scraping and parsing
4646
mazevo := flag.Bool("mazevo", false, "Alongside -scrape or -parse, signifies that Mazevo should be scraped/parsed.")
4747
// Flag for map scraping, parsing, and uploading
4848
mapFlag := flag.Bool("map", false, "Alongside -scrape, -parse, or -upload, signifies that the UTD map should be scraped/parsed/uploaded.")
49+
// Flag for academic calendar scraping
50+
academicCalendars := flag.Bool("academicCalendars", false, "Alongside -scrape, -parse, or -upload, signifies that the academic calendars should be scraped/parsed/uploaded.")
4951

5052
// Flags for parsing
5153
parse := flag.Bool("parse", false, "Puts the tool into parsing mode.")
@@ -56,7 +58,7 @@ func main() {
5658
upload := flag.Bool("upload", false, "Puts the tool into upload mode.")
5759
replace := flag.Bool("replace", false, "Alongside -upload, specifies that uploaded data should replace existing data rather than being merged.")
5860
staticOnly := flag.Bool("static", false, "Alongside -upload, specifies that we should only build and upload the static aggregations.")
59-
events := flag.Bool("events", false, "Alongside -upload, signifies that Astra and Mazevo should be uploaded.")
61+
events := flag.Bool("events", false, "Alongside -upload, signifies that Astra, Mazevo, and the Comet Calendar should be uploaded.")
6062

6163
// Flags for logging
6264
verbose := flag.Bool("verbose", false, "Enables verbose logging, good for debugging purposes.")
@@ -106,27 +108,31 @@ func main() {
106108
scrapers.ScrapeCoursebook(*term, *startPrefix, *outDir, *resume)
107109
case *scrapeOrganizations:
108110
scrapers.ScrapeOrganizations(*outDir)
109-
case *calendar:
110-
scrapers.ScrapeCalendar(*outDir)
111+
case *cometCalendar:
112+
scrapers.ScrapeCometCalendar(*outDir)
111113
case *astra:
112114
scrapers.ScrapeAstra(*outDir)
113115
case *mazevo:
114116
scrapers.ScrapeMazevo(*outDir)
115117
case *mapFlag:
116118
scrapers.ScrapeMapLocations(*outDir)
119+
case *academicCalendars:
120+
scrapers.ScrapeAcademicCalendars(*outDir)
117121
default:
118122
log.Panic("You must specify which type of scraping you would like to perform with one of the scraping flags!")
119123
}
120124
case *parse:
121125
switch {
122-
case *calendar:
123-
parser.ParseCalendar(*inDir, *outDir)
126+
case *cometCalendar:
127+
parser.ParseCometCalendar(*inDir, *outDir)
124128
case *astra:
125129
parser.ParseAstra(*inDir, *outDir)
126130
case *mazevo:
127131
parser.ParseMazevo(*inDir, *outDir)
128132
case *mapFlag:
129133
parser.ParseMapLocations(*inDir, *outDir)
134+
case *academicCalendars:
135+
parser.ParseAcademicCalendars(*inDir, *outDir)
130136
default:
131137
parser.Parse(*inDir, *outDir, *csvDir, *skipValidation)
132138
}
@@ -136,6 +142,8 @@ func main() {
136142
uploader.UploadEvents(*inDir)
137143
case *mapFlag:
138144
uploader.UploadMapLocations(*inDir)
145+
case *academicCalendars:
146+
uploader.UploadAcademicCalendars(*inDir)
139147
default:
140148
uploader.Upload(*inDir, *replace, *staticOnly)
141149
}

0 commit comments

Comments
 (0)