Complete Expert System for Body Type Analysis with Professional Styling
A comprehensive web-based expert system that determines somatotype (body type) using certainty factor methodology. Features modern design, complete admin panel, and enhanced image display.
| Feature | Description |
|---|---|
| π― Expert System | Certainty Factor-based diagnosis with 18 diagnostic questions |
| π¨ Modern Design | Professional external CSS styling with responsive layout |
| πΌοΈ Visual Results | Enhanced image display for each somatotype with fallback placeholders |
| π§ Admin Panel | Complete database management system with CRUD operations |
| π± Responsive | Works perfectly on desktop, tablet, and mobile devices |
| π½οΈ Diet Recommendations | Personalized nutrition advice for each body type |
| π Progress Tracking | Visual confidence percentages and animated progress bars |
| π‘οΈ Security | Input sanitization, SQL injection protection, session management |
π¦ expertsys/
βββ π style.css # External CSS (Professional styling)
βββ π index.php # Homepage with side-by-side layout
βββ π survei.php # Interactive 18-question survey
βββ βοΈ proses.php # CF calculation & processing logic
βββ π hasil.php # Enhanced results with image display
βββ π koneksi.php # Secure database connection
βββ π admin_login.php # Admin authentication
βββ π admin_dashboard.php # Admin overview & statistics
βββ π admin_gejala.php # Symptoms management (CRUD)
βββ π― admin_kondisi.php # Conditions management (CRUD)
βββ π§ admin_knowledge.php # Knowledge base & CF management
βββ πΎ expertsys.sql # Database schema & sample data
βββ πΌοΈ create_sample_images.html # Image generator tool
βββ π uploads/ # Image storage directory
β βββ πββοΈ ectomorph.jpg
β βββ πͺ mesomorph.jpg
β βββ π€ endomorph.jpg
βββ π README.md # This documentation
# Create database
mysql -u root -p
CREATE DATABASE expertsys;
exit
# Import schema and data
mysql -u root -p expertsys < expertsys.sqlEdit koneksi.php:
$host = "localhost";
$user = "root"; # Your MySQL username
$password = ""; # Your MySQL password
$database = "expertsys";- Copy all PHP and CSS files to your web directory
- Create
uploads/folder:mkdir uploads && chmod 755 uploads
Option A: Quick Sample Images
- Open
create_sample_images.htmlin browser - Download generated images
- Save as
uploads/ectomorph.jpg,uploads/mesomorph.jpg,uploads/endomorph.jpg
Option B: Professional Images
- Use stock photos from Unsplash
- Resize to 400x400px for optimal performance
- Save in
uploads/folder with exact filenames
- π User Interface:
http://your-domain/index.php - π§ Admin Panel:
http://your-domain/admin_login.php- π€ Username:
admin - π Password:
admin123
- π€ Username:
/* Modern CSS Variables */
:root {
--primary: #6C63FF; /* Purple - Ectomorph */
--secondary: #FF6584; /* Pink - Mesomorph */
--accent: #43CBFF; /* Cyan - Endomorph */
--dark: #2A2A3C; /* Text */
--light: #F8FAFC; /* Background */
}- β Side-by-side Layout: Purple sidebar + white content area
- β External CSS: No inline styles, maintainable code
- β Responsive Grid: Works on all screen sizes
- β Modern Typography: Google Fonts (Outfit family)
- β Smooth Animations: Hover effects and transitions
| Type | Color | Icon | Characteristics |
|---|---|---|---|
| πββοΈ Ectomorph | Purple #6C63FF |
Runner | Thin, fast metabolism |
| πͺ Mesomorph | Pink #FF6584 |
Strong | Athletic, muscular |
| π€ Endomorph | Cyan #43CBFF |
Rounded | Fuller, slower metabolism |
CF(combination) = CF1 + CF2 Γ (1 - CF1)
Example Calculation:
Symptom 1: CF = 0.8 (80% confidence)
Symptom 2: CF = 0.7 (70% confidence)
Combined: 0.8 + 0.7 Γ (1 - 0.8) = 0.94 (94% confidence)
| Range | Level | Color | Meaning |
|---|---|---|---|
| 0.8 - 1.0 | High | π’ Green | Strong diagnosis |
| 0.4 - 0.7 | Medium | π‘ Yellow | Moderate indication |
| 0.1 - 0.3 | Low | π΄ Red | Weak correlation |
G001: Apakah tubuh Anda cenderung kurus dan tinggi?
G002: Apakah lemak tubuh Anda rendah?
G003: Apakah Anda kesulitan menambah massa otot?
... (15 more questions)
π Dashboard
βββ Real-time statistics (symptoms, conditions, rules)
βββ System overview and health monitoring
βββ Quick navigation to all modules
π Kelola Gejala (Symptoms Management)
βββ Add new diagnostic questions
βββ Edit existing symptoms
βββ Delete unused symptoms (with safety checks)
βββ Bulk operations support
π― Kelola Kondisi (Conditions Management)
βββ Manage somatotype definitions
βββ Edit detailed descriptions
βββ Configure visual representations
βββ Import/export capabilities
π§ Knowledge Base Management
βββ Rules Tab: Configure CF values and relationships
βββ Matrix Tab: Visual overview of all rules
βββ Validation: Prevent conflicting rules
βββ Analytics: Rule effectiveness tracking
- π‘οΈ Input Sanitization: All user inputs cleaned
- π SQL Injection Protection: Parameterized queries
β οΈ Referential Integrity: Prevents orphaned records- π Session Management: Secure admin authentication
- β Confirmation Dialogs: Prevent accidental deletions
π― Goal: Weight & Muscle Gain
π Macros: 50% Carbs, 25% Protein, 25% Fat
π½οΈ Strategy: 5-6 meals/day, high calorie density
π Calorie Surplus: +10-20% above TDEE
Sample Day:
βββ Breakfast: Oatmeal + milk + banana + peanut butter
βββ Lunch: Rice + beef + vegetables
βββ Dinner: Pasta + meat sauce + cheese
βββ Snacks: Protein smoothies + granola bars
π― Goal: Muscle Maintenance & Definition
π Macros: 40% Carbs, 30% Protein, 30% Fat
π½οΈ Strategy: 3 meals + 2 snacks, balanced approach
π Calorie Balance: Maintenance level
Sample Day:
βββ Breakfast: Scrambled eggs + whole grain toast + fruit
βββ Lunch: Grilled chicken + quinoa + steamed vegetables
βββ Dinner: Lean steak + sweet potato + broccoli
βββ Snacks: Greek yogurt + nuts
π― Goal: Fat Loss & Weight Management
π Macros: 25% Carbs, 40% Protein, 35% Fat
π½οΈ Strategy: Lower carb, higher fiber, portion control
π Calorie Deficit: -10-20% below TDEE
Sample Day:
βββ Breakfast: Egg whites + whole grain toast + green tea
βββ Lunch: Grilled fish + vegetables + small portion brown rice
βββ Dinner: Vegetable soup + tofu/tempeh
βββ Snacks: Nuts + seeds
/* Desktop First Approach */
@media (max-width: 1024px) { /* Tablet */ }
@media (max-width: 640px) { /* Mobile */ }| Device | Layout | Optimizations |
|---|---|---|
| π₯οΈ Desktop | Side-by-side | Full feature set, hover effects |
| π± Tablet | Stacked | Touch-friendly, simplified nav |
| π± Mobile | Single column | Thumb navigation, readable text |
- Database: Add new condition in admin panel
- Images: Add corresponding image to
uploads/folder - CSS: Add new color scheme in
style.css - Logic: Update processing in
proses.php
// Example: Adding question G019
INSERT INTO gejala (kode_gejala, nama_gejala)
VALUES ('G019', 'Your new diagnostic question?');
// Add corresponding CF rules in knowledge base
INSERT INTO know_base (id_gejala, id_kondisi, value_cf)
VALUES (19, 1, 0.7); // Link to Ectomorph with 70% confidence/* Custom color scheme */
:root {
--primary: #YOUR_COLOR; /* Primary somatotype */
--secondary: #YOUR_COLOR; /* Secondary somatotype */
--accent: #YOUR_COLOR; /* Accent somatotype */
}# Check MySQL service
sudo systemctl status mysql
# Verify database exists
mysql -u root -p -e "SHOW DATABASES;"
# Test connection
mysql -u root -p expertsys -e "SHOW TABLES;"# Check folder permissions
ls -la uploads/
# Should show: drwxr-xr-x (755)
# Check file permissions
ls -la uploads/*.jpg
# Should show: -rw-r--r-- (644)
# Fix permissions if needed
chmod 755 uploads/
chmod 644 uploads/*.jpgβ "Username atau password salah"
β
Use exactly: admin / admin123
β "Page not found"
β
Check admin_login.php exists in web directory
β Session problems
β
Verify PHP session.save_path is writable
| Component | Minimum | Recommended |
|---|---|---|
| PHP | 7.4 | 8.0+ |
| MySQL | 5.7 | 8.0+ |
| Memory | 128MB | 256MB+ |
| Storage | 50MB | 100MB+ |
| Web Server | Apache 2.4 | Apache/Nginx |
- β Chrome 90+
- β Firefox 88+
- β Safari 14+
- β Edge 90+
- β Internet Explorer (not supported)
// Potential REST API structure
GET /api/questions # Get all diagnostic questions
POST /api/diagnose # Submit answers, get results
GET /api/somatotypes # Get all body types
POST /api/admin/login # Admin authentication// Google Analytics example
gtag('event', 'diagnosis_completed', {
'somatotype': result,
'confidence': percentage,
'questions_answered': count
});| Issue | Solution |
|---|---|
| π§ Setup Problems | Follow step-by-step setup guide |
| πΌοΈ Image Issues | Use create_sample_images.html |
| π Admin Access | Default: admin/admin123 |
| πΎ Database Errors | Check koneksi.php configuration |
| π¨ Style Issues | Verify style.css is loaded |
- π Certainty Factor Theory: Academic Papers
- πββοΈ Somatotype Research: Body Type Classification
- π¨ Design Inspiration: Modern Web Design
-- Add indexes for better performance
CREATE INDEX idx_gejala_kode ON gejala(kode_gejala);
CREATE INDEX idx_know_base_lookup ON know_base(id_gejala, id_kondisi);# Compress images for web
convert input.jpg -quality 85 -resize 400x400^ output.jpg// Example: Cache CF calculations
$cache_key = 'cf_' . md5(serialize($selected_symptoms));
if (!($result = cache_get($cache_key))) {
$result = calculate_certainty_factors($symptoms);
cache_set($cache_key, $result, 3600); // 1 hour
}This software is created for educational and research purposes.
Not intended for commercial medical diagnosis.
Always consult healthcare professionals for medical advice.
- β No personal data stored
- β Session-based results only
- β Admin data encrypted
- β GDPR considerations included
β οΈ IMPORTANT MEDICAL DISCLAIMER
This system is for educational purposes only and should not replace
professional medical advice. Always consult qualified healthcare
providers for medical decisions.
- π Visit homepage (
index.php) - π Complete 18-question survey
- πΌοΈ View results with visual representation
- π½οΈ Get personalized diet recommendations
- π Login to admin panel (
admin_login.php) - π View system statistics
- π§ Manage questions, conditions, and rules
- π Monitor system performance
- π Review this documentation
- π Examine code structure
- π οΈ Customize for your needs
- π Deploy to production
π Ready to discover your somatotype? Start exploring your body type today!
Created with β€οΈ by FUFUFAFA Development Team
Version 2.0.0 - Complete Professional Redesign
Last Updated: 2025
