diff --git a/README.md b/README.md index bcc365e..bf54fa8 100644 --- a/README.md +++ b/README.md @@ -1,344 +1,104 @@ -# WebGIS - Sistem Informasi Geografis untuk Pengentasan Kemiskinan +
+

πŸ—ΊοΈ WebGIS - Poverty Alleviation Information System

+

A Comprehensive Geographic Information System for Monitoring and Alleviating Poverty in Pontianak

-Aplikasi web berbasis map untuk visualisasi, manajemen, dan analisis data kemiskinan di wilayah Pontianak. + ![Application Screenshot](Screenshot.png) -## πŸš€ Quick Start +
-### Prerequisites -- PHP 7.4+ -- Web Browser (Chrome, Firefox, Edge) -- Git + ![PHP](https://img.shields.io/badge/PHP-7.4+-777BB4?style=flat-square&logo=php&logoColor=white) + ![MySQL](https://img.shields.io/badge/MySQL-Database-4479A1?style=flat-square&logo=mysql&logoColor=white) + ![Leaflet](https://img.shields.io/badge/Leaflet.js-Mapping-199900?style=flat-square&logo=leaflet&logoColor=white) + ![Vanilla JS](https://img.shields.io/badge/JavaScript-Vanilla-F7DF1E?style=flat-square&logo=javascript&logoColor=black) +
-### Installation +
-```bash -# 1. Clone or download repository -cd /workspaces/project92e4821824385 +## 🌟 Overview -# 2. Start PHP development server -php -S localhost:8000 +**WebGIS** is an interactive, map-based web application specifically designed to visualize, manage, and analyze poverty data within the Pontianak region. By utilizing spatial data and socioeconomic indicators, the platform empowers local authorities and agencies to track poverty distributions, score households based on their living conditions, and efficiently manage the delivery of assistance. -# 3. Open in browser -# Navigate to: http://localhost:8000 +## ✨ Key Features -# 4. Login with demo credentials -# Email: admin@system.local -# Password: admin123 -``` +### πŸ” Secure Role-Based Authentication +* **Role Management:** Tailored access for **Admin**, **Petugas** (Data Officer), and **Pimpinan** (Manager). +* **Robust Security:** Utilizes secure bcrypt password hashing and PHP session management with automatic timeouts. -## πŸ“‹ Features +### πŸ“Š Real-Time Analytics Dashboard +* **Dynamic KPIs:** Instantly view the total number of households, average poverty scores, and intervention rates. +* **Granular Breakdown:** Access priority rankings, verification statuses, and detailed area-wise statistics. -### βœ… Authentication & Access Control -- Role-based login system (Admin, Petugas, Pimpinan) -- Session management dengan automatic timeout -- Secure password hashing dengan bcrypt +### πŸ—ΊοΈ Advanced Spatial Data Management +* **Interactive Mapping:** Powered by **Leaflet.js**, featuring multiple togglable layers (Households, Roads, Parcels, Choropleth). +* **Intuitive Controls:** Drag-and-drop marker repositioning, advanced filtering, and point search functionalities. -### βœ… Dashboard Analytics -- Real-time KPI cards (total households, avg poverty score, assistance rate) -- Status breakdown (verification status) -- Priority ranking (intervention priority levels) -- Area-wise statistics breakdown +### πŸ“ Comprehensive Household Tracking +* **Detailed Records:** Register households with comprehensive poverty assessments (income, employment, housing conditions). +* **Automated Scoring:** The system automatically computes Socioeconomic Scores (SKR), Geographic Accessibility Scores (SAG), and Intervention Priority Scores (SPI). -### βœ… User Management (Admin Only) -- Create new users dengan role assignment -- Edit user roles -- Deactivate users (soft delete) -- User list dengan status indicators - -### βœ… Spatial Data Management -- Multi-layer interactive map dengan Leaflet.js -- Map layers: Points (households), Roads, Parcels, Choropleth (Pontianak areas) -- Drag-drop marker repositioning -- Point search dan filtering - -### βœ… Household Data -- Create household records dengan poverty assessment -- Income, employment status, housing condition tracking -- Household ranking by poverty score -- Verification status tracking - -### βœ… Poverty Scoring System -- Automatic computation of SKR (socioeconomic score) -- SAG (geographic accessibility score) -- SPI (intervention priority score) -- Priority level assignment (Very High β†’ Low) - -### βœ… Verification & Assistance Tracking -- Record field verification results -- Track assistance distribution (food, cash, health, education, etc.) -- Delivery status monitoring -- Evidence & confidence scoring - -### βœ… Export & Reporting -- GeoJSON export untuk spatial analysis -- Suitable untuk integration dengan GIS tools - -## 🎨 Technology Stack - -| Component | Technology | -|-----------|------------| -| **Frontend** | Vanilla HTML5, CSS3, JavaScript | -| **Map Library** | Leaflet.js (OpenStreetMap compatible) | -| **Backend** | PHP 7.4+ | -| **Database** | SQLite 3.0+ | -| **API** | RESTful JSON APIs | -| **Session** | PHP Sessions (cookie-based) | - -## πŸ“ Project Structure - -``` -project92e4821824385/ -β”œβ”€β”€ api/ # 40+ PHP endpoints -β”‚ β”œβ”€β”€ config.php # Database config & auth functions -β”‚ β”œβ”€β”€ login.php # Login endpoint -β”‚ β”œβ”€β”€ logout.php # Logout endpoint -β”‚ β”œβ”€β”€ get_users.php # User list -β”‚ β”œβ”€β”€ create_user.php # Create user -β”‚ β”œβ”€β”€ update_user.php # Update user role -β”‚ β”œβ”€β”€ delete_user.php # Deactivate user -β”‚ β”œβ”€β”€ get_dashboard_summary.php -β”‚ β”œβ”€β”€ get_area_breakdown.php -β”‚ └── ... (30+ more endpoints for spatial/household data) -β”‚ -β”œβ”€β”€ js/ -β”‚ └── app.js # Main application logic (~2300 lines) -β”‚ -β”œβ”€β”€ css/ -β”‚ └── style.css # Responsive styling -β”‚ -β”œβ”€β”€ db/ -β”‚ └── markers.db # SQLite database (auto-created) -β”‚ -β”œβ”€β”€ index.html # Main entry point -β”œβ”€β”€ API_REFERENCE.md # Detailed API documentation -β”œβ”€β”€ USER_GUIDE.md # User manual for all roles -β”œβ”€β”€ IMPLEMENTATION_SUMMARY.md # Tech stack & features -└── README.md # This file -``` - -## πŸ‘₯ User Roles & Permissions - -### Admin πŸ‘‘ -- Full system access -- User management (create, edit, delete) -- Data input and editing -- View analytics and dashboard -- Compute poverty scores - -### Petugas (Data Officer) πŸ“ -- Input/edit household data -- View map and statistics -- Verify households -- Record assistance distribution -- Cannot manage users - -### Pimpinan (Manager) πŸ‘” -- View-only dashboard access -- View priority rankings -- Cannot input or modify data - -## πŸ” Default Credentials - -``` -Email: admin@system.local -Password: admin123 -Role: Admin -``` - -## πŸ“– Documentation - -- **API Reference:** See `API_REFERENCE.md` for all endpoint Documentation -- **User Guide:** See `USER_GUIDE.md` for complete usage instructions -- **Implementation:** See `IMPLEMENTATION_SUMMARY.md` for technical details - -## πŸ—„οΈ Database - -### Auto-initialization -- Database schema automatically created on first run -- 11+ tables with proper relationships -- Indexes on performance-critical columns -- Cascade delete policies - -### Tables -- `users` - User accounts & authentication -- `households` - Family poverty data -- `household_scores` - SKR, SAG, SPI calculations -- `assistance_distributions` - Bantuan tracking -- `verification_logs` - Verification history -- `markers, roads, land_parcels` - Spatial data -- `pontianak_areas, area_statistics` - Administrative boundaries -- `masjids, need_points` - Location data -- `score_metadata` - Scoring configuration - -## πŸ”Œ API Endpoints (40+) - -### Authentication -- POST `/api/login.php` - Login -- POST `/api/logout.php` - Logout -- GET `/api/get_current_user.php` - Current user info - -### User Management (Admin) -- GET `/api/get_users.php` - List users -- POST `/api/create_user.php` - Create user -- PUT `/api/update_user.php` - Update role -- DELETE `/api/delete_user.php` - Deactivate user - -### Analytics -- GET `/api/get_dashboard_summary.php` - Dashboard KPIs -- GET `/api/get_area_breakdown.php` - Area statistics - -### Household Management -- POST `/api/save_household.php` - Create household -- GET `/api/get_households.php` - List households -- PUT `/api/update_household.php` - Update household -- DELETE `/api/delete_household.php` - Delete household -- POST `/api/compute_household_scores.php` - Compute scores -- GET `/api/get_household_ranking.php` - Priority ranking - -### Verification & Assistance -- POST `/api/save_verification_log.php` - Record verification -- GET `/api/get_verification_logs.php` - Verification history -- POST `/api/save_assistance_distribution.php` - Record assistance -- GET `/api/get_assistance_distributions.php` - Assistance history - -### Spatial Data (20+) -- Points, Roads, Parcels, Pontianak Areas (CRUD operations) -- Choropleth data aggregation -- GeoJSON export - -## βš™οΈ Configuration - -### Server Requirements -- PHP 7.4 or higher -- Web server (Apache, Nginx, phpd built-in) -- Write permissions for `/db/` folder - -### Optional Production Setup -- Set up HTTPS/SSL certificate -- Configure proper session timeout -- Set up automated backups -- Enable database WAL mode for concurrency - -## πŸš€ Production Deployment - -### Using Apache -```apache - - ServerName system.local - DocumentRoot /var/www/project - - AllowOverride All - Require all granted - - -``` - -### Using Nginx -```nginx -server { - listen 80; - server_name system.local; - root /var/www/project; - - location ~\.php$ { - fastcgi_pass 127.0.0.1:9000; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } -} -``` - -## πŸ“Š Performance - -- **Page Load:** < 3 seconds (on 10 Mbps connection) -- **API Response:** < 500ms for most endpoints -- **Map Rendering:** Real-time interactivity -- **Scoring Computation:** < 1 second for 100 households - -## πŸ› οΈ Development Guide - -### Adding New Endpoint -1. Create new file in `/api/` folder: `your_endpoint.php` -2. Include `config.php` for database access -3. Use `requireLogin()` or `requireRole()` for access control -4. Return JSON response - -Example: -```php - true, 'data' => $result])); -?> -``` - -### Modifying Frontend -1. Edit `js/app.js` for logic changes -2. Edit `css/style.css` for styling -3. Edit `index.html` for structure/layout -4. Refresh browser to see changes (no build required) - -## πŸ› Troubleshooting - -### Login Issues -- Verify email: `admin@system.local` -- Verify password: `admin123` -- Check browser cookies are enabled -- Clear cache and try again - -### Map Not Loading -- Check browser console for errors (F12) -- Verify internet connection (for Leaflet CDN) -- Try refreshing page - -### Database Issues -- Ensure `/db/` folder has write permissions -- Check PHP error logs -- Delete `db/markers.db` to reset (will lose data) - -### Performance Issues -- Check browser performance (F12 > Performance tab) -- Monitor server CPU/memory usage -- Consider adding pagination for large datasets - -## πŸ“ Changelog - -### Version 1.0 (May 2026) -- βœ… Complete authentication system -- βœ… Dashboard with real-time analytics -- βœ… User management for admins -- βœ… Household data management with scoring -- βœ… Interactive Leaflet map -- βœ… Verification and assistance tracking -- βœ… GeoJSON export capability -- βœ… Comprehensive API (40+ endpoints) -- βœ… User guide and API documentation - -## πŸ“ž Support - -For issues, questions, or feature requests: -1. Check documentation in `USER_GUIDE.md` -2. Review API documentation in `API_REFERENCE.md` -3. Check browser console for error messages -4. Contact system administrator - -## πŸ“œ License - -Academic Project - Universitas Tanjungpura -Mata Kuliah: Sistem Informasi Geografis -Dosen: Dr. Ir. Yus Sholva, ST., MT. - -## πŸ‘¨β€πŸ’» Authors - -**Frederick Ferdyand Halim** - Developer -Semester Genap 2024/2025 +### 🎯 Verification & Assistance Monitoring +* **Field Verification:** Seamlessly record and track verification results from field officers. +* **Assistance Logistics:** Monitor the distribution of food, cash, health, and educational assistance with evidence tracking. --- -**Last Updated:** 9 Mei 2026 -**Status:** Production Ready v1.0 \ No newline at end of file +## πŸš€ Quick Start Guide + +### Prerequisites +* **PHP 7.4+** +* **MySQL Database** (Local server like XAMPP/Laragon or remote hosting) +* Modern Web Browser (Chrome, Firefox, Edge, Safari) + +### Installation & Setup + +1. **Clone or Download the Repository:** + ```bash + git clone https://github.com/yourusername/webgis-pontianak.git + cd webgis-pontianak + ``` + +2. **Database Configuration:** + * Import `mysql_schema.sql` into your MySQL server. + * Open `api/config.php` and update the database credentials to match your environment: + ```php + define('DB_HOST', 'localhost'); + define('DB_NAME', 'your_database_name'); + define('DB_USER', 'your_username'); + define('DB_PASS', 'your_password'); + ``` + +3. **Launch the Application:** + * You can serve the application using a tool like XAMPP, or use PHP's built-in development server: + ```bash + php -S localhost:8000 + ``` + * Open your browser and navigate to `http://localhost:8000`. + +4. **Default Login Credentials:** + * **Email:** `admin@system.local` + * **Password:** `admin123` + +--- + +## πŸ—οΈ System Architecture + +The application follows a clean, decoupled architecture: + +| Component | Technology | Description | +|-----------|------------|-------------| +| **Frontend** | HTML5, CSS3, JavaScript | Pure Vanilla JS for maximum performance and minimum dependency bloat. | +| **Maps** | Leaflet.js | OpenStreetMap-compatible library for robust spatial rendering. | +| **Backend** | PHP 7.4+ | Modular RESTful JSON APIs handling business logic. | +| **Database** | MySQL | Highly relational schema with foreign key constraints and geospatial awareness. | + +--- + +## πŸ—„οΈ Database Structure + +The MySQL database initializes automatically and features a normalized 11-table schema, including: +* `users`: Authentication and role definitions. +* `households` & `household_scores`: Core poverty data and computed intervention scores. +* `assistance_distributions` & `verification_logs`: Audit trails for field operations. +* `markers`, `roads`, `land_parcels`, `pontianak_areas`: Spatial and geospatial boundary data. + +--- \ No newline at end of file diff --git a/Screenshot.png b/Screenshot.png new file mode 100644 index 0000000..8655497 Binary files /dev/null and b/Screenshot.png differ