How basteprince2/pdad-ml-service works
This repository is a FastAPI ML service consumed by the Laravel PDAD application. The principal workflows accept a profile, validate the request, then either predict an employment type or rank supplied jobs; the recommender applies employment-type and disability-compatibility filtering before TF-IDF similarity ranking. Model artifacts are loaded at startup. README-documented rate limiting, timeout handling, and structured logging are included, though their implementation details are only partially visible in the sampled source.
Main entry points: main.py FastAPI endpoints · recommender.py Recommendation engine · predictor.py Random Forest predictor · schemas.py Prediction or recommendations
Components 15
HTTP service
- FastAPI endpoints
main.py - Request schemas
schemas.py - Health status
main.py - Prediction or recommendations
schemas.py
Employment prediction
- Vocabulary validation
models/validator.py - Random Forest predictor
models/predictor.py - Model artifacts
artifacts
Job recommendation
- Recommendation engine
models/recommender.py - Employment-type filter
models/recommender.py - Disability compatibility
models/recommender.py - TF-IDF ranking
models/recommender.py
Runtime operations
- IP rate limiter
main.py - Structured logging
main.py - Service configuration
config.py
Other components
- Laravel application
Connections 16
- Laravel application → FastAPI endpoints: sends profile/jobs
- FastAPI endpoints → Request schemas: validates payload
- FastAPI endpoints → IP rate limiter: checks request
- FastAPI endpoints → Vocabulary validation: validates vocabulary
- FastAPI endpoints → Random Forest predictor: requests prediction
- Random Forest predictor → Model artifacts: loads model data
- FastAPI endpoints → Recommendation engine: requests ranking
- Recommendation engine → Employment-type filter: filters employment type
- Recommendation engine → Disability compatibility: checks compatibility
- Recommendation engine → TF-IDF ranking: ranks remaining jobs
- FastAPI endpoints → Health status: serves status
- FastAPI endpoints → Structured logging: writes request logs
- Service configuration → FastAPI endpoints: configures service
- Random Forest predictor → Prediction or recommendations: returns prediction
- Recommendation engine → Prediction or recommendations: returns recommendations
- FastAPI endpoints → Laravel application: returns HTTP result