-
This project is a Streamlit based web application designed to collect and log student email creation details into a PostgreSQL database.
-
The application allows students to:
- Select their college
- Select their name
- Indicate whether they have created their email address
- Provide reasons if not created
- Submit verified Gmail addresses
- All responses are securely stored in a PostgreSQL database for tracking and reporting.
TSTT_Email_Address_Collection/
├── app.py # Main Streamlit entry point
├── db/
│ ├── __init__.py
│ ├── connection.py # DB engine / connection
│ └── queries.py # Fetch college, name, subject
├── storage/
│ ├── __init__.py
│ └── store_to_database.py # Store data to PostgreSQL
├── utils/
│ ├── __init__.py
│ └── helper_functions.py # Timestamp, dataframe creation
├── ui/
│ ├── __init__.py
│ ├── style.py # CSS & styling
│ └── header.py # Logo + title
├── .streamlit/
│ ├── config.toml
│ ├── secrets.example.toml # Example file
│ └── secrets.toml # Ignored by git
├── requirements.txt
├── .gitignore
└── README.md
From your project directory, run:
streamlit run app.py The app will open automatically in your browser.
| Component | Technology |
|---|---|
| Frontend UI | Streamlit |
| Backend | Python |
| Database | PostgreSQL |
| ORM / DB Connection | SQLAlchemy |
| Data Handling | Pandas |
- The app reads database credentials from st.secrets.
- You must configure the following in your .streamlit/secrets.toml file:
DB_HOST = "your_host"
DB_PORT = "your_port"
DB_NAME = "your_database"
DB_USER = "your_username"
DB_PASSWORD = "your_password"
- Fetches college names from database
- Fetches student names from database
- Displays the subject area associated with the student from database
The form collects:
- College Name (Required)
- Student Name (Required)
- Email Creation Status (Yes / No)
- If Yes:
- Enter Gmail address
- Confirm Gmail address
- Email validation enforced
- If No:
- Select reasons (multi-select)
- Optional custom reason
The app enforces:
- Required fields must be filled
- Email must contain @gmail.com
- Confirm email must match original email
- Graceful error messages on failure
On successful submission:
- A timestamp (converted to IST) is generated
- Data is structured into a Pandas DataFrame
- Stored in PostgreSQL table:
old.tstt_email_collection_log
- The following columns are inserted:
| Column | Description |
|---|---|
| timestamp | Submission time (IST) |
| college | Selected college |
| name | Student name |
| email_creation | Yes / No |
| reasons | Comma-separated reasons |
| email_id | Entered email (or NA) |
| confirm_email_id | Confirmed email (or NA) |
| subject_area | Subject Areas of student |