# fernandaatim/projeto_magnifyreviewer architecture

> Architecture diagram of the GitHub repository fernandaatim/projeto_magnifyreviewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fernandaatim/projeto_magnifyreviewer
- Repository: https://github.com/fernandaatim/projeto_magnifyreviewer

## Overview

Magnify is a Flask web application for reviewing uploaded business emails. The main workflow sends a .txt upload through the Flask route to email parsing and OpenAI-based evaluation, then saves scored results as CSV for the browser table and chart; the page also supports PDF export and a contact form. The graph follows relationships shown in excerpts and the source index; frontend wiring to the template and chart/PDF libraries is not directly evidenced.

Main entry points: [`app.py`](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/app.py) (Flask routes), [`main.py`](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/main.py) (Email processing), [`static/scripts/script_page.js`](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_page.js) (Upload and table UI), [`uploads`](https://github.com/fernandaatim/projeto_magnifyreviewer/tree/main/uploads) (Results CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["Flask routes<br/>[app.py]"]
  node_contactform["Contact form<br/>[forms.py]"]
  node_pagescript["Upload and table UI<br/>[script_page.js]"]
  node_loading["Loading feedback<br/>[script_loading.js]"]
  node_emailservice{{"Mail service"}}
end

subgraph group_review["Email review"]
  node_emailprocessor["Email processing<br/>[main.py]"]
  node_openai{{"OpenAI API"}}
  node_upload["Uploaded email file"]
end

subgraph group_results["Results and export"]
  node_resultsfile[("Results CSV")]
  node_chartscript["Statistics chart<br/>[script_chart.js]"]
  node_pdfscript["PDF export<br/>[script_pdf.js]"]
end

node_user(("Reviewer"))

node_user -->|"uploads emails"| node_app
node_app -->|"validates with"| node_contactform
node_app -->|"processes upload"| node_emailprocessor
node_app -->|"saves file"| node_upload
node_emailprocessor -->|"evaluates with"| node_openai
node_app -->|"saves results via"| node_emailprocessor
node_emailprocessor -->|"writes CSV"| node_resultsfile
node_pagescript -->|"requests results"| node_app
node_app -->|"reads CSV"| node_resultsfile
node_pagescript -.->|"renders statistics"| node_chartscript
node_pagescript -.->|"exports table"| node_pdfscript
node_loading -->|"submits upload"| node_app
node_app -->|"sends contact message"| node_emailservice

click node_app "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/app.py"
click node_contactform "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/forms.py"
click node_emailprocessor "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/main.py"
click node_upload "https://github.com/fernandaatim/projeto_magnifyreviewer/tree/main/uploads"
click node_resultsfile "https://github.com/fernandaatim/projeto_magnifyreviewer/tree/main/uploads"
click node_pagescript "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_page.js"
click node_chartscript "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_chart.js"
click node_pdfscript "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_pdf.js"
click node_loading "https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_loading.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_contactform,node_pagescript,node_loading,node_emailservice,node_user toneBlue
class node_emailprocessor,node_openai,node_upload toneAmber
class node_resultsfile,node_chartscript,node_pdfscript toneMint
```

## Components

### Web interface

- [Flask routes](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/app.py): `app.py`
- [Contact form](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/forms.py): `forms.py`
- [Upload and table UI](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_page.js): `static/scripts/script_page.js`
- [Loading feedback](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_loading.js): `static/scripts/script_loading.js`
- **Mail service**

### Email review

- [Email processing](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/main.py): `main.py`
- **OpenAI API**
- [Uploaded email file](https://github.com/fernandaatim/projeto_magnifyreviewer/tree/main/uploads): `uploads`

### Results and export

- [Results CSV](https://github.com/fernandaatim/projeto_magnifyreviewer/tree/main/uploads): `uploads`
- [Statistics chart](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_chart.js): `static/scripts/script_chart.js`
- [PDF export](https://github.com/fernandaatim/projeto_magnifyreviewer/blob/main/static/scripts/script_pdf.js): `static/scripts/script_pdf.js`

### Other components

- **Reviewer**

## Connections

- Reviewer → Flask routes: uploads emails
- Flask routes → Contact form: validates with (evidence: `app.py`)
- Flask routes → Email processing: processes upload (evidence: `app.py`)
- Flask routes → Uploaded email file: saves file (evidence: `app.py`)
- Email processing → OpenAI API: evaluates with (evidence: `main.py`)
- Flask routes → Email processing: saves results via (evidence: `app.py`)
- Email processing → Results CSV: writes CSV (evidence: `main.py`)
- Upload and table UI → Flask routes: requests results (evidence: `static/scripts/script_page.js`)
- Flask routes → Results CSV: reads CSV (evidence: `app.py`)
- Upload and table UI → Statistics chart: renders statistics
- Upload and table UI → PDF export: exports table
- Loading feedback → Flask routes: submits upload (evidence: `static/scripts/script_loading.js`)
- Flask routes → Mail service: sends contact message (evidence: `app.py`)
