WGU D602 Deployment – Task 3: Program Deployment | Flight Delay Prediction
API Using Python, FastAPI & Docker | Complete Report 2026/2027 Update
1. For the WGU D602 Task 3 Flight Delay Prediction API, which FastAPI endpoint
design correctly handles real-time predictions with validation?
Figure 1: Refer to diagram for Q1 – FastAPI / Docker deployment flow
A) Define Pydantic model FlightRequest with fields airline str, origin str length 3,
dest str length 3, dep_delay float ge -60 le 600, weather str in [clear, rain, snow],
hour int 0-23, dayofweek int 0-6, endpoint @app.post('/predict') def
predict(request: FlightRequest) validates input, loads XGBoost model.pkl and
preprocessing pipeline, returns JSON {'delay_probability': 0.73,
'delay_prob_percent': '73%', 'prediction': 'Delayed'} with SHAP top features, plus
@app.get('/health') for liveness and /docs for Swagger
B) Use GET request with no validation and return raw model object
C) Use PCA to predict flight delay
D) Hardcode predictions without model
Answer: A
Rationale: Option A is correct because FastAPI with Pydantic provides
automatic validation: airline as string, origin/dest 3-letter airport codes,
, dep_delay bounded -60 to 600 minutes, weather in allowed set, hour 0-23,
dayofweek 0-6. The POST /predict endpoint loads the XGBoost model.pkl and
preprocessing pipeline, returns structured JSON with delay_probability 0.73
and percent, plus SHAP top features for explainability, while /health enables
Kubernetes liveness probes and /docs provides auto-generated Swagger UI.
Option B is wrong because GET with no validation allows invalid inputs like
hour 99, returns raw model object not JSON, lacks health check, and violates
REST best practices for predictions. Option C is wrong because PCA is
dimensionality reduction for analysis, not a model for flight delay prediction.
Option D is wrong because hardcoding predictions without a trained model
provides no ML value and fails to generalize to new flights.
2. Refer to the FastAPI Flight Delay API Architecture diagram below. How does a
client request flow through the system to return a prediction?
Figure 2: Refer to diagram for Q2 – FastAPI / Docker deployment flow
A) Client (Web App/Postman) sends REST/HTTPS POST to API Gateway which
handles rate limiting and load balancing, routes to Docker containerized FastAPI
App (Python 3.10) with endpoints /predict POST, /health GET, /docs GET
Swagger, FastAPI loads Model Layer XGBoost flight_delay_model.pkl and sklearn
preprocessing pipeline, Data Layer provides features departure_delay, airline,
origin, dest, weather, hour, dayofweek, returns Response JSON with
API Using Python, FastAPI & Docker | Complete Report 2026/2027 Update
1. For the WGU D602 Task 3 Flight Delay Prediction API, which FastAPI endpoint
design correctly handles real-time predictions with validation?
Figure 1: Refer to diagram for Q1 – FastAPI / Docker deployment flow
A) Define Pydantic model FlightRequest with fields airline str, origin str length 3,
dest str length 3, dep_delay float ge -60 le 600, weather str in [clear, rain, snow],
hour int 0-23, dayofweek int 0-6, endpoint @app.post('/predict') def
predict(request: FlightRequest) validates input, loads XGBoost model.pkl and
preprocessing pipeline, returns JSON {'delay_probability': 0.73,
'delay_prob_percent': '73%', 'prediction': 'Delayed'} with SHAP top features, plus
@app.get('/health') for liveness and /docs for Swagger
B) Use GET request with no validation and return raw model object
C) Use PCA to predict flight delay
D) Hardcode predictions without model
Answer: A
Rationale: Option A is correct because FastAPI with Pydantic provides
automatic validation: airline as string, origin/dest 3-letter airport codes,
, dep_delay bounded -60 to 600 minutes, weather in allowed set, hour 0-23,
dayofweek 0-6. The POST /predict endpoint loads the XGBoost model.pkl and
preprocessing pipeline, returns structured JSON with delay_probability 0.73
and percent, plus SHAP top features for explainability, while /health enables
Kubernetes liveness probes and /docs provides auto-generated Swagger UI.
Option B is wrong because GET with no validation allows invalid inputs like
hour 99, returns raw model object not JSON, lacks health check, and violates
REST best practices for predictions. Option C is wrong because PCA is
dimensionality reduction for analysis, not a model for flight delay prediction.
Option D is wrong because hardcoding predictions without a trained model
provides no ML value and fails to generalize to new flights.
2. Refer to the FastAPI Flight Delay API Architecture diagram below. How does a
client request flow through the system to return a prediction?
Figure 2: Refer to diagram for Q2 – FastAPI / Docker deployment flow
A) Client (Web App/Postman) sends REST/HTTPS POST to API Gateway which
handles rate limiting and load balancing, routes to Docker containerized FastAPI
App (Python 3.10) with endpoints /predict POST, /health GET, /docs GET
Swagger, FastAPI loads Model Layer XGBoost flight_delay_model.pkl and sklearn
preprocessing pipeline, Data Layer provides features departure_delay, airline,
origin, dest, weather, hour, dayofweek, returns Response JSON with