A production-style REST API developed to deploy a trained machine learning model for flight delay prediction. The application exposes prediction endpoints through FastAPI, incorporates automated testing with pytest, and supports containerized deployment using Docker.
This project demonstrates the deployment phase of the machine learning lifecycle by transforming a trained predictive model into an accessible web service.
The API accepts flight-related inputs, processes requests using a trained regression model, and returns predicted departure delays through HTTP endpoints.
A short demonstration of the deployed REST API is available on Vimeo. The video shows the FastAPI application running inside a Docker container, submitting HTTP requests to the prediction endpoint, and returning real-time machine learning predictions through the deployed service.
- Python
- FastAPI
- Uvicorn
- Scikit-learn
- NumPy
- Pandas
- Pytest
- Docker
- Git
- GitHub
- REST API endpoint for flight delay prediction
- JSON-based request and response handling
- Automated unit testing
- Docker containerization
- Machine learning model deployment
- Airport code encoding support
- HTTP endpoint validation
.
├── main.py
├── test_main.py
├── Dockerfile
├── requirements.txt
├── finalized_model.pkl
├── airport_encodings.json
├── README.md
└── flight_delay_api.ipynb
GET /Returns a status message confirming API availability.
Example Response:
{
"message": "API is operational"
}GET /predict/delays| Parameter | Type | Description |
|---|---|---|
| arrival_airport | string | Airport code (e.g., LAX) |
| dep_time | integer | Departure time (HHMM) |
| arr_time | integer | Arrival time (HHMM) |
Example Request:
/predict/delays?arrival_airport=LAX&dep_time=1400&arr_time=1630Example Response:
{
"predicted_departure_delay_minutes": 3.09
}The project includes automated unit tests using pytest to verify:
- Root endpoint functionality
- Prediction endpoint responses
- Input validation
- Error handling behavior
Run the tests with:
pytestThe application is containerized using Docker for reproducible deployment.
docker build -t flight-delay-api .docker run -p 8000:8000 flight-delay-apihttp://localhost:8000
- Load trained regression model
- Load airport encoding mappings
- Receive HTTP request
- Transform airport code into model-compatible features
- Generate prediction using the trained model
- Return prediction as a JSON response
The deployed API successfully:
- Serves machine learning predictions through HTTP endpoints
- Loads trained model artifacts for real-time inference
- Validates incoming requests and returns structured responses
- Passes automated unit testing with pytest
- Supports reproducible deployment using Docker containers
- Machine Learning Deployment
- REST API Development
- FastAPI
- Docker
- Automated Testing
- Model Serving
- Python Development
- CI/CD Concepts
- MLOps Fundamentals
This project demonstrates how production-ready machine learning services can:
- Deploy predictive models through REST APIs
- Deliver real-time inference
- Support scalable application deployment
- Improve software reliability through automated testing
- Enable reproducible deployment using containerization
This project demonstrates practical experience with:
- Deploying machine learning models through APIs
- Building production-style web services
- Containerized application deployment
- Automated testing and validation
- Model inference workflows
- Reproducible deployment environments
This repository is part of a two-project portfolio demonstrating an end-to-end machine learning solution for flight delay prediction.
| Repository | Focus |
|---|---|
| Flight Delay ML Pipeline | Data engineering, feature engineering, model training, experiment tracking, and machine learning pipeline development |
| Flight Delay API Deployment | FastAPI application, model serving, automated testing, Docker containerization, and deployment |
Together, these projects demonstrate both machine learning development and production deployment skills.
Joanna Ronchi
- Master of Science in Data Science
- Bachelor of Science in Information Technology Management
GitHub: https://github.com/joannar77
LinkedIn: https://www.linkedin.com/in/joanna-ronchi/
This repository is provided for portfolio and educational purposes.