Skip to content

feat: add initial FastAPI skeleton with health endpoint and project s…#104

Open
aggharsh2005 wants to merge 6 commits intoKathiraveluLab:mainfrom
aggharsh2005:feat/initial-fastapi-skeleton
Open

feat: add initial FastAPI skeleton with health endpoint and project s…#104
aggharsh2005 wants to merge 6 commits intoKathiraveluLab:mainfrom
aggharsh2005:feat/initial-fastapi-skeleton

Conversation

@aggharsh2005
Copy link
Copy Markdown

@aggharsh2005 aggharsh2005 commented Mar 19, 2026

This PR adds the initial FastAPI skeleton for BHV with:

  • Basic project structure (app/routes, app/models, app/database)
  • Root and health check endpoints
  • requirements.txt with core dependencies
  • Setup instructions added to README.md

This provides a foundation for further development of the
Behavioral Health Vault application.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the groundwork for the Behavioral Health Vault (BHV) application by introducing a basic FastAPI backend. It establishes the core application structure, defines essential dependencies, and provides initial API endpoints, enabling developers to quickly set up and run the service.

Highlights

  • Initial FastAPI Skeleton: Established the foundational FastAPI application for the Behavioral Health Vault (BHV) project.
  • Core Endpoints: Implemented a root endpoint and a dedicated health check endpoint to verify application status.
  • Project Structure: Defined a basic project structure including an app directory for application logic.
  • Dependencies: Introduced a requirements.txt file listing essential Python packages like FastAPI, Uvicorn, and SQLAlchemy.
  • Setup Documentation: Added comprehensive setup and installation instructions, along with API endpoint details, to the README.md.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request provides a solid initial skeleton for the FastAPI application. My review includes suggestions to enhance the project's foundation by improving documentation clarity in the README, ensuring reproducible builds by pinning dependencies, and adopting FastAPI best practices such as using Pydantic models and docstrings for better code quality and maintainability.

requirements.txt Outdated
Comment on lines +1 to +7
fastapi
uvicorn
sqlalchemy
python-multipart
pillow
python-jose[cryptography]
passlib[bcrypt]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The dependencies in requirements.txt are not version-pinned. This can lead to non-reproducible builds, as pip install might pull newer, potentially breaking versions of these packages in the future. It is a strong best practice to pin dependency versions to ensure that the application builds and runs consistently across all environments. You can generate a file with pinned versions by running pip freeze > requirements.txt in your virtual environment after installing the packages.




\## Setup \& Installation
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ampersand character (&) in the heading does not need to be escaped with a backslash. Removing it will clean up the raw Markdown without changing the rendered output.

Suggested change
\## Setup \& Installation
## Setup & Installation

Comment on lines +39 to +45
```bash

&#x20; git clone https://github.com/KathiraveluLab/BHV.git

&#x20; cd BHV

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation in this code block is done using the &#x20; HTML entity. While this renders correctly, it makes the raw Markdown source harder to read and edit. It's better to use standard spaces for indentation.

Suggested change
```bash
&#x20; git clone https://github.com/KathiraveluLab/BHV.git
&#x20; cd BHV
```
git clone https://github.com/KathiraveluLab/BHV.git
cd BHV

Comment on lines +51 to +55
```bash

&#x20; pip install -r requirements.txt

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation in this code block uses the &#x20; HTML entity. It's preferable to use standard spaces for indentation to improve the readability and maintainability of the raw Markdown file.

Suggested change
```bash
&#x20; pip install -r requirements.txt
```
pip install -r requirements.txt

Comment on lines +61 to +65
```bash

&#x20; uvicorn app.main:app --reload

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation in this code block uses the &#x20; HTML entity. Using standard spaces instead will make the raw Markdown easier to read and edit.

Suggested change
```bash
&#x20; uvicorn app.main:app --reload
```
uvicorn app.main:app --reload


\- `GET /health` - Health check

\- `GET /docs` - Interactive API documentation (Swagger UI)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

FastAPI automatically provides an alternative documentation UI using ReDoc, which is typically available at the /redoc endpoint. It's helpful to list all available documentation endpoints for users of the API.

Suggested change
\- `GET /docs` - Interactive API documentation (Swagger UI)
- `GET /docs` - Interactive API documentation (Swagger UI)
- `GET /redoc` - Alternative API documentation (ReDoc)

app/main.py Outdated
Comment on lines +5 to +7
@app.get("/")
def root():
return {"message": "BHV API is running"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better type safety, validation, and API documentation, it's a best practice in FastAPI to use Pydantic models for response bodies and to include docstrings. Establishing this pattern early is beneficial.

Here's an example of how you could refactor this endpoint (you would also need to add from pydantic import BaseModel):

from pydantic import BaseModel

class RootResponse(BaseModel):
    message: str

@app.get("/", response_model=RootResponse)
def root() -> RootResponse:
    """Root endpoint to check if the API is running."""
    return RootResponse(message="BHV API is running")

app/main.py Outdated
Comment on lines +9 to +11
@app.get("/health")
def health():
return {"status": "healthy"} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the root endpoint, this health check endpoint would benefit from a docstring and a Pydantic response model. This improves type safety, validation, and the detail in the auto-generated API documentation.

Example:

from pydantic import BaseModel

class HealthResponse(BaseModel):
    status: str

@app.get("/health", response_model=HealthResponse)
def health() -> HealthResponse:
    """Health check endpoint to verify service is up."""
    return HealthResponse(status="healthy")

app/main.py Outdated

@app.get("/health")
def health():
return {"status": "healthy"} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The file is missing a final newline. According to the PEP 8 style guide, all files should end with a single newline character. This prevents issues with some tools and is a standard convention.

References
  1. PEP 8 recommends that all files should end with a single newline character. (link)

@aggharsh2005
Copy link
Copy Markdown
Author

Thanks for the review @gemini-code-assist! I've addressed all the suggestions:

Pinned all dependency versions in requirements.txt
Added Pydantic response models to both endpoints
Added docstrings to endpoints
Fixed README markdown formatting

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Thanks for the update, @aggharsh2005! I've reviewed the latest changes and can confirm that all the suggestions have been addressed:

  • Dependency versions are now pinned in requirements.txt.
  • Pydantic response models (RootResponse and HealthResponse) have been added and applied to the respective endpoints in app/main.py.
  • Docstrings have been added to both the root and health endpoint functions, improving code clarity.
  • The README markdown formatting has been corrected, making the setup and API endpoint sections much clearer and easier to read.

Great work on these improvements!

@aggharsh2005
Copy link
Copy Markdown
Author

@abdullahfakrudeen2020 @pkathiravelu — Hi mentors! I've submitted an initial FastAPI skeleton for BHV with basic project structure, health endpoints, Pydantic models, and setup documentation. Gemini code review suggestions have also been addressed. Would love your feedback!

@aggharsh2005
Copy link
Copy Markdown
Author

Hey @pkathiravelu @abdullahfakrudeen2020!
Updated the PR with significant progress:

User authentication (register/login with bcrypt)
Image upload/retrieve/delete with per-user directory structure
Fuzzy color-emotion analysis module (based on Color-Emotion Associations in Art research)

The emotion analysis module uses fuzzy logic to map dominant image colors to emotional associations — directly implementing the research component mentioned in the BHV project description.
Would love feedback on the architecture direction!

@aggharsh2005
Copy link
Copy Markdown
Author

Hey @pkathiravelu @abdullahfakrudeen2020! 👋
Further update — added Admin Panel:

GET /admin/users — View all users
PUT /admin/users/{id} — Update user details
DELETE /admin/users/{id} — Delete user + their images
GET /admin/stats — System statistics

Admin access is role-based — only users with is_admin=True can access these endpoints.

@pradeeban pradeeban added the on hold Not merging this PR now. label Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold Not merging this PR now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants