Skip to content

Repository files navigation

πŸƒβ€β™‚οΈ FUFUFAFA - Sistem Pakar Somatotype

Version PHP MySQL License

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.

image

✨ Key Features

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

πŸ—οΈ Complete File Structure

πŸ“¦ 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

πŸš€ Quick Setup (5 Minutes)

Step 1: Database Setup

# Create database
mysql -u root -p
CREATE DATABASE expertsys;
exit

# Import schema and data
mysql -u root -p expertsys < expertsys.sql

Step 2: Configure Database

Edit koneksi.php:

$host     = "localhost";
$user     = "root";           # Your MySQL username
$password = "";               # Your MySQL password
$database = "expertsys";

Step 3: Upload Files

  • Copy all PHP and CSS files to your web directory
  • Create uploads/ folder: mkdir uploads && chmod 755 uploads

Step 4: Setup Images

Option A: Quick Sample Images

  1. Open create_sample_images.html in browser
  2. Download generated images
  3. 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

Step 5: Access System

  • 🌐 User Interface: http://your-domain/index.php
  • πŸ”§ Admin Panel: http://your-domain/admin_login.php
    • πŸ‘€ Username: admin
    • πŸ” Password: admin123

🎨 Design Highlights

Professional Styling System

/* Modern CSS Variables */
:root {
  --primary: #6C63FF;    /* Purple - Ectomorph */
  --secondary: #FF6584;  /* Pink - Mesomorph */
  --accent: #43CBFF;     /* Cyan - Endomorph */
  --dark: #2A2A3C;       /* Text */
  --light: #F8FAFC;      /* Background */
}

Layout Features

  • βœ… 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

Visual Somatotype System

Type Color Icon Characteristics
πŸƒβ€β™‚οΈ Ectomorph Purple #6C63FF Runner Thin, fast metabolism
πŸ’ͺ Mesomorph Pink #FF6584 Strong Athletic, muscular
πŸ€— Endomorph Cyan #43CBFF Rounded Fuller, slower metabolism

🧠 Expert System Logic

Certainty Factor Methodology

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)

Confidence Interpretation

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

Diagnostic Questions (18 Total)

G001: Apakah tubuh Anda cenderung kurus dan tinggi?
G002: Apakah lemak tubuh Anda rendah?
G003: Apakah Anda kesulitan menambah massa otot?
... (15 more questions)

πŸ”§ Admin Panel Features

Complete Database Management

πŸ“Š 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

Security & Safety

  • πŸ›‘οΈ 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

🍽️ Personalized Diet System

Ectomorph Recommendations

🎯 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

Mesomorph Recommendations

🎯 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

Endomorph Recommendations

🎯 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

πŸ“± Responsive Design System

Breakpoint Strategy

/* Desktop First Approach */
@media (max-width: 1024px) { /* Tablet */ }
@media (max-width: 640px)  { /* Mobile */ }

Device Optimizations

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

πŸ› οΈ Customization Guide

Adding New Somatotypes

  1. Database: Add new condition in admin panel
  2. Images: Add corresponding image to uploads/ folder
  3. CSS: Add new color scheme in style.css
  4. Logic: Update processing in proses.php

Modifying Questions

// 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

Changing Appearance

/* Custom color scheme */
:root {
  --primary: #YOUR_COLOR;     /* Primary somatotype */
  --secondary: #YOUR_COLOR;   /* Secondary somatotype */
  --accent: #YOUR_COLOR;      /* Accent somatotype */
}

🚨 Troubleshooting Guide

Database Issues

# 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;"

Image Loading Problems

# 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

Admin Access Issues

❌ "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

πŸ“Š System Requirements

Minimum Requirements

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

Browser Support

  • βœ… Chrome 90+
  • βœ… Firefox 88+
  • βœ… Safari 14+
  • βœ… Edge 90+
  • ❌ Internet Explorer (not supported)

πŸ”„ Advanced Features

API Endpoints (Future)

// 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

Analytics Integration

// Google Analytics example
gtag('event', 'diagnosis_completed', {
  'somatotype': result,
  'confidence': percentage,
  'questions_answered': count
});

πŸ“ž Support & Documentation

Quick Help

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

Development Resources

🎯 Performance Optimization

Database Optimization

-- 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);

Image Optimization

# Compress images for web
convert input.jpg -quality 85 -resize 400x400^ output.jpg

Caching Strategy

// 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
}

πŸ“„ License & Legal

Educational Use License

This software is created for educational and research purposes.
Not intended for commercial medical diagnosis.
Always consult healthcare professionals for medical advice.

Data Privacy

  • βœ… No personal data stored
  • βœ… Session-based results only
  • βœ… Admin data encrypted
  • βœ… GDPR considerations included

Medical Disclaimer

⚠️  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.

πŸŽ‰ Getting Started

For Users

  1. 🏠 Visit homepage (index.php)
  2. πŸ“‹ Complete 18-question survey
  3. πŸ–ΌοΈ View results with visual representation
  4. 🍽️ Get personalized diet recommendations

For Administrators

  1. πŸ” Login to admin panel (admin_login.php)
  2. πŸ“Š View system statistics
  3. πŸ”§ Manage questions, conditions, and rules
  4. πŸ“ˆ Monitor system performance

For Developers

  1. πŸ“š Review this documentation
  2. πŸ” Examine code structure
  3. πŸ› οΈ Customize for your needs
  4. πŸš€ 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

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages