Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

name: "🎉 SISmanager CI Carnival 🎉"

on:
push:
branches: [ "main" ]
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- name: 🚦 Linting Time! 🚦
run: |
echo -e "\033[1;35mLet's get linty!\033[0m"
bash lint.sh check

test:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- name: 🧪 Test Parade! 🧪
run: |
echo -e "\033[1;36mRunning the test parade!\033[0m"
bash test.sh
Comment thread
fedem-p marked this conversation as resolved.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ venv.bak/
*.log

# Data
/data/results/
/data

22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# syntax=docker/dockerfile:1
FROM python:3.10-slim

WORKDIR /app

# Install Poetry
RUN pip install poetry

# Copy only the dependency files first for caching
COPY pyproject.toml poetry.lock ./

# Install dependencies
RUN poetry install --no-interaction --no-ansi --no-root

# Copy the rest of the code
COPY . .

# Expose Flask port
EXPOSE 5000

# Run the app
CMD ["poetry", "run", "python3", "run.py"]
72 changes: 56 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,22 +227,60 @@ poetry run mypy src/ tests/ # Type checking

```
SISmanager/
├── src/ # Source code
│ ├── central_db_repository.py # Database operations
│ ├── xlsx_importer.py # XLSX import logic
│ ├── backup.py # Backup management
│ ├── config.py # Configuration & logging
│ └── run_xlsx_to_centraldb.py # Example script
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── fixtures/ # Test data
├── data/ # Data directory
│ └── backups/ # Backup files
├── docker-compose.yml # Docker configuration
├── pyproject.toml # Poetry configuration
├── lint.sh # Linting script
└── README.md # This file
├── pyproject.toml
├── poetry.lock
├── run.py # Application entry point (create this if missing)
├── config.py # Configuration
├── sismanager/ # Main package
│ ├── __init__.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── student.py
│ │ ├── part.py
│ │ └── money.py
│ ├── blueprints/
│ │ ├── __init__.py
│ │ ├── main/
│ │ │ ├── __init__.py
│ │ │ ├── routes.py
│ │ │ └── templates/
│ │ ├── importer/
│ │ │ ├── __init__.py
│ │ │ ├── routes.py
│ │ │ ├── forms.py
│ │ │ └── templates/
│ │ ├── calendar/
│ │ ├── materials/
│ │ └── money/
│ ├── services/
│ │ ├── __init__.py
│ │ ├── csv_service.py
│ │ ├── backup_service.py
│ │ └── import_service.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── validators.py
│ │ └── helpers.py
│ ├── static/
│ │ ├── css/
│ │ ├── js/
│ │ └── img/
│ └── templates/
│ └── base.html
├── data/
│ ├── central_db.csv
│ ├── backups/
├── tests/
│ ├── __init__.py
│ ├── conftest.py
│ ├── fixtures/
│ ├── integration/
│ └── unit/
├── deployment/
│ ├── windows/
│ └── docker/
└── scripts/ # (optional, for CLI/test scripts)
└── run_xlsx_to_centraldb.py
```

### Contributing
Expand Down Expand Up @@ -323,3 +361,5 @@ For questions or issues, please:
1. Check the troubleshooting section above
2. Review existing issues in the repository
3. Create a new issue with detailed information about your problem


12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
sismanager:
build: .
container_name: sismanager
ports:
- "5000:5000"
environment:
- FLASK_ENV=development
- PYTHONUNBUFFERED=1
volumes:
- .:/app
command: poetry run python run.py
16 changes: 12 additions & 4 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@

set -e

# Format code with black
poetry run black src/ tests/

MODE=${1:-fix}

if [ "$MODE" = "check" ]; then
# Check code formatting with black (no changes)
poetry run black --check sismanager/ tests/
else
# Format code with black
poetry run black sismanager/ tests/
fi

# Run pylint for code quality
poetry run pylint src/ tests/
poetry run pylint sismanager/

# Run mypy for type checking
poetry run mypy src/ tests/
poetry run mypy sismanager/
6 changes: 6 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from sismanager import create_app

app = create_app()

if __name__ == "__main__":
app.run(debug=True,host="0.0.0.0")
Comment thread
fedem-p marked this conversation as resolved.
25 changes: 25 additions & 0 deletions sismanager/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
SISmanager Flask application factory.
"""

from flask import Flask

# Import and register blueprints
from sismanager.blueprints.main.routes import main_bp
from sismanager.blueprints.importer.routes import importer_bp
from sismanager.blueprints.calendar.routes import calendar_bp
from sismanager.blueprints.materials.routes import materials_bp
from sismanager.blueprints.money.routes import money_bp


def create_app():
"""Create and configure the Flask application."""
app = Flask(__name__)

app.register_blueprint(main_bp)
app.register_blueprint(importer_bp)
app.register_blueprint(calendar_bp)
app.register_blueprint(materials_bp)
app.register_blueprint(money_bp)

return app
File renamed without changes.
1 change: 1 addition & 0 deletions sismanager/blueprints/calendar/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Calendar blueprint package
15 changes: 15 additions & 0 deletions sismanager/blueprints/calendar/routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Routes for calendar blueprint in SISmanager.
"""

from flask import Blueprint, render_template

calendar_bp = Blueprint(
"calendar", __name__, template_folder="../../templates/calendar"
)


@calendar_bp.route("/calendar")
def calendar():
"""Render the calendar page."""
return render_template("calendar/calendar.html")
1 change: 1 addition & 0 deletions sismanager/blueprints/importer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Importer blueprint package
15 changes: 15 additions & 0 deletions sismanager/blueprints/importer/routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Routes for importer blueprint in SISmanager.
"""

from flask import Blueprint, render_template

importer_bp = Blueprint(
"importer", __name__, template_folder="../../templates/importer"
)


@importer_bp.route("/importer")
def importer():
"""Render the importer page."""
return render_template("importer/importer.html")
1 change: 1 addition & 0 deletions sismanager/blueprints/main/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Main blueprint package for dashboard home and navbar
13 changes: 13 additions & 0 deletions sismanager/blueprints/main/routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
Routes for main blueprint in SISmanager.
"""

from flask import Blueprint, render_template

main_bp = Blueprint("main", __name__, template_folder="../../templates/main")


@main_bp.route("/")
def home():
"""Render the home page."""
return render_template("main/home.html")
Empty file.
1 change: 1 addition & 0 deletions sismanager/blueprints/materials/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Parts organizer blueprint package
15 changes: 15 additions & 0 deletions sismanager/blueprints/materials/routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Routes for materials blueprint in SISmanager.
"""

from flask import Blueprint, render_template

materials_bp = Blueprint(
"materials", __name__, template_folder="../../templates/materials"
)


@materials_bp.route("/materials")
def materials():
"""Render the materials page."""
return render_template("materials/materials.html")
1 change: 1 addition & 0 deletions sismanager/blueprints/money/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Money management blueprint package
13 changes: 13 additions & 0 deletions sismanager/blueprints/money/routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
Routes for money blueprint in SISmanager.
"""

from flask import Blueprint, render_template

money_bp = Blueprint("money", __name__, template_folder="../../templates/money")


@money_bp.route("/money")
def money():
"""Render the money page."""
return render_template("money/money.html")
File renamed without changes.
Empty file added sismanager/models/__init__.py
Empty file.
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""Script to run XLSX import, backup cleanup, deduplication, and export for SISmanager."""

import sys
import os
from .xlsx_importer import XLSXImporter
from .backup import BackupManager

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
from sismanager.services.inout.xlsx_importer_service import XLSXImporter
from sismanager.services.inout.backup_service import BackupManager

if __name__ == "__main__":
# Path to the sample XLSX file in the data directory
xlsx_path = os.path.join(os.path.dirname(__file__), "..", "data", "data.xlsx")
xlsx_path = os.path.join(os.path.dirname(__file__), "../..", "data", "data.xlsx")
# Example: keep only specific columns
COLUMNS_TO_KEEP = None # e.g., ['Name', 'Age']
importer = XLSXImporter(xlsx_path, columns_to_keep=COLUMNS_TO_KEEP)
Expand Down
Empty file added sismanager/services/__init__.py
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
from datetime import datetime, timedelta

from .config import CENTRAL_DB_PATH, BACKUP_DIR, logger
from sismanager.config import CENTRAL_DB_PATH, BACKUP_DIR, logger


class BackupManager:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, List
import os
import pandas as pd
from .config import CENTRAL_DB_PATH, logger
from sismanager.config import CENTRAL_DB_PATH, logger


class CentralDBRepository:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import pandas as pd
from tqdm import tqdm

from .backup import BackupManager
from .config import logger
from .central_db_repository import CentralDBRepository
from sismanager.services.inout.backup_service import BackupManager
from sismanager.config import logger
from sismanager.services.inout.central_db_service import CentralDBRepository


class XLSXImporter:
Expand Down
Loading