Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cors-lau.vercel.app/docs/llms.txt

Use this file to discover all available pages before exploring further.

The Predictions API powers the core recommendation engine. You can ask the system to infer the next term to plan, retrain the underlying ensemble models against the latest enrollment data, and generate a full ranked list of course offering recommendations for a target semester. Every recommendation run is persisted so you can retrieve and compare results over time.
The ML models are campus-specific. The system trains and stores separate models for Beirut and Byblos campuses. Pass target_campus in every bulk prediction request to select the correct model.

GET /predict/next-term

Auto-detects the next semester to plan by inspecting the most recent offering record in the database. For example, if data ends at Spring 2025, this endpoint returns Fall 2025.

Responses

year
integer
The calendar year of the next recommended planning term.
semester
string
Either "Fall" or "Spring".
curl https://your-cors-instance.com/predict/next-term \
  -H "Authorization: Bearer eyJ..."

POST /predict/train

Retrains both campus-specific ensemble models from scratch using all course offering records currently in the database. Call this endpoint after uploading new historical data to ensure recommendations reflect the latest enrollment patterns. No request body is required.

Responses

The response is a training result object. The most useful field is samples_trained.
samples_trained
integer
Total number of training samples used across both campus models.
curl -X POST https://your-cors-instance.com/predict/train \
  -H "Authorization: Bearer eyJ..."
Training can take several seconds depending on dataset size. Run this endpoint after uploading new historical data to ensure future predictions reflect the latest enrollment patterns.

POST /predict/bulk

Generates a full ranked list of course offering recommendations for a given campus and semester. Each course in the catalog is scored by the ML model; the response includes confidence scores, demand estimates, and a binary offer recommendation for every course.

Request body

run_name
string
required
A human-readable label for this prediction run, used to identify it in the run history. Example: "Prediction_2025_Fall_Beirut".
target_year
integer
required
The calendar year of the semester you are planning for.
target_semester
string
required
The semester to plan. Accepted values: "Fall", "Spring".
target_campus
string
required
The campus to generate recommendations for. Accepted values: "Beirut", "Byblos".
new_freshman
integer
default:"0"
Expected number of new freshman students enrolling this term. Used to estimate demand for gateway courses.
new_sophomores
integer
default:"0"
Expected number of new sophomore students. Used to estimate demand for sophomore gateway courses.
new_masters
integer
default:"0"
Expected number of new graduate students. Used to estimate demand for master’s-level courses.
use_quotas
boolean
default:"false"
When true, the system ignores the ML binary recommendation and instead selects courses by filling fixed per-prefix/per-type slot quotas ranked by offer score. Configure the quota sizes in the slots object.
slots
object
Slot quotas used when use_quotas is true. Each field specifies the maximum number of courses to select for that prefix/type combination.

Responses

The response is a PredictionRunResponse object. The entries array contains one record per course in the catalog.
id
integer
Auto-assigned numeric ID for this prediction run.
run_name
string
The label you supplied in the request.
target_year
integer
The planning year.
target_semester
string
The planning semester.
model_version
string
Internal model version string used when generating this run.
created_at
string
ISO 8601 timestamp of when the run was saved.
entries
object[]
Array of per-course prediction results.
curl -X POST https://your-cors-instance.com/predict/bulk \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "run_name": "Prediction_2025_Fall_Beirut",
    "target_year": 2025,
    "target_semester": "Fall",
    "target_campus": "Beirut",
    "new_freshman": 50,
    "new_sophomores": 100,
    "new_masters": 10,
    "use_quotas": false,
    "slots": {
      "csc_core": 12,
      "csc_elective": 3,
      "bif_core": 6,
      "bif_elective": 2,
      "mth": 8,
      "sta": 3
    }
  }'

GET /predict/runs

Returns all saved prediction runs ordered by most recent first. Use this endpoint to browse run history and retrieve run IDs for downstream operations.

Query parameters

campus
string
Optional filter. When provided, only runs for the specified campus are returned. Example: ?campus=Beirut.

Responses

Returns an array of PredictionRunResponse objects (same schema as the POST /predict/bulk response, each including its entries array).
curl https://your-cors-instance.com/predict/runs \
  -H "Authorization: Bearer eyJ..."