Forensic Decision Support System

Job ID: 40377376

Budget: $10 – $11 USD

GIVE YOUR BEST PRICE THE ONE I WENT WITH IS NOT REAL (10-11)

Project:
**A Flask + MySQL web system with Machine learning module for preliminary classification and statistical analysis of suspicious death cases in Albania, with expert review and correction.**

Use only:

* Python Flask
* MySQL
* HTML/CSS/Bootstrap 5
* Chart.js
* SQLAlchemy
* Flask-Login
* Flask-WTF or equivalent
* Werkzeug security
* scikit-learn
* pandas, numpy
* joblib

Important requirements:

* Everything must be built **from scratch**
* No public/premade dataset
* No pretrained/premade model

I need an **original synthetic dataset** created from scratch only for this project. It will be temporary and later replaceable with real data.

Dataset requirements:

* generated with custom Python code
* realistic but simple forensic-style patterns
* around **1500–3000 rows**
* some missing values
* some noisy/ambiguous/contradictory cases
* labels generated logically/probabilistically, not randomly

Required outputs:

* `dataset/cases_synthetic.csv`
* `dataset/data_dictionary.md`
* `app/ml/generate_synthetic_dataset.py`

Important: logical/probabilistic rules may be used only to **generate the synthetic dataset**. The **final prediction in the app must come from ML models trained from scratch**, not only rules.

Train and compare only **2–3 ML models**, for example:

* Logistic Regression
* Decision Tree
* Random Forest

Choose the final model after:

* preprocessing
* feature engineering
* train/test split
* basic cross-validation
* simple hyperparameter tuning
* evaluation

This should be a **decision support system**.

Flow:

* user enters case data
* system stores it in MySQL
* model gives preliminary prediction
* system shows predicted class and confidence
* expert reviews it
* expert confirms or changes final class
* system stores both model prediction and final expert decision

Classes:

* Suspected homicide
* Suspected suicide
* Suspected accident
* Suspicious natural death
* Undetermined cause

Roles:

* **Admin**: manage users, cases, dashboard
* **Operator/Expert**: create/edit cases, view prediction, assign final class, add expert comment

Core features:

* login/logout
* role-based access
* full CRUD for cases
* search/filter
* dashboard with charts
* ML prediction module
* case details page
* expert correction workflow
* basic audit log

Use mostly **structured fields**, not much free text.

Include fields such as:

* case code
* case date
* age
* gender
* region
* scene/location
* injury type
* violence indicators
* toxicology
* medical history
* case status
* priority
* some trauma indicators
* some medical/psychiatric indicators
* weapon/vehicle/suicide note/witness/conflict flags

Use free text only where needed, such as short case description and expert comment.

Before prediction include:

* input validation
* missing critical field check
* contradiction/inconsistency flags
* basic input quality score

ML pipeline should include:

* data loading
* cleaning
* missing value handling
* feature engineering
* encoding
* split
* training
* evaluation
* model saving
* Flask integration

Use proper scikit-learn components such as:

* Pipeline
* ColumnTransformer
* SimpleImputer
* OneHotEncoder

Evaluate with:

* accuracy
* precision
* recall
* F1-score
* confusion matrix

Also include:

* confidence score
* low-confidence flag for uncertain cases

Prediction output should store/show:

* predicted_class
* confidence_score
* low_confidence_flag
* prediction_date

Prevent **data leakage**. Do not train on fields known only after expert review, such as:

* final_class
* expert_comment
* final decision timestamps

Database tables should include at least:

* users
* cases
* predictions
* final_classifications
* audit_logs

Dashboard/statistics should include:

* total cases
* cases by region
* cases by gender
* cases by category
* cases over time
* high-priority cases
* model vs expert agreement rate

Security requirements:

* secure password hashing
* proper session management
* strict role-based access control
* server-side validation
* CSRF protection
* use SQLAlchemy queries only
* safe handling of secrets through environment variables
* safe error handling without exposing internal details

Project structure should be clean and modular, for example:

* app/

* models/
* routes/
* forms/
* services/
* ml/
* templates/
* static/
* migrations/
* dataset/
* trained_models/
* tests/
* run.py
* requirements.txt
* README.md

I also need:

* SQL schema
* SQLAlchemy models
* Flask routes
* Bootstrap templates
* synthetic dataset generator
* ML training script
* prediction integration
* testing
* local run instructions

Build it in this order:

1. project structure
2. database schema
3. models
4. routes
5. templates
6. synthetic dataset generation
7. preprocessing
8. model training
9. evaluation
10. model saving/loading
11. Flask integration
12. dashboard/statistics
13. testing
14. final run instructions

Finally, create **`TEXT.md`** with clear step-by-step instructions for:

* project structure
* synthetic dataset generation
* label generation logic
* preprocessing
* feature engineering
* ML training and model selection
* Flask prediction integration
* local setup and running
* retraining from scratch
* replacing synthetic data with real data
* testing
* explanation of the main files/folders
* implemented security measures

The instructions in `TEXT.md` must be clear, practical, and simple enough for a bachelor student to follow.
Related categories: Python CSS MySQL HTML Flask