@@ -69,45 +69,44 @@ async def get_financial_aid(
6969 except Exception as e :
7070 raise HTTPException (status_code = 500 , detail = f"Error fetching financial aid: { str (e )} " )
7171
72- # TEMPORARILY DISABLED - LLM and AR endpoints for CSUSB
73- # @router.get("/llm-recommendations", response_model=List[LlmRecommendationRecord])
74- # async def get_llm_recommendations(
75- # limit: int = Query(100, ge=1, le=1000, description="Number of records to return"),
76- # offset: int = Query(0, ge=0, description="Number of records to skip")
77- # ):
78- # """Get LLM recommendation records from CSUSB database."""
79- # try:
80- # with get_db_connection(DATABASE_NAME) as connection:
81- # cursor = connection.cursor(dictionary=True)
82- # query = "SELECT * FROM llm_recommendations ORDER BY id LIMIT %s OFFSET %s"
83- # cursor.execute(query, (limit, offset))
84- # records = cursor.fetchall()
85- # cursor.close()
86- # return format_records(records)
87- # except Exception as e:
88- # raise HTTPException(status_code=500, detail=f"Error fetching LLM recommendations: {str(e)}")
72+ @router .get ("/llm-recommendations" , response_model = List [LlmRecommendationRecord ])
73+ async def get_llm_recommendations (
74+ limit : int = Query (100 , ge = 1 , le = 1000 , description = "Number of records to return" ),
75+ offset : int = Query (0 , ge = 0 , description = "Number of records to skip" )
76+ ):
77+ """Get LLM recommendation records from CSUSB database."""
78+ try :
79+ with get_db_connection (DATABASE_NAME ) as connection :
80+ cursor = connection .cursor (dictionary = True )
81+ query = "SELECT * FROM llm_recommendations ORDER BY id LIMIT %s OFFSET %s"
82+ cursor .execute (query , (limit , offset ))
83+ records = cursor .fetchall ()
84+ cursor .close ()
85+ return format_records (records )
86+ except Exception as e :
87+ raise HTTPException (status_code = 500 , detail = f"Error fetching LLM recommendations: { str (e )} " )
8988
90- # @router.get("/analysis-ready", response_model=List[AnalysisReadyRecord])
91- # async def get_analysis_ready(
92- # limit: int = Query(100, ge=1, le=1000, description="Number of records to return"),
93- # offset: int = Query(0, ge=0, description="Number of records to skip")
94- # ):
95- # """Get analysis ready records from CSUSB database."""
96- # try:
97- # with get_db_connection(DATABASE_NAME) as connection:
98- # cursor = connection.cursor(dictionary=True)
99- # query = "SELECT * FROM ar_csusb ORDER BY id LIMIT %s OFFSET %s"
100- # cursor.execute(query, (limit, offset))
101- # records = cursor.fetchall()
102- # cursor.close()
103- # return format_records(records)
104- # except Exception as e:
105- # raise HTTPException(status_code=500, detail=f"Error fetching analysis ready records: {str(e)}")
89+ @router .get ("/analysis-ready" , response_model = List [AnalysisReadyRecord ])
90+ async def get_analysis_ready (
91+ limit : int = Query (100 , ge = 1 , le = 1000 , description = "Number of records to return" ),
92+ offset : int = Query (0 , ge = 0 , description = "Number of records to skip" )
93+ ):
94+ """Get analysis ready records from CSUSB database."""
95+ try :
96+ with get_db_connection (DATABASE_NAME ) as connection :
97+ cursor = connection .cursor (dictionary = True )
98+ query = "SELECT * FROM ar_csusb ORDER BY id LIMIT %s OFFSET %s"
99+ cursor .execute (query , (limit , offset ))
100+ records = cursor .fetchall ()
101+ cursor .close ()
102+ return format_records (records )
103+ except Exception as e :
104+ raise HTTPException (status_code = 500 , detail = f"Error fetching analysis ready records: { str (e )} " )
106105
107106@router .get ("/{table_name}/count" , response_model = TableCount )
108107async def get_table_count (table_name : str ):
109108 """Get the total count of records in a specific table."""
110- valid_tables = ["cohort" , "course" , "financial_aid" ] # Temporarily removed: "llm_recommendations", "ar_csusb"
109+ valid_tables = ["cohort" , "course" , "financial_aid" , "llm_recommendations" , "ar_csusb" ]
111110 if table_name not in valid_tables :
112111 raise HTTPException (
113112 status_code = 404 ,
0 commit comments