Skip to content

Commit a487588

Browse files
committed
Remove SIS scraper and related functionality
With the migration of the SIS scraper to its own repository, it is no longer needed in the API service. We plan to run the scraper separately from the API service, with a third database model repository to unify the schema structure used by both apps.
1 parent 65e7d6c commit a487588

13 files changed

+1
-2627
lines changed

app/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .dependencies import (
44
SessionDep,
5-
background_scheduler,
65
get_app_settings,
76
get_db_session,
87
lifespan_func,

app/dependencies.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from contextlib import asynccontextmanager
33
from typing import Annotated, AsyncGenerator, Generator
44

5-
from apscheduler.schedulers.background import BackgroundScheduler
65
from fastapi import Depends, FastAPI
76
from pydantic_settings import BaseSettings, SettingsConfigDict
87
from sqlmodel import Session, SQLModel, create_engine
@@ -22,7 +21,6 @@ class _Settings(BaseSettings):
2221

2322
_settings = _Settings()
2423
_engine = None
25-
background_scheduler = BackgroundScheduler()
2624

2725

2826
@asynccontextmanager
@@ -37,13 +35,10 @@ async def lifespan_func(app: FastAPI) -> AsyncGenerator[None, None]:
3735
)
3836
# Creates tables in database based on SQLModel table models
3937
SQLModel.metadata.create_all(_engine)
40-
# Start background job scheduler
41-
background_scheduler.start()
4238

4339
yield
4440

4541
_engine.dispose()
46-
background_scheduler.shutdown()
4742

4843

4944
def get_app_settings() -> _Settings:

app/main.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import asyncio
21
import importlib
32
import pkgutil
43

5-
from apscheduler.schedulers.background import BackgroundScheduler
6-
from apscheduler.triggers.cron import CronTrigger
74
from fastapi import APIRouter, FastAPI
85
from fastapi.middleware.cors import CORSMiddleware
96

10-
from app import background_scheduler, lifespan_func
11-
from app.scrapers import sis_scraper
7+
from app import lifespan_func
128

139

1410
def scan_and_include_routers(app: FastAPI) -> None:
@@ -23,14 +19,6 @@ def scan_and_include_routers(app: FastAPI) -> None:
2319
app.include_router(attr)
2420

2521

26-
def init_background_scheduler(bg_scheduler: BackgroundScheduler) -> None:
27-
bg_scheduler.add_job(
28-
lambda: asyncio.run(sis_scraper.main()),
29-
trigger=CronTrigger(day_of_week="mon", hour=4),
30-
timezone="America/New_York",
31-
)
32-
33-
3422
app = FastAPI(root_path="/api/v1", lifespan=lifespan_func)
3523
app.add_middleware(
3624
CORSMiddleware,
@@ -39,4 +27,3 @@ def init_background_scheduler(bg_scheduler: BackgroundScheduler) -> None:
3927
allow_headers=["*"],
4028
)
4129
scan_and_include_routers(app)
42-
init_background_scheduler(background_scheduler)

app/routers/scraper.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/scrapers/__init__.py

Whitespace-only changes.

app/scrapers/code_mappings/attribute_name_code_map.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)