How anhkhoa24/ahp works
Project Type and Purpose
• This is a decision support system that uses the Analytic Hierarchy Process (AHP) to help users compare and choose schools and majors.
• The system is split into two primary parts: a backend API written in Python (using Flask or FastAPI) that performs the AHP calculations, and a frontend UI built with HTML, jQuery, and Bootstrap that collects user input and displays the results.
Key Components
a. Frontend (UI):
• Contains static assets such as HTML (index.html), CSS (style.css), and JavaScript files (script.js, bosung.js, broaden.js).
• Responsible for capturing user inputs (such as pairwise comparisons) and displaying results (like ranking lists or charts).
b. Backend:
• Consists of Python scripts located in the “BackEnd” directory.
• Main modules include:
• API.py: Likely responsible for creating the API endpoints, such as the POST /calculate-ahp endpoint.
• AHP.py: Contains the logic for the AHP computations (matrix normalization, calculating criteria weights, consistency checks, etc.).
• ham.py: Possibly supporting or alternative functionality (perhaps a helper module for additional AHP calculations or utility functions).
• The backend implements the core AHP logic and exposes it via a REST API to the frontend.
c. (Potential Future Component) Database:
• Although in the README the database is not yet updated, mention that a database component might be added later for persistent storage.
Relationships and Interactions
• The UI sends an HTTP POST request (e.g., to /calculate-ahp) with the user’s pairwise comparison data.
• The backend receives this request, processes the data using its AHP computation modules, and returns the results to the UI.
• User (within the browser) → UI → Backend API.
• Backend API → Computation Modules (AHP.py, ham.py) for processing.
• Backend API → UI (returning the calculated results).
Architectural Patterns & Design Principles
• Separation of concerns: clearly separate the “Frontend” from the “Backend” responsibilities.
• API-driven design: the backend exposes RESTful endpoints to handle computation.
• Modularity: Different backend modules (AHP.py, API.py, ham.py) encapsulate distinct aspects of the AHP calculation process.