8000 GitHub - YuKARLO15/ProjectSCARS: Department of Education's School Canteen Automated Reporting System
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Department of Education's School Canteen Automated Reporting System

Notifications You must be signed in to change notification settings

YuKARLO15/ProjectSCARS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bento Logo

Bento

GitHub Last Commit GitHub Issues or Pull Requests Linter Results Code Coverage GitHub Repository Size Project Milestone Progress

Bento is a School Canteen Automated Reporting System for the Department of Education (DepEd) Schools Division Office (SDO) of the City of Baliwag in the Philippines.

Why Bento?

"A bento is a Japanese-style single-portion take-out or home-packed meal, often for lunch, typically including rice and packaged in a box with a lid. The term bento is derived from the Chinese term biandang, which means "convenient" or "convenience"."

- Wikipedia

Component Open Issues Last Commit Test Results Code Coverage
Central Server GitHub Issues or Pull Requests by label GitHub last commit Central Server Tests Central Server Code Coverage
Web Client GitHub Issues or Pull Requests by label GitHub last commit Web Client Tests Web Client Code Coverage
Code Coverage Graph Code Coverage Graph

The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.

Development

Stacks

Component Stack
Central Server Central Server Stack
Web Client Web Client Stack

Central Server

The central server is written in Python using the FastAPI framework and utilizes SQLite or MySQL as its database, depending on the selected configuration. It also uses either a pure-Python file object storage or a third-party S3-compatible object storage for storing user avatars and exported PDFs. It is responsible for handling the backend logic and storing the submitted data of canteen managers.

Central Server Requirements

The hard requirements are as follows:

Central Server Development Setup
  1. Install the required software.

  2. Clone the repository.

    git clone https://github.com/Chris1320/ProjectSCARS.git
  3. Navigate to the CentralServer directory.

    cd ProjectSCARS/CentralServer
  4. Install dependencies.

    uv sync
  5. Copy and edit the configuration file.

    cp .config.example.json config.json
    uv run ./scripts/secret.py sign     # Generate secure secret keys
    uv run ./scripts/secret.py encrypt  # and write it to `config.json`
    uv run ./scripts/secret.py refresh

    Edit the config.json file to their appropriate values.

  6. Select the database you want to use. See Database Setup for more information.

  7. Select the object store you want to use. See Object Store Setup for more information.

  8. Run the FastAPI development server.

    uv run fastapi dev centralserver --host 0.0.0.0 --port 8081

Important

The default credentials are:

  • username: scars
  • password: ProjectSCARS1
Central Server Database Setup

The central server supports the following databases:

  • SQLite (default)
  • MySQL

Central Server SQLite Database

To start using SQLite, just edit ./CentralServer/config.json and adjust the database property to use SQLite. The connect_args property is optional and can be used to pass additional SQLAlchemy connection arguments.

{
  /* ... */
  "database": {
    "type": "sqlite",
    "config": {
      "filepath": "database.db",
      "connect_args": {
        // SQLAlchemy connection arguments
      },
    },
  },
  /* ... */
}

On startup, the central server will create a SQLite database file in the file path specified in the filepath property. The default is centralserver.db in the root directory of the central server.

This database is sufficient for development and testing purposes, but for production use, it is recommended to use MySQL or similar database server.

Central Server MySQL Database

Since SQLite is a file-based database and lacks the ability to run multiple instances, it is not suitable for production use which needs high throughput and availability. Therefore, the central server also supports MySQL as a database. The MySQL database can be run in a containerized environment using Docker or Podman.

  1. Create a .env file in ./CentralServer/system/mysql/ using the example file.

    cd ./system/mysql/
    cp .env.example .env
  2. Adjust the environment variables in ./CentralServer/system/mysql/.env. For more information about MySQL Docker environment variables, see their documentation.

  3. Run the MySQL container.

    docker-compose up -d # Run this if you are using Docker.
    podman-compose up -d # Run this if you are using Podman.
    cd ../..
  4. If successful, you should be able to access PHPMyAdmin at http://localhost:8083.

Important

You might need to log in as the root user in the database in the future. The root password is randomly generated, which can be seen in the logs of the MySQL container with the following format:

[Note] [Entrypoint]: GENERATED ROOT PASSWORD: bfPy...lqLL

  1. Update ./CentralServer/config.json to use MySQL. Use the same database credentials as the ones in the .env file. The connect_args property is optional and can be used to pass additional SQLAlchemy connection arguments.

    {
      /* ... */
      "database": {
        "type": "mysql",
        "config": {
          "username": "ProjectSCARS_DatabaseAdmin",
          "password": "ProjectSCARS_mysql143",
          "host": "localhost",
          "port": 3306,
          "database": "ProjectSCARS_CentralServer",
          "connect_args": {
            // sqlalchemy connection arguments
          },
        },
      },
      /* ... */
    }
Central Server Object Store Setup

The central server supports the following object stores:

  • Local file object store (default)
  • MinIO S3-compatible object store

Local File Object Store

To start using the local file object store, just edit ./CentralServer/config.json and adjust the object_store property to match the following structure:

{
  /* ... */
  "object_store": {
    "type": "local",
    "config": {
      "filepath": "./data/",
    },
  },
  /* ... */
}

When the central server starts, it will use the provided filepath to store the files (objects). Make sure that the filepath is writable by the server. The default is ./data/ in the root directory of the central server. It is already created in the repository, so no further action is needed.

Because the local file object store is implemented in the central server itself, it does not provide any integrity and redundancy systems. Therefore, it is recommended to use a dedicated object store for production use, and use the local file object store only for development purposes.

MinIO S3-Compatible Object Store

Using MinIO, it is possible to provide multiple nodes to store the objects. This is useful for redundancy and high availability, therefore it is recommended to be used in production. The MinIO object store can be run in a containerized environment using Docker or Podman.

  1. Create a .env file in ./CentralServer/system/minio/ using the example file.

    cd ./system/minio/
    cp .env.example .env
  2. Adjust the environment variables in ./CentralServer/system/minio/.env.

  3. Run the MinIO container.

    docker-compose up -d # Run this if you are using Docker.
    podman-compose up -d # Run this if you are using Podman.
    cd ../..
  4. If successful, you should be able to access the MinIO dashboard at http://localhost:8084.

  5. Log in to the dashboard using the credentials in the .env file.

  6. Navigate to the Access Keys tab and create a new access key. Make sure to copy the keys, as they will not be shown again.

  7. Edit ./CentralServer/config.json and adjust the object_store to match the following structure:

    {
      /* ... */
      "object_store": {
        "type": "minio",
        "config": {
          "endpoint": "localhost:9000",
          "access_key": "YOUR_ACCESS_KEY",
          "secret_key": "YOUR_SECRET_KEY",
          "secure": false,
        },
      },
      /* ... */
    }
Central Server Environment Variables

The following environment variables are used by the central server to further configure its behavior. These variables are optional.

Environment Variable Value Description
CENTRAL_SERVER_CONFIG_FILE ./config.json The path of the configuration file to use.
CENTRAL_SERVER_CONFIG_ENCODING utf-8 The encoding of the configuration file.

Web Client

The web client is written in TypeScript using the Next.js framework. It is the user-facing application that allows canteen managers to submit their monthly financial reports to the central server. The web client also optionally communicates with the local server to provide inventory and sales functionality.

Web Client Requirements

The web client is written in TypeScript v5, and is run via NodeJS v23.6.0.

Web Client Development Setup
  1. Install the required software.

  2. Clone the repository.

    git clone https://github.com/Chris1320/ProjectSCARS.git
  3. Navigate to the WebClient directory.

    cd ProjectSCARS/WebClient
  4. Install dependencies.

    npm install
  5. Run the development server.

    npm run dev

Important

Look at the central server and local server documentation for the default credentials.


Authors

Kirito090504 user profile Staber07 user profile arabelaramos user profile Chris1320 user profile

Kirito090504

Staber07

arabelaramos

Chris1320

BS Computer Science

BS Information Technology

BS Computer Science

BS Computer Science

About

Department of Education's School Canteen Automated Reporting System

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 82.8%
  • TypeScript 14.7%
  • JavaScript 1.3%
  • CSS 1.2%
0