Architecture & Performance Benchmark: English Practice Diagnostic AI Platform
Language learners preparing for high‑stakes exams like IELTS, TOEFL, or CEFR certifications need more than static question banks. Rote memorization often masks genuine grammatical understanding, while pure AI‑only generators can produce inconsistent or invalid questions. English Practice Diagnostic solves this by blending a curated, seeded question bank with cloud‑based AI generation via OpenRouter, all wrapped in a robust Django architecture that guarantees 100% availability.
The Engineering Challenge: Why English Practice Diagnostic Was Architected
Traditional e‑learning platforms either rely on limited static databases or on volatile cloud AI APIs. Both approaches introduce risk: static banks lack variety, and cloud APIs can fail, causing downtime. English Practice Diagnostic needed a resilient solution that:
- Delivers adaptive, CEFR‑calibrated grammar diagnostics.
- Maintains a persistent question bank for zero‑downtime testing.
- Integrates OpenRouter LLMs for dynamic question generation with fallback mechanisms.
- Provides granular post‑test analytics and study suggestions.
The resulting architecture is a hybrid pipeline that fuses local SQLite persistence, an in‑memory Oxford 5000 lexical database, and OpenRouter AI generation—all containerized via Docker Compose for consistent deployment.
Core Architecture & Technical Stack Deep-Dive
System Components Overview
The system is organized into four clear layers:
- Frontend Layer: Server‑rendered Django templates with modular vanilla JavaScript and Bootstrap 5 UI.
- Application Layer: Django 5.x running under Gunicorn WSGI, handling HTTP requests and business logic.
- Persistence Layer: SQLite database storing
TestSessionstates andParagraphBankQuestionarchives, mounted to survive container restarts. - AI & Lexical Services: OpenRouter LLM API (GPT‑4o‑mini / Gemma) for dynamic question generation, and a local Oxford 5000 lexical repository for word definitions and collocations.
The deployment topology uses Nginx as a reverse proxy for SSL termination and static asset serving, with Gunicorn exposing Django on port 8000. This separation keeps dynamic and static content efficiently managed.
Technology Stack Details
| Component | Version / Specification |
|---|---|
| Django | 5.x |
| Python | 3.12 |
| OpenRouter API | GPT‑4o‑mini / Gemma LLMs |
| Database | SQLite (persistent, mounted volume) |
| Static Assets | WhiteNoise + Nginx |
| Container Orchestration | Docker Compose |
| Frontend Framework | Bootstrap 5 + vanilla JS |
Key Features Breakdown & Practical Benefits
1. Adaptive Hidden‑Topic Diagnostic Testing
Users receive sentence cloze and paragraph multi‑blank tests that target specific grammatical topics. The system instantly scores responses and delivers a CEFR‑aligned proficiency estimate.
2. Dynamic AI Question Generation
OpenRouter LLMs generate high‑quality questions on‑the‑fly. Strict JSON schemas and content fingerprinting ensure safety and consistency. Distractors are validated before presentation.
3. Automatic Local Fallback
When the OpenRouter API is unavailable, the platform seamlessly switches to a curated local question bank, guaranteeing zero downtime and offline capability.
4. Persistent Data Across Restarts
SQLite databases are mounted as Docker volumes, preserving active test sessions and user progress even after container restarts.
5. Detailed Diagnostic Analytics
Post‑test reports break down accuracy by topic, estimate CEFR level, provide grammatical explanations, and suggest targeted study paths.
Real‑World Use Cases
- Individual learners pinpointing grammar weaknesses.
- ESL, TOEFL, and IELTS candidates preparing with adaptive diagnostics.
- Educators generating custom assessment sessions automatically.
- Showcasing fault‑tolerant AI architectures combining cloud LLMs with local fallback.
Data Flow & How It Works: Step‑by‑Step Workflow
- Request Initiation: Browser submits a diagnostic request specifying CEFR level and test type (sentence cloze or paragraph multi‑blank).
- Question Retrieval: Django service queries the local SQLite bank; if insufficient, it calls OpenRouter API to generate new questions.
- Validation: Generated JSON is validated against strict schemas; content fingerprinting ensures no unsafe material.
- Delivery: Questions are streamed to the frontend for interactive filling.
- Scoring: Real‑time scoring engine evaluates answers, computes CEFR estimate, and records session data.
- Diagnostics: After completion, a detailed report is saved to SQLite and rendered via Django templates.
- Persistence: All session data is written to the mounted SQLite volume, surviving container restarts.
Architectural Comparison: English Practice Diagnostic vs Traditional Approaches
| Aspect | Traditional Static Bank | Cloud‑Only AI Generator | English Practice Diagnostic |
|---|---|---|---|
| Availability | Always on, but limited variety | Depends on API health | Hybrid – local fallback ensures 100% uptime |
| Question Quality | Fixed, may become stale | Variable, risk of invalid distractors | Curated seed + AI validation for consistency |
| Adaptivity | Minimal | High but unreliable | Dynamic CEFR‑calibrated difficulty with instant scoring |
| Offline Capability | Yes | No | Yes – local SQLite bank serves requests |
| Diagnostic Depth | Basic scores | Limited analytics | Detailed CEFR estimates, topic error matrices, study suggestions |
Frequently Asked Questions (FAQ)
Q1: How does the fallback mechanism work when OpenRouter is unavailable?
The application checks API health before each request. If the OpenRouter endpoint fails, it automatically queries the local SQLite question bank, ensuring uninterrupted testing.
Q2: Is user data persisted across container restarts?
Yes. The SQLite database is mounted as a Docker volume, preserving active sessions, test history, and progress even after restarts.
Q3: What CEFR levels are supported?
The platform covers all six CEFR tiers—A1 through C2—allowing granular calibration of question difficulty.
Q4: Can educators customize assessment sessions?
Absolutely. Educators can generate custom diagnostic sessions by specifying topics, difficulty, and number of questions, all through the intuitive Django admin interface.
Q5: How is AI safety ensured in question generation?
Every generated question passes through strict JSON schema validation and content fingerprinting, filtering out unsafe or inappropriate material before delivery.
Conclusion & Next Steps
English Practice Diagnostic exemplifies a modern, fault‑tolerant approach to AI‑enhanced language assessment. By marrying a curated local question bank with OpenRouter LLMs, it delivers adaptive, high‑quality diagnostics while guaranteeing 100
Leave a Reply