How rizki-habibi/fitur-spk-wp-dan-saw works
1. Overall shape
- This is a Laravel 12 monolith for a decision-support system (SPK) focused on scholarship selection.
- The core domain is multi-project SPK data: each project owns its own criteria, alternatives, and assessments, and the app always works within one “active” project context.
2. Primary domain boundary: active project isolation
- Proyek is the top-level container for all decision data.
- A HasActiveProyek controller trait suggests the active project is stored in session and reused across CRUD, calculation, report, and AI flows.
- Architecturally, this means almost every read/write path is scoped by proyek_id, so project selection is a key boundary in the system.
3. Core data model
- Kriteria, Alternatif, and Penilaian form the main decision matrix.
- Kriteria stores weight, type (benefit / cost), and metadata.
- Alternatif stores candidate identity data.
- Penilaian is the many-to-many scoring table between alternatives and criteria, with a uniqueness rule per pair.
- The models and migrations show a normalized relational design rather than denormalized spreadsheet-style storage.
4. Decision engine subsystem
- The calculation logic is separated into SAWService and WeightedProductService.
- PerhitunganController is the orchestration layer that loads project data, invokes the appropriate service, and passes ranked results to views.
- This is the main business-logic boundary: controllers manage request/response, services encapsulate the mathematical methods.
5. SAW and WP data flow
- Both methods consume the same underlying dataset: criteria weights/types plus the assessment matrix.
- SAW normalizes each criterion column, then computes weighted sums.
- WP normalizes weights, applies exponentiation by criterion type, then multiplies and normalizes the resulting scores.
- The repository is structured so the same input data can produce two independent rankings for comparison.
6. User-facing CRUD layer
- KriteriaController, AlternatifController, PenilaianController, and ProyekController handle the main data-entry workflows.
- The corresponding Blade views are organized by feature area, which indicates a classic server-rendered Laravel UI rather than an SPA.
- The UX emphasizes modal-based CRUD and bulk matrix entry, which fits the decision-support workflow.
7. Dashboard, reports, and comparison views
- DashboardController, LaporanController, and PerhitunganController provide the analytical views.
- The dashboard likely summarizes counts, completeness, and top-ranked results; reports present full method outputs and comparison tables.
- This layer is read-heavy and consumes the computed results from the service layer rather than recomputing business rules inline.
8. Import/export subsystem
- ExcelController is the integration boundary for spreadsheet import/export and Word export.
- Export concerns are split into dedicated classes under app/Exports, including an “all-in-one” workbook and per-domain exports.
- The sheet classes under app/Exports/Sheets indicate a compositional Excel architecture: separate worksheets for criteria, alternatives, assessment data, comparison, and formula-based SAW/WP outputs.
- Imports are similarly separated into AlternatifImport and KriteriaImport, keeping file parsing outside controllers.
9. AI assistant subsystem
- AiController exposes chat and “generate all” endpoints.
- AiProvider suggests provider selection is modeled in the database, not hardcoded.
- The README shows multi-provider support across Groq, GitHub Models, OpenRouter, and Gemini, with auto-detection from API key format.
- Architecturally, AI is an auxiliary service boundary that can generate or explain data, but it does not replace the core calculation engine.
10. Visualization and guidance
- FlowchartController and PanduanController serve educational/illustrative pages for method flow and formula explanation.
- These are documentation-oriented subsystems inside the app, supporting user understanding of the SAW/WP process rather than data manipulation.
- app/Http/Controllers/AiController.php and these guidance pages together show the product is both operational and instructional.
11. Frontend and rendering model
- Views are Blade templates under resources/views, with a shared layout in layouts/app.blade.php.
- Styling and client behavior are built with Bootstrap 5, Bootstrap Icons, and Vite-managed assets (resources/css, resources/js).
- The UI features described in the README—dark mode, settings panel, reminders, shortcuts—live in the frontend layer and persist via browser storage, separate from the Laravel domain logic.
12. Operational and tooling boundaries
- The app uses standard Laravel infrastructure: config/*, routes/web.php, database/migrations, seeders, and tests.
- Excel/Word generation depends on PhpSpreadsheet / PhpWord, with a patch file indicating a local customization to spreadsheet behavior.
- Overall architecture is a single web application with clear internal module boundaries: project-scoped domain data, calculation services, export/import adapters, AI integration, and server-rendered presentation.
Main entry points: web.php Web routes · views Blade UI · PenilaianController.php Assessment entry · Exports Exports
Components 21
Domain
Project-scoped decision data and models
- Proyek · Active project container for all decision data
app/Models/Proyek.php - Kriteria · Criteria with weights and benefit/cost type
app/Models/Kriteria.php - Alternatif · Candidate alternatives in a project
app/Models/Alternatif.php - Penilaian · Assessment matrix linking alternatives and criteria
app/Models/Penilaian.php
Application
Controllers, traits, and calculation services
- Active project · Session-backed active project scoping
app/Http/Controllers/Traits/HasActiveProyek.php - Project CRUD · Project management and selection flow
app/Http/Controllers/ProyekController.php - Criteria CRUD · Criteria entry and maintenance
app/Http/Controllers/KriteriaController.php - Alternative CRUD · Alternative entry and maintenance
app/Http/Controllers/AlternatifController.php - Assessment entry · Matrix-style scoring workflow
app/Http/Controllers/PenilaianController.php - Calculation · Orchestrates ranking and comparison outputs
app/Http/Controllers/PerhitunganController.php - SAW service · Simple Additive Weighting calculations
app/Services/SAWService.php - WP service · Weighted Product calculations
app/Services/WeightedProductService.php - Dashboard · Summary and status overview
app/Http/Controllers/DashboardController.php - Reports · Read-heavy analytical report views
app/Http/Controllers/LaporanController.php - Web routes · HTTP entrypoints for the monolith
routes/web.php
Integration
Import/export and AI boundaries
- Excel export · Spreadsheet and Word import/export boundary
app/Http/Controllers/ExcelController.php - AI assistant · Chat and generation endpoints
app/Http/Controllers/AiController.php - AI provider · Persisted provider selection and metadata
app/Models/AiProvider.php - Exports · Workbook and document generators
app/Exports - Imports · Spreadsheet parsers for bulk data load
app/Imports
Presentation
Blade views and UI pages
- Blade UI · Server-rendered feature pages and layouts
resources/views
Connections 48
- Web routes → Project CRUD: routes · Maps project pages and actions
- Web routes → Criteria CRUD: routes · Maps criteria pages and actions
- Web routes → Alternative CRUD: routes · Maps alternative pages and actions
- Web routes → Assessment entry: routes · Maps assessment matrix pages and actions
- Web routes → Calculation: routes · Maps calculation views
- Web routes → Dashboard: routes · Maps dashboard view
- Web routes → Reports: routes · Maps reporting views
- Web routes → Excel export: routes · Maps import/export endpoints
- Web routes → AI assistant: routes · Maps AI endpoints
- Project CRUD → Active project: uses · Reads and sets active project context
- Criteria CRUD → Active project: uses · Scopes criteria to active project
- Alternative CRUD → Active project: uses · Scopes alternatives to active project
- Assessment entry → Active project: uses · Scopes assessments to active project
- Calculation → Active project: uses · Loads data for the active project only
- Dashboard → Active project: uses · Summarizes the active project
- Reports → Active project: uses · Builds reports for the active project
- Assessment entry → Penilaian: writes · Stores pairwise scores
- Assessment entry → Alternatif: reads · Needs alternatives for matrix entry
- Assessment entry → Kriteria: reads · Needs criteria for matrix entry
- Criteria CRUD → Kriteria: writes · Creates and updates criteria
- Alternative CRUD → Alternatif: writes · Creates and updates alternatives
- Project CRUD → Proyek: writes · Creates and updates projects
- Calculation → SAW service: calls · Runs SAW ranking
- Calculation → WP service: calls · Runs WP ranking
- SAW service → Kriteria: reads · Consumes criteria weights and types
- SAW service → Alternatif: reads · Consumes candidate alternatives
- SAW service → Penilaian: reads · Consumes score matrix
- WP service → Kriteria: reads · Consumes criteria weights and types
- WP service → Alternatif: reads · Consumes candidate alternatives
- WP service → Penilaian: reads · Consumes score matrix
- Excel export → Exports: uses · Generates spreadsheets and documents
- Excel export → Imports: uses · Parses uploaded spreadsheets
- Exports → Kriteria: includes · Exports criteria data
- Exports → Alternatif: includes · Exports alternatives data
- Exports → Penilaian: includes · Exports assessment matrix
- Exports → SAW service: includes · Exports SAW results and formulas
- Exports → WP service: includes · Exports WP results and formulas
- Imports → Kriteria: loads · Imports criteria data
- Imports → Alternatif: loads · Imports alternatives data
- AI assistant → AI provider: uses · Selects or stores provider metadata
- AI assistant → Blade UI: renders · Serves chat and module pages
- Dashboard → Blade UI: renders · Serves dashboard UI
- Reports → Blade UI: renders · Serves report UI
- Calculation → Blade UI: renders · Serves comparison and ranking UI
- Project CRUD → Blade UI: renders · Serves project UI
- Criteria CRUD → Blade UI: renders · Serves criteria UI
- Alternative CRUD → Blade UI: renders · Serves alternative UI
- Assessment entry → Blade UI: renders · Serves assessment UI