{"id":29311536,"url":"https://github.com/tulsibasetti/moddmapper","last_synced_at":"2026-04-10T23:02:41.148Z","repository":{"id":300228743,"uuid":"1005582899","full_name":"TulsiBasetti/ModdMapper","owner":"TulsiBasetti","description":"A RESTful Mood Tracking API with Insights and UI","archived":false,"fork":false,"pushed_at":"2025-06-20T14:28:18.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-20T14:41:48.469Z","etag":null,"topics":["fastapi","mysql-database","python3","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TulsiBasetti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-20T13:10:22.000Z","updated_at":"2025-06-20T14:28:21.000Z","dependencies_parsed_at":"2025-06-20T14:41:50.541Z","dependency_job_id":"8df5d2f1-e066-4332-b542-9963651f6b58","html_url":"https://github.com/TulsiBasetti/ModdMapper","commit_stats":null,"previous_names":["tulsibasetti/moddmapper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TulsiBasetti/ModdMapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TulsiBasetti%2FModdMapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TulsiBasetti%2FModdMapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TulsiBasetti%2FModdMapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TulsiBasetti%2FModdMapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TulsiBasetti","download_url":"https://codeload.github.com/TulsiBasetti/ModdMapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TulsiBasetti%2FModdMapper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264040974,"owners_count":23548077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","mysql-database","python3","streamlit"],"created_at":"2025-07-07T08:15:07.007Z","updated_at":"2026-04-10T23:02:36.106Z","avatar_url":"https://github.com/TulsiBasetti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 MoodMapper – Your Personal Mood Journal \u0026 Insight Engine\n\nMoodMapper is a mood journaling platform that helps users log daily emotions and understand their emotional patterns over time. It features a custom-built REST API using Flask and MySQL, with an optional modern frontend powered by Streamlit.\n\n---\n\n## 🚀 Features\n\n- 🧾 REST API with 8 endpoints\n- 👤 User registration and listing\n- 📅 Mood logging with trigger notes\n- ✏️ Edit and delete mood logs\n- 📊 View mood summary and recent activity\n- 💻 Frontend using Streamlit\n- 🔐 Secrets and URLs stored in `.env`\n- ✅ API tested using Postman\n\n---\n\n## 📦 Tech Stack\n\n| Layer        | Technology                    |\n|--------------|-------------------------------|\n| Backend      | Python + Flask (REST API)     |\n| Database     | MySQL (`mysql-connector-python`) |\n| Frontend     | Streamlit (optional UI)       |\n| Config       | `.env` file for secure secrets |\n| API Testing  | Postman                       |\n\n---\n\n## 🔌 API Endpoints\n\n### 👤 User APIs\n\n| Method | Endpoint     | Description        |\n|--------|--------------|--------------------|\n| POST   | `/users`     | Register a new user |\n| GET    | `/users`     | List all users     |\n\n### 📅 Mood APIs\n\n| Method | Endpoint                | Description                     |\n|--------|-------------------------|---------------------------------|\n| POST   | `/moods`                | Log a new mood                  |\n| GET    | `/moods/\u003cint:user_id\u003e`  | View all moods for a user       |\n| PUT    | `/moods/\u003cint:id\u003e`       | Update a specific mood entry    |\n| DELETE | `/moods/\u003cint:id\u003e`       | Delete a specific mood entry    |\n\n### 📊 Insights APIs\n\n| Method | Endpoint                                  | Description               |\n|--------|-------------------------------------------|---------------------------|\n| GET    | `/moods/stats/summary/\u003cint:user_id\u003e`      | Mood counts by type       |\n| GET    | `/moods/recent/\u003cint:user_id\u003e`             | 5 most recent mood entries|\n\n---\n\n## 🗃️ Database Schema\n\nYou can either use the SQL below or run the provided `mysql.sql` script.\n\n```sql\nCREATE DATABASE IF NOT EXISTS moodmapper;\nUSE moodmapper;\n\nCREATE TABLE IF NOT EXISTS users (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(100) NOT NULL,\n    email VARCHAR(100) UNIQUE\n);\n\nCREATE TABLE IF NOT EXISTS moods (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    mood VARCHAR(50) NOT NULL,\n    trigger_note TEXT,\n    date DATE NOT NULL,\n    user_id INT,\n    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n);\n\n```\n## ⚙️ Environment Setup (`.env`)\n\nCreate a `.env` file in your project root directory with the following content:\n\n```env\nDB_HOST=localhost\nDB_USER=root\nDB_PASSWORD=your_mysql_password\nDB_NAME=moodmapper\nBASE_URL=http://127.0.0.1:5000\n```\n✅ The frontend uses BASE_URL to point to the backend — helpful for future deployment flexibility.\n\n## 🧑‍💻 How to Run the Project\n1. Clone \u0026 Install\n```\ngit clone https://github.com/your-username/moodmapper.git\ncd moodmapper\n\n# Create virtual environment\n python -m venv moodmapper_venv\n moodmapper_venv\\Scripts\\activate   # Windows\n source moodmapper_venv/bin/activate  # macOS/Linux\n\n# Install dependencies\n pip install -r requirements.txt\n\n```\n2. Set Up Database\nYou can either:\n- Run mysql.sql in SQLYog or MySQL CLI, or\n- Paste the SQL schema (shown above)\n- Make sure the database name is moodmapper.\n\n\n3. Run Flask Backend (Terminal 1)\n```\n    python app.py\n```\n\n4. Run Streamlit Frontend (Terminal 2)\n```\nstreamlit run frontend_app.py\n```\n\n Keep both Flask and Streamlit running in separate terminals for full functionality.\n\n ## 📮 Testing the API with Postman\n All 8 API endpoints were tested using Postman to ensure:\n- Correct request/response formats\n- Expected HTTP status codes\n- Error handling and validations\n\nYou can import a Postman collection or test manually using POST, GET, PUT, DELETE methods with the base URL:\nhttp://127.0.0.1:5000/\n\n## 📊 Sample API Request\n\n### POST/users\n\n```\n{\n    \"name\": \"lisa\",\n    \"email\": \"lisa@example.com\"\n}\n\n\n```\nResponse:\n```\n{\n    \"message\": \"User added\",\n    \"user_id\": 10\n}\n\n```\n\n### POST /moods\n```\n{\n    \"mood\": \"Happy\",\n    \"trigger_note\": \"Completed project milestone\",\n    \"user_id\": 1\n}\n\n```\nResponse:\n```\n{\n  \"message\": \"Mood logged successfully\"\n}\n\n```\n\n###  Get Moods for a User (GET)\n- Method: GET\n- URL: http://localhost:5000/moods/1\n```\n[\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 3,\n        \"mood\": \"excited\",\n        \"trigger_note\": \"completed project\",\n        \"user_id\": 2\n    },\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 4,\n        \"mood\": \"excited\",\n        \"trigger_note\": \"had a fun day \",\n        \"user_id\": 2\n    },\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 5,\n        \"mood\": \"excited\",\n        \"trigger_note\": \"had a fun day \",\n        \"user_id\": 2\n    }\n]\n```\n### Recent 5 Moods (GET)\nMethod: GET\nURL: http://localhost:5000/moods/recent/1\n```\n[\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 2,\n        \"mood\": \"happy\",\n        \"trigger_note\": \"completed project\",\n        \"user_id\": 1\n    },\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 6,\n        \"mood\": \"happy\",\n        \"trigger_note\": \"attended a session on LLM\",\n        \"user_id\": 1\n    },\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 7,\n        \"mood\": \"happy\",\n        \"trigger_note\": \"attended a session on LLM\",\n        \"user_id\": 1\n    },\n    {\n        \"date\": \"Fri, 20 Jun 2025 00:00:00 GMT\",\n        \"id\": 9,\n        \"mood\": \"Happy\",\n        \"trigger_note\": \"Completed project milestone\",\n        \"user_id\": 1\n    }\n]\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftulsibasetti%2Fmoddmapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftulsibasetti%2Fmoddmapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftulsibasetti%2Fmoddmapper/lists"}