# labhansh2/duemap architecture

> Architecture diagram of the GitHub repository labhansh2/duemap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/labhansh2/duemap
- Repository: https://github.com/labhansh2/duemap

## Overview

##### Project Type and Purpose
- This project is a simple Flask web application that helps students upload course schedules/syllabi. It automatically parses these documents for assignments, tasks, projects, and exam deadlines, then integrates the information with a Notion Calendar Page.
- The README indicates that the application uses external APIs (including OpenAI’s API for parsing and potentially the Notion API for calendar integration) and is primarily aimed at assignment progress tracking.

##### File Structure
- Top-level Files:
- main.py – This is likely the entry point for the Flask application.
- requirements.txt – Indicates dependencies.
- README.md – Provides an overview and usage instructions.
- vercel.json – Suggests potential deployment configuration for Vercel.
- dueMap Folder:
- __init__.py – Initializes the dueMap module.
- Notion.py – Contains integration logic for interfacing with the Notion API.
- aiParser.py – Contains code likely responsible for parsing input documents, probably making use of the OpenAI API given the context in the README and environment variables.
- data/ – Contains sample or persistent text files (finalParse.txt, parserInfo.txt, parserInstructions.txt) that might be used for storing parsing results or instructions.
- Static and Templates Folders:
- static/style.css – Holds CSS for frontend styling.
- templates/ – Contains HTML templates (such as add_assgn.html, add_course.html, home.html, layout.html) to render the user interface.

##### Main Components and Their Relationships
a. Web Server / Flask Application:
- main.py serves as the main entry point where Flask routes are defined.
- It orchestrates request handling, rendering HTML templates, and connecting frontend actions to backend processing.
b. Document Parsing Module:
- The dueMap/aiParser.py module handles parsing of uploaded course schedules/syllabi.
- It likely uses some AI capabilities (via the OpenAI API) to extract relevant deadline information.
- The dueMap/data directory provides configuration/instructions or might store parsed outputs.
c. Notion Integration Module:
- The dueMap/Notion.py module manages the integration with Notion, pushing the parsed deadlines into a Notion Calendar.
d. Frontend/UI Layer:
- Includes the templates for displaying pages (home, course, assignment forms) and static assets for styling.
e. External Dependencies:
- OpenAI API (as indicated by OPENAI_API_KEY) for parsing.
- Notion API for calendar integration.
- Environment variables (set up in a .env file) are critical for enabling secure access to these services.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project separates responsibilities across different modules – web server (Flask), parsing logic, and Notion integration.
- Modularization: All domain-specific logic is housed inside the dueMap module, while the presentation layer (templates and static) is clearly separated and served.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["Client (Browser)"]:::client
    Flask["Flask Web Server (main.py)"]:::server
    Config["Environment Config (.env)"]:::config

    subgraph "Frontend/UI Layer"
        UI_Templates["Templates (templates folder)"]:::frontend
        UI_Static["Static Assets (static/style.css)"]:::frontend
    end

    subgraph "Backend Processing"
        Parser["Document Parser (dueMap/aiParser.py)"]:::module
        Data["Parser Data Files (dueMap/data)"]:::module
        Notion["Notion Integration (dueMap/Notion.py)"]:::module
    end

    ExternalOpenAI["OpenAI API"]:::external
    ExternalNotion["Notion API"]:::external

    User -->|"DocumentUpload"| Flask
    Flask -->|"RendersPage"| UI_Templates
    Flask --> UI_Static
    Flask -->|"InvokesParsing"| Parser
    Parser -->|"UsesFiles"| Data
    Parser -->|"SendsData"| Notion
    Parser -->|"Calls"| ExternalOpenAI
    Notion -->|"UpdatesCalendar"| ExternalNotion
    Flask ---|"Uses"| Config
    Parser ---|"Uses"| Config
    Notion ---|"Uses"| Config

    click Flask "https://github.com/labhansh2/duemap/blob/main/main.py"
    click Parser "https://github.com/labhansh2/duemap/blob/main/dueMap/aiParser.py"
    click Notion "https://github.com/labhansh2/duemap/blob/main/dueMap/Notion.py"
    click UI_Templates "https://github.com/labhansh2/duemap/blob/main/templates/home.html"
    click UI_Static "https://github.com/labhansh2/duemap/blob/main/static/style.css"

    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef server fill:#90EE90,stroke:#000,stroke-width:2px
    classDef frontend fill:#FFDEAD,stroke:#000,stroke-width:2px
    classDef module fill:#FFD700,stroke:#000,stroke-width:2px
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:2px
```
