Skip to content

Software Architecture & Design

Hannah S edited this page Jun 30, 2024 · 5 revisions

This section outlines the architectural design and layered structure of the web application, providing an overview of the components and their interactions.

Architecture

Archtichture
  • Client Layer

    The Client Layer encompasses the user interfaces and client-side components that interact with the application. This layer includes desktop and mobile browsers, catering to a wide range of devices and platforms. Users, whether guests or registered, interact with the application through this layer, accessing features such as filling out questionnaires, viewing questionnaire history (for registered users), and potentially making donations.

  • Access Layer

    The Access Layer acts as an intermediary between the Client Layer and the Service Layer. It handles the communication between the client-side components and the application's core functionality. This layer is responsible for routing requests, enforcing access controls, and ensuring secure data transmission. Only supporting Chrome and Edge - two similar chromium based browsers.

  • Service Layer

    The Service Layer encapsulates the application's business logic and core functionalities. It processes requests from the Access Layer and interacts with the Database Layer to retrieve or persist data as needed. The Service Layer includes modules for various features, such as:

    • Fill Questionnaire: Handles the logic for presenting questionnaires to users, calculating scores, and saving responses.
    • View Questionnaire History: Manages the retrieval and display of completed questionnaire history and scores for registered users.
    • User Management: Handles user authentication, registration, and account management functionalities.
    • Content Management: Provides interfaces for admins to manage and update website content, such as posts or information pages.
    • Donation Management: Facilitates the donation process, including payment processing and record-keeping.
    • Questionnaire Management: Allows admins to create, modify, and remove questionnaires, as well as generate statistical reports based on questionnaire data.
  • Database Layer

    The Database Layer is responsible for persisting and retrieving data for the application. In this architecture, Firebase is utilized as the database solution. This layer interacts with the Service Layer to store and retrieve data as required by the various application functionalities, such as user accounts, questionnaire responses, donation records, and content management data.

Database Design

SW-Design

The database is implemented using Firebase, a NoSQL document-based database service.

  • Users Collection

    The users collection stores user account information, including email, hashed password, name, role (admin or user), and the account creation timestamp. Each user document is identified by a unique user_id.

  • Donations Collection

    The donations collection keeps track of donation records made. Each donation document includes a unique donation_id, the donation amount, and the timestamp of the donation.

  • Posts Collection

    The posts collection stores website content and information posts created by admins. Each post document contains a unique post_id, title, content, author_id (referencing the users collection for the author), and timestamps for creation and last update.

  • User Questionnaire History (Subcollection)

    The user_questionnaire_history is a subcollection nested under each user document in the users collection. It stores the history of questionnaires filled out by the user. Each document in this subcollection represents an instance of a completed questionnaire and includes a unique history_id, the questionnaire_id (referencing the questionnaires collection), the calculated score, and the timestamp when the questionnaire was filled out.

  • Questionnaires Collection

    The questionnaires collection contains the questionnaire data. If there is only one questionnaire, it will be stored as a single document. Each questionnaire document includes a unique questionnaire_id (or a fixed ID like default_questionnaire), a title, an array of questions (each question object contains properties like question_id, question_text, question_type, etc.), and a timestamp for the last update.

  • Questionnaire Responses Collection

    The questionnaire_responses collection stores user responses to the questionnaires. Each document represents a user's response and includes a unique response_id, the user_id (referencing the users collection), the questionnaire_id, an array of responses (each response object contains the question_id and the user's answer), the calculated score, and the timestamp of the response submission.

Clone this wiki locally