Worked example · Python, Flask and SQLite
Malaria and Typhoid Diagnosis Expert System source code
A teaching expert system for malaria and typhoid fever that takes up to eight symptom observations with certainty levels, applies an admin-managed rule base, and returns ranked outcomes with a step-by-step explanation. It is an offline, illustrative simulation for Computer Science students at the university, not a clinical tool.
A real system made by the same builder you would use. Yours is built for your own topic and answers, so its screens and tables will differ. This example is not a source-code download.
The problem it solves
Computer Science students need a small, explainable rule-based system to demonstrate how medical expert systems combine evidence. The project focuses on malaria and typhoid fever, using fictional cases, transparent rule logic and offline operation.
Project topic: Development of a Medical Diagnosis Expert System for Malaria and Typhoid Fever
Who uses it
attendant
Enters fictional symptom observations, sees explained results, and saves cases to their own history.
- Create and view own fictional cases
- View explained result for each case
- View own saved cases
admin
Manages the illustrative rule base and reviews all saved fictional cases.
- Add and edit rules with source, version and active status
- View all saved cases
- Manage own saved cases
What it does
Fictional case entry and analysis
Attendant records up to eight observations, each marked not present, possible or certain. The system runs the rule engine and shows the result immediately.
Explained result with rule trace
Shows the entered facts, every matched rule with its weight and contribution, the combined score, the score band meaning and a limitation notice.
Attendant case history
Lists the signed-in attendant's saved fictional cases, with pagination and a link to the explained result.
Rule catalogue with versioning
Admin lists, adds and edits illustrative rules. Each rule stores its source, version, active flag and explanation text. Existing saved cases keep the version they used.
All saved cases for admin
Admin reviews every saved fictional case across all attendants, with pagination and a link to each explained result.
Login and role-based access
Standard login with hashed passwords, CSRF protection and role checks. The sample logins are demonstration credentials.
Screenshots
Screenshots of the running system, taken by our checks. The records are sample data and are labelled so on each page.





Database tables
- usersLocal accounts and roles for authentication.id, username, password_hash, full_name, role, created_at
- rulesThe editable illustrative rule base.id, name, condition, outcome, weight, source, version, active
- consultationsOne fictional case with its saved rule version and final score.id, user_id, rule_version, final_score, created_at
- case_factsThe eight entered observations and their certainty for one case.id, case_id, observation, certainty
- case_rule_matchesA snapshot of each matched rule so an old case keeps its explanation.id, case_id, rule_id, rule_name, outcome, weight, source, version, confidence, contribution
Technology
- Python. Readable, widely taught, and supported by the student's environment.
- Flask. Lightweight and easy to explain.
- Jinja. Keeps HTML clean and reusable.
- SQLite. Zero configuration and fully offline.
- Bootstrap. Local files in static/vendor, no CDN.
- Chart.js. Local copy in static/vendor, no CDN.
- Werkzeug. Security best practice with a simple API.
- Flask-WTF. Required for safe form submissions.
How to run it: running a Python project on Windows. Not sure which language to pick? Python or PHP.
How it was tested
17 of 17 tests passed, 11 of them automated. The system was also installed from scratch and every screen was opened as the right kind of user before it was accepted.
What it does not do
- All rules and weights are synthetic and unvalidated teaching examples. The system never diagnoses, excludes illness or recommends treatment.
- The score is an illustrative combination of positive evidence, not a calibrated probability and not a measure of diagnostic accuracy.
- Only positive evidence is modelled. Negative evidence would need a separate, tested signed combination.
- No real patient identifiers are stored, and the system does not connect to a medical device, external AI or hospital record system.
- An admin edits the rule base by hand. There is no clinical review or approval workflow.
- The system does not do the following: image or laboratory analysis, prescription support, patient record storage, user self-registration, email or SMS alerts, cloud sync, multi-language output, or any real clinical decision support.
- The Windows run was not verified from this macOS environment. Windows users should run run.bat and follow guide/RUN.md.
Chapters 3 and 4 from this system
With the MonoEd FYP Generator, signed in with the same Google account, press “Use my working system” when you write Chapter 3 or 4. Its real users, 5 database tables, screenshots and 17 test results go into the chapters, laid out under your supervisor's headings. Nothing is invented: anything the system cannot show, such as a user test, is left for you to fill in.
Want a malaria and typhoid diagnosis expert system for your own school or business case?
Get a system built for your topic, with a guide, defence questions and screenshots. Plan it free, then ₦13,500 only if you want it built. View pricing.
Start with this topic