{"id":30217009,"url":"https://github.com/sourabh-kumar04/fastapi","last_synced_at":"2026-04-11T20:46:59.860Z","repository":{"id":309467487,"uuid":"1029136568","full_name":"Sourabh-Kumar04/FastAPI","owner":"Sourabh-Kumar04","description":"A modern FastAPI application demonstrating REST API development with Python, featuring a patient management system with realistic healthcare data. Perfect for learning API design, Pydantic validation, and modern Python web development.","archived":false,"fork":false,"pushed_at":"2025-08-12T02:25:16.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-12T04:26:58.462Z","etag":null,"topics":["api-development","data-validation","fastapi","healthcare","json-data","learning-projects","patient-management","pydantic","python","rest-api","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sourabh-Kumar04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-07-30T15:19:10.000Z","updated_at":"2025-08-12T02:50:33.000Z","dependencies_parsed_at":"2025-08-12T04:27:00.521Z","dependency_job_id":"e1bb1a87-cf54-4c91-ad77-3bec01f76f4d","html_url":"https://github.com/Sourabh-Kumar04/FastAPI","commit_stats":null,"previous_names":["sourabh-kumar04/fastapi"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Sourabh-Kumar04/FastAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sourabh-Kumar04%2FFastAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sourabh-Kumar04%2FFastAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sourabh-Kumar04%2FFastAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sourabh-Kumar04%2FFastAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sourabh-Kumar04","download_url":"https://codeload.github.com/Sourabh-Kumar04/FastAPI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sourabh-Kumar04%2FFastAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270363839,"owners_count":24571395,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api-development","data-validation","fastapi","healthcare","json-data","learning-projects","patient-management","pydantic","python","rest-api","swagger-ui"],"created_at":"2025-08-14T04:35:59.727Z","updated_at":"2026-04-11T20:46:54.831Z","avatar_url":"https://github.com/Sourabh-Kumar04.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 FastAPI Patient Management System\r\n\r\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\r\n[![FastAPI](https://img.shields.io/badge/FastAPI-0.104+-00a393.svg)](https://fastapi.tiangolo.com)\r\n[![Pydantic V2](https://img.shields.io/badge/Pydantic-V2-e92063.svg)](https://docs.pydantic.dev)\r\n[![uv](https://img.shields.io/badge/uv-latest-8b5cf6.svg)](https://github.com/astral-sh/uv)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n\u003e A modern **FastAPI** application demonstrating REST API development with Python, featuring a patient management system with realistic healthcare data.\r\n\r\n## 🎯 About This Project\r\n\r\nThis repository showcases a complete FastAPI learning journey, building a patient management REST API from scratch. Perfect for developers learning modern Python web development, API design, and data validation patterns.\r\n\r\n**🔑 Key Learning Areas:**\r\n- Building RESTful APIs with FastAPI\r\n- Data validation using Pydantic models\r\n- Working with JSON datasets\r\n- API documentation and testing\r\n- Modern Python development practices\r\n\r\n---\r\n\r\n## 📂 Repository Structure\r\n\r\n```\r\nFastAPI/\r\n├── main.py                  # FastAPI application with all endpoints\r\n├── patient_dataset.json     # Sample patient data (50+ records)\r\n├── 00_Introduction.md       # API fundamentals and concepts\r\n├── 01_Pydantic.md          # Pydantic usage and validation guide\r\n├── LICENSE                  # MIT License\r\n└── README.md               # This documentation\r\n```\r\n\r\n---\r\n\r\n## 🚀 Quick Start\r\n\r\n### Prerequisites\r\n- Python 3.8 or higher\r\n- pip or uv (recommended for faster installs)\r\n\r\n### ⚡ Installation with uv (Recommended)\r\n\r\n```bash\r\n# 1️⃣ Clone the repository\r\ngit clone https://github.com/Sourabh-Kumar04/FastAPI.git\r\ncd FastAPI\r\n\r\n# 2️⃣ Install uv (if not already installed)\r\ncurl -LsSf https://astral.sh/uv/install.sh | sh\r\n\r\n# 3️⃣ Install dependencies\r\nuv add fastapi uvicorn\r\n\r\n# 4️⃣ Run the development server\r\nuv run uvicorn main:app --reload\r\n```\r\n\r\n### 🐍 Alternative Installation with pip\r\n\r\n```bash\r\n# Clone and setup\r\ngit clone https://github.com/Sourabh-Kumar04/FastAPI.git\r\ncd FastAPI\r\n\r\n# Create virtual environment\r\npython -m venv venv\r\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\r\n\r\n# Install dependencies\r\npip install fastapi uvicorn\r\n\r\n# Run the server\r\nuvicorn main:app --reload\r\n```\r\n\r\n### 🌐 Access Your API\r\n\r\nOnce running, access your API at:\r\n- **🔥 Interactive API Docs (Swagger UI):** http://localhost:8000/docs\r\n- **📖 Alternative Docs (ReDoc):** http://localhost:8000/redoc\r\n- **⚡ API Base:** http://localhost:8000\r\n\r\n---\r\n\r\n## 📌 API Endpoints\r\n\r\n| Method | Endpoint | Description | Example Response |\r\n|--------|----------|-------------|------------------|\r\n| `GET` | `/` | Welcome message and API info | `{\"message\": \"Welcome to FastAPI Patient Management System\"}` |\r\n| `GET` | `/about` | About the API and developer | `{\"about\": \"Patient Management API\", \"developer\": \"Sourabh Kumar\"}` |\r\n| `GET` | `/view` | Get all patients | Array of patient objects |\r\n| `GET` | `/patient/{id}` | Get specific patient by ID | Single patient object |\r\n| `GET` | `/sort` | Sort patients by criteria | Sorted array of patients |\r\n\r\n### 🔍 Query Parameters for `/sort`\r\n\r\n| Parameter | Type | Options | Default | Example |\r\n|-----------|------|---------|---------|---------|\r\n| `sort_by` | string | `age`, `name` | `age` | `/sort?sort_by=name` |\r\n| `order` | string | `asc`, `desc` | `asc` | `/sort?order=desc` |\r\n\r\n---\r\n\r\n## 🌐 API Usage Examples\r\n\r\n### 📋 Get All Patients\r\n```bash\r\ncurl http://localhost:8000/view\r\n```\r\n\r\n### 👤 Get Patient by ID\r\n```bash\r\ncurl http://localhost:8000/patient/1\r\n```\r\n\r\n### 📊 Sort Patients\r\n```bash\r\n# Sort by age (oldest first)\r\ncurl \"http://localhost:8000/sort?sort_by=age\u0026order=desc\"\r\n\r\n# Sort alphabetically by name\r\ncurl \"http://localhost:8000/sort?sort_by=name\u0026order=asc\"\r\n```\r\n\r\n### 🐍 Python Example\r\n```python\r\nimport requests\r\n\r\n# Base URL\r\nbase_url = \"http://localhost:8000\"\r\n\r\n# Get all patients\r\nresponse = requests.get(f\"{base_url}/view\")\r\npatients = response.json()\r\nprint(f\"Total patients: {len(patients)}\")\r\n\r\n# Get specific patient\r\npatient_response = requests.get(f\"{base_url}/patient/5\")\r\nif patient_response.status_code == 200:\r\n    patient = patient_response.json()\r\n    print(f\"Patient: {patient['name']}, Age: {patient['age']}\")\r\nelse:\r\n    print(\"Patient not found\")\r\n\r\n# Get sorted patients\r\nsorted_response = requests.get(f\"{base_url}/sort\", params={\r\n    \"sort_by\": \"age\", \r\n    \"order\": \"desc\"\r\n})\r\nsorted_patients = sorted_response.json()\r\nprint(f\"Oldest patient: {sorted_patients[0]['name']} ({sorted_patients[0]['age']} years)\")\r\n```\r\n\r\n---\r\n\r\n## 🗄️ Dataset Overview\r\n\r\nThe `patient_dataset.json` contains **50+ realistic patient records** for testing and development purposes.\r\n\r\n### 📊 Data Structure\r\n\r\nEach patient record includes:\r\n\r\n| Field | Type | Description | Example |\r\n|-------|------|-------------|---------|\r\n| `id` | Integer | Unique patient identifier | `1` |\r\n| `name` | String | Full patient name | `\"Sumer Saini\"` |\r\n| `age` | Integer | Patient age | `55` |\r\n| `gender` | String | Gender identity | `\"Male\"` |\r\n| `contact` | String | Contact number | `\"+915335225484\"` |\r\n| `email` | String | Email address | `\"sahotakiaan@shroff.info\"` |\r\n| `address` | String | Complete address | `\"H.No. 452, Hora Marg, Hindupur 334089\"` |\r\n| `blood_group` | String | ABO blood type | `\"A+\"` |\r\n| `medical_history` | Array | Medical conditions | `[\"Cardiac issues\", \"COVID-19\"]` |\r\n| `admission_date` | String | Admission date (YYYY-MM-DD) | `\"2025-07-09\"` |\r\n| `discharge_date` | String | Discharge date (YYYY-MM-DD) | `\"2025-07-19\"` |\r\n| `doctor_assigned` | String | Assigned physician | `\"Dr. Rohit Nair\"` |\r\n| `current_status` | String | Current patient status | `\"Discharged\"` |\r\n\r\n### 📋 Sample Patient Record\r\n\r\n```json\r\n{\r\n  \"id\": 1,\r\n  \"name\": \"Sumer Saini\",\r\n  \"age\": 55,\r\n  \"gender\": \"Male\",\r\n  \"contact\": \"+915335225484\",\r\n  \"email\": \"sahotakiaan@shroff.info\",\r\n  \"address\": \"H.No. 452, Hora Marg, Hindupur 334089\",\r\n  \"blood_group\": \"A+\",\r\n  \"medical_history\": [\r\n    \"Cardiac issues\",\r\n    \"COVID-19\",\r\n    \"Hypertension\"\r\n  ],\r\n  \"admission_date\": \"2025-07-09\",\r\n  \"discharge_date\": \"2025-07-19\",\r\n  \"doctor_assigned\": \"Dr. Rohit Nair\",\r\n  \"current_status\": \"Discharged\"\r\n}\r\n```\r\n\r\n---\r\n\r\n## 📚 Learning Resources\r\n\r\nThis repository includes comprehensive learning materials:\r\n\r\n### 📖 [`00_Introduction.md`](./00_Introduction.md)\r\n**API Fundamentals \u0026 System Design**\r\n- What are REST APIs and why they matter\r\n- HTTP methods and status codes\r\n- Monolithic vs Microservice architectures  \r\n- API integration with Machine Learning systems\r\n- Testing tools and best practices\r\n\r\n### 🔧 [`01_Pydantic.md`](./01_Pydantic.md)\r\n**Advanced Data Validation with Pydantic**\r\n- Pydantic models and type hints\r\n- Data validation and serialization\r\n- Nested models and complex data structures\r\n- Environment variables and settings management\r\n- Custom validators and error handling\r\n\r\n### 🎓 Skills You'll Learn\r\n\r\n- **FastAPI Framework:** Route definition, request handling, response formatting\r\n- **Pydantic Integration:** Automatic data validation, type conversion, error messages\r\n- **API Design:** RESTful principles, endpoint organization, query parameters\r\n- **Data Handling:** JSON processing, sorting algorithms, error handling\r\n- **Development Tools:** Virtual environments, package management, development servers\r\n\r\n---\r\n\r\n## 🛠️ Development\r\n\r\n### 🧪 Testing Your API\r\n\r\n#### Manual Testing\r\nUse the built-in Swagger UI at `http://localhost:8000/docs` to:\r\n- View all available endpoints\r\n- Test API calls directly in the browser\r\n- See request/response schemas\r\n- Understand parameter requirements\r\n\r\n#### Command Line Testing\r\n```bash\r\n# Test all endpoints\r\ncurl http://localhost:8000/\r\ncurl http://localhost:8000/about\r\ncurl http://localhost:8000/view\r\ncurl http://localhost:8000/patient/10\r\ncurl \"http://localhost:8000/sort?sort_by=name\u0026order=asc\"\r\n```\r\n\r\n### 🔄 Development Workflow\r\n\r\n```bash\r\n# Make changes to main.py\r\n# Server automatically reloads (thanks to --reload flag)\r\n# Test changes at http://localhost:8000/docs\r\n# Check logs in terminal for any errors\r\n```\r\n\r\n### 📦 Adding New Dependencies\r\n\r\n```bash\r\n# Using uv (recommended)\r\nuv add package-name\r\n\r\n# Using pip\r\npip install package-name\r\npip freeze \u003e requirements.txt\r\n```\r\n\r\n---\r\n\r\n## 🚀 What's Next?\r\n\r\n### 🎯 Planned Enhancements\r\n\r\n1. **Database Integration**\r\n   - Replace JSON file with PostgreSQL or SQLite\r\n   - Add SQLAlchemy ORM for database operations\r\n   - Implement connection pooling\r\n\r\n2. **Advanced Features**\r\n   - POST endpoint to create new patients\r\n   - PUT endpoint to update patient information\r\n   - DELETE endpoint to remove patients\r\n   - Search functionality with filters\r\n\r\n3. **Authentication \u0026 Security**\r\n   - JWT token-based authentication\r\n   - Role-based access control (Admin, Doctor, Nurse)\r\n   - API rate limiting and security headers\r\n\r\n4. **Production Deployment**\r\n   - Docker containerization\r\n   - Environment configuration\r\n   - Logging and monitoring\r\n   - CI/CD pipeline with GitHub Actions\r\n\r\n### 💡 Learning Suggestions\r\n\r\n- Explore the interactive docs thoroughly\r\n- Try modifying the patient data structure\r\n- Add new endpoints for specific use cases\r\n- Experiment with different query parameters\r\n- Study the error handling patterns\r\n\r\n---\r\n\r\n## 🤝 Contributing\r\n\r\nFeel free to contribute to this learning project! Here's how:\r\n\r\n1. **Fork** the repository\r\n2. **Create** a feature branch (`git checkout -b feature/new-endpoint`)\r\n3. **Make** your changes and test them\r\n4. **Commit** your changes (`git commit -am 'Add new search endpoint'`)\r\n5. **Push** to the branch (`git push origin feature/new-endpoint`)\r\n6. **Create** a Pull Request\r\n\r\n### 🐛 Found Issues?\r\n- Check the existing issues on GitHub\r\n- Create a new issue with detailed description\r\n- Include steps to reproduce the problem\r\n\r\n---\r\n\r\n## 📖 Additional Resources\r\n\r\n### 🔗 Helpful Links\r\n- **FastAPI Documentation:** https://fastapi.tiangolo.com/\r\n- **Pydantic Documentation:** https://docs.pydantic.dev/\r\n- **Python Type Hints:** https://docs.python.org/3/library/typing.html\r\n- **HTTP Status Codes:** https://httpstatuses.com/\r\n- **REST API Design:** https://restfulapi.net/\r\n\r\n### 🎥 Recommended Learning\r\n- FastAPI official tutorial\r\n- REST API design principles\r\n- Python async/await concepts\r\n- JSON data handling in Python\r\n\r\n---\r\n\r\n## 📜 License\r\n\r\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.\r\n\r\n**What this means:**\r\n- ✅ Commercial use allowed\r\n- ✅ Modification allowed  \r\n- ✅ Distribution allowed\r\n- ✅ Private use allowed\r\n- ❗ License and copyright notice required\r\n\r\n---\r\n\r\n## 👨‍💻 About the Developer\r\n\r\n**Sourabh Kumar**  \r\n*CS Student @University of Delhi | AWS AIML Scholar'24*\r\n\r\nPassionate about AI/ML and software development, exploring modern web technologies and building practical applications for learning and growth.\r\n\r\n- 🌐 **GitHub:** [@Sourabh-Kumar04](https://github.com/Sourabh-Kumar04)\r\n- 🎓 **University:** University of Delhi (Computer Science)\r\n\u003c!-- - 🏆 **Achievement:** AWS AI/ML Scholar 2024\r\n- 💼 **Focus:** Python, C++, AI/ML, Web Development --\u003e\r\n\r\n---\r\n\r\n## 🌟 Support This Project\r\n\r\nIf this repository helped you learn FastAPI or understand API development:\r\n\r\n- ⭐ **Star this repository** to show your support\r\n- 🍴 **Fork it** to create your own version\r\n- 📢 **Share it** with fellow developers\r\n- 💡 **Contribute** improvements or new features\r\n- 🐛 **Report issues** to help others\r\n\r\n---\r\n\r\n## 📊 Repository Stats\r\n\r\n![GitHub stars](https://img.shields.io/github/stars/Sourabh-Kumar04/FastAPI?style=social)\r\n![GitHub forks](https://img.shields.io/github/forks/Sourabh-Kumar04/FastAPI?style=social)\r\n![GitHub watchers](https://img.shields.io/github/watchers/Sourabh-Kumar04/FastAPI?style=social)\r\n\r\n---\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n\r\n**Built with ❤️ using FastAPI and Python**\r\n\r\n*Happy Learning! 🚀*\r\n\r\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourabh-kumar04%2Ffastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourabh-kumar04%2Ffastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourabh-kumar04%2Ffastapi/lists"}