# baitc-hacks/hack-c1d91e20-bsmlh architecture

> Architecture diagram of the GitHub repository baitc-hacks/hack-c1d91e20-bsmlh, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/baitc-hacks/hack-c1d91e20-bsmlh
- Repository: https://github.com/baitc-hacks/hack-c1d91e20-bsmlh

## Overview

AI SANA is a Streamlit marketplace that helps businesses turn rough ideas into scored, publishable tasks, then lets student teams respond and businesses decide manually. The documented workflow covers role/profile setup, AI clarification and card drafting, readiness preview and confirmation, publication and catalog discovery, proposals, and business selection or rejection. The README documents these capabilities and the overall UI-to-storage flow; sampled source confirms AI fallback, deterministic scoring, data contracts, and SQLite persistence. Some UI wiring is documented but omitted from the excerpts.

Main entry points: [`app.py`](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py) (Task authoring), [`core/storage.py`](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/storage.py) (Persistence layer), [`core/ai.py`](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/ai.py) (Gap analysis), [`core/rating.py`](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/rating.py) (Readiness rating)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_streamlit["Streamlit workflow<br/>[app.py]"]
  node_profiles["Role profiles<br/>[app.py]"]
end

subgraph group_task_quality["Task preparation"]
  node_task_authoring["Task authoring<br/>[app.py]"]
  node_task_analysis["Gap analysis<br/>[ai.py]"]
  node_card_builder["Card builder<br/>[ai.py]"]
  node_rating["Readiness rating<br/>[rating.py]"]
  node_contracts["Task contracts<br/>[models.py]"]
end

subgraph group_marketplace["Marketplace"]
  node_publication["Task publication<br/>[app.py]"]
  node_catalog["Task catalog<br/>[app.py]"]
  node_proposal["Team proposal<br/>[app.py]"]
  node_decision["Business decision<br/>[app.py]"]
end

subgraph group_persistence["Data"]
  node_storage["Persistence layer<br/>[storage.py]"]
  node_sqlite[("SQLite database")]
end

node_business(("Business user"))
node_student(("Student team"))
node_openai{{"OpenAI API"}}

node_business -->|"uses"| node_streamlit
node_student -->|"uses"| node_streamlit
node_streamlit -->|"collects profile"| node_profiles
node_streamlit -->|"enters task"| node_task_authoring
node_task_authoring -->|"analyzes text"| node_task_analysis
node_task_authoring -->|"builds draft"| node_card_builder
node_task_analysis -.->|"requests analysis"| node_openai
node_card_builder -.->|"requests card"| node_openai
node_task_authoring -->|"previews score"| node_rating
node_task_authoring -->|"creates task"| node_contracts
node_streamlit -->|"confirms task"| node_publication
node_publication -->|"calculates official score"| node_rating
node_publication -->|"saves task"| node_storage
node_student -->|"browses"| node_catalog
node_catalog -->|"lists published tasks"| node_storage
node_student -->|"submits proposal"| node_proposal
node_proposal -->|"saves proposal"| node_storage
node_business -->|"selects or rejects"| node_decision
node_decision -->|"updates proposal status"| node_storage
node_storage -->|"reads and writes"| node_sqlite

click node_streamlit "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_profiles "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_task_authoring "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_task_analysis "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/ai.py"
click node_card_builder "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/ai.py"
click node_rating "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/rating.py"
click node_contracts "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/models.py"
click node_publication "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_catalog "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_proposal "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_decision "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py"
click node_storage "https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/storage.py"

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_streamlit,node_profiles,node_business toneBlue
class node_task_authoring,node_task_analysis,node_card_builder,node_rating,node_contracts toneAmber
class node_publication,node_catalog,node_proposal,node_decision,node_openai toneMint
class node_storage,node_sqlite toneRose
class node_student toneIndigo
```

## Components

### User experience

- [Streamlit workflow](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`
- [Role profiles](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`

### Task preparation

- [Task authoring](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`
- [Gap analysis](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/ai.py): `core/ai.py`
- [Card builder](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/ai.py): `core/ai.py`
- [Readiness rating](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/rating.py): `core/rating.py`
- [Task contracts](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/models.py): `core/models.py`

### Marketplace

- [Task publication](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`
- [Task catalog](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`
- [Team proposal](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`
- [Business decision](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/app.py): `app.py`

### Data

- [Persistence layer](https://github.com/baitc-hacks/hack-c1d91e20-bsmlh/blob/main/core/storage.py): `core/storage.py`
- **SQLite database**

### Other components

- **Business user**
- **Student team**
- **OpenAI API**

## Connections

- Business user → Streamlit workflow: uses
- Student team → Streamlit workflow: uses
- Streamlit workflow → Role profiles: collects profile
- Streamlit workflow → Task authoring: enters task
- Task authoring → Gap analysis: analyzes text
- Task authoring → Card builder: builds draft
- Gap analysis → OpenAI API: requests analysis
- Card builder → OpenAI API: requests card
- Task authoring → Readiness rating: previews score
- Task authoring → Task contracts: creates task
- Streamlit workflow → Task publication: confirms task
- Task publication → Readiness rating: calculates official score
- Task publication → Persistence layer: saves task
- Student team → Task catalog: browses
- Task catalog → Persistence layer: lists published tasks
- Student team → Team proposal: submits proposal
- Team proposal → Persistence layer: saves proposal
- Business user → Business decision: selects or rejects
- Business decision → Persistence layer: updates proposal status
- Persistence layer → SQLite database: reads and writes
