|
| 1 | +# Contributing to VCell AI Platform |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the VCell AI Platform! This document provides guidelines and information for contributors to help make the contribution process smooth and effective. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | +- **Docker and Docker Compose** (for running the full stack) |
| 9 | +- **Node.js 18+** (for frontend development) |
| 10 | +- **Python 3.12+** (for backend development) |
| 11 | +- **Git** (for version control) |
| 12 | + |
| 13 | +### Quick Setup |
| 14 | +1. **Fork and clone the repository** |
| 15 | + ```bash |
| 16 | + git clone https://github.com/YOUR_USERNAME/VCell-AI.git |
| 17 | + cd VCell-AI |
| 18 | + ``` |
| 19 | + |
| 20 | +2. **Set up environment variables** |
| 21 | + ```bash |
| 22 | + # Backend |
| 23 | + cp backend/.env.example backend/.env |
| 24 | + # Frontend |
| 25 | + cp frontend/.env.example frontend/.env.local |
| 26 | + ``` |
| 27 | + |
| 28 | +3. **Start with Docker (recommended for first-time contributors)** |
| 29 | + ```bash |
| 30 | + docker compose up --build -d |
| 31 | + ``` |
| 32 | + |
| 33 | +## Project Structure |
| 34 | + |
| 35 | +The VCell AI Platform is a monolithic repository with the following structure: |
| 36 | + |
| 37 | +``` |
| 38 | +VCell-AI/ |
| 39 | +├── frontend/ # Next.js frontend application |
| 40 | +│ ├── app/ # App router pages and components |
| 41 | +│ ├── components/ # Reusable UI components |
| 42 | +│ ├── hooks/ # Custom React hooks |
| 43 | +│ ├── lib/ # Utility functions and configurations |
| 44 | +│ └── styles/ # Global styles and CSS |
| 45 | +├── backend/ # FastAPI backend application |
| 46 | +│ ├── app/ # Main application code |
| 47 | +│ │ ├── routes/ # API route definitions |
| 48 | +│ │ ├── controllers/ # Business logic controllers |
| 49 | +│ │ ├── services/ # External service integrations |
| 50 | +│ │ ├── schemas/ # Pydantic data models |
| 51 | +│ │ └── utils/ # Utility functions |
| 52 | +│ └── tests/ # Backend test suite |
| 53 | +└── docker-compose.yml # Multi-service container orchestration |
| 54 | +``` |
| 55 | + |
| 56 | +## Development Setup |
| 57 | + |
| 58 | +### Backend Development |
| 59 | + |
| 60 | +1. **Navigate to backend directory** |
| 61 | + ```bash |
| 62 | + cd backend |
| 63 | + ``` |
| 64 | + |
| 65 | +2. **Install Python dependencies** |
| 66 | + ```bash |
| 67 | + poetry install --no-root |
| 68 | + ``` |
| 69 | + |
| 70 | +3. **Start development server** |
| 71 | + ```bash |
| 72 | + poetry run uvicorn app.main:app --reload |
| 73 | + ``` |
| 74 | + |
| 75 | +4. **Access API documentation** |
| 76 | + - Swagger UI: http://localhost:8000/docs |
| 77 | + - OpenAPI schema: http://localhost:8000/openapi.json |
| 78 | + |
| 79 | +### Frontend Development |
| 80 | + |
| 81 | +1. **Navigate to frontend directory** |
| 82 | + ```bash |
| 83 | + cd frontend |
| 84 | + ``` |
| 85 | + |
| 86 | +2. **Install Node.js dependencies** |
| 87 | + ```bash |
| 88 | + pnpm install |
| 89 | + # or |
| 90 | + npm install |
| 91 | + ``` |
| 92 | + |
| 93 | +3. **Start development server** |
| 94 | + ```bash |
| 95 | + pnpm dev |
| 96 | + # or |
| 97 | + npm run dev |
| 98 | + ``` |
| 99 | + |
| 100 | +4. **Open your browser** |
| 101 | + Navigate to http://localhost:3000 |
| 102 | + |
| 103 | +## Contributing Guidelines |
| 104 | + |
| 105 | +### Before You Start |
| 106 | + |
| 107 | +1. **Check existing issues** - Look for open issues that match your interests |
| 108 | +2. **Discuss major changes** - Open an issue to discuss significant features or changes |
| 109 | +3. **Check the roadmap** - Ensure your contribution aligns with project goals |
| 110 | + |
| 111 | +### Types of Contributions |
| 112 | + |
| 113 | +We welcome various types of contributions: |
| 114 | + |
| 115 | +- 🐛 **Bug fixes** - Help squash bugs and improve stability |
| 116 | +- ✨ **New features** - Add new functionality to the platform |
| 117 | +- 📚 **Documentation** - Improve docs, add examples, or fix typos |
| 118 | +- 🎨 **UI/UX improvements** - Enhance the user interface and experience |
| 119 | +- 🧪 **Tests** - Add or improve test coverage |
| 120 | +- 🔧 **Infrastructure** - Improve build processes, CI/CD, or deployment |
| 121 | +- 📖 **Examples** - Create tutorials or example implementations |
| 122 | + |
| 123 | +### Development Workflow |
| 124 | + |
| 125 | +1. **Create a feature branch** |
| 126 | + ```bash |
| 127 | + git checkout -b feature/your-feature-name |
| 128 | + # or |
| 129 | + git checkout -b fix/issue-description |
| 130 | + ``` |
| 131 | + |
| 132 | +2. **Make your changes** - Follow the coding standards below |
| 133 | + |
| 134 | +3. **Test your changes** - Ensure all tests pass and new functionality works |
| 135 | + |
| 136 | +4. **Commit your changes** - Use conventional commit format |
| 137 | + ```bash |
| 138 | + git commit -m "feat: add new search filter functionality" |
| 139 | + git commit -m "fix: resolve authentication token validation issue" |
| 140 | + git commit -m "docs: update API endpoint documentation" |
| 141 | + ``` |
| 142 | + |
| 143 | +5. **Push and create a pull request** |
| 144 | + ```bash |
| 145 | + git push origin feature/your-feature-name |
| 146 | + ``` |
| 147 | + |
| 148 | +## Code Standards |
| 149 | + |
| 150 | +### General Principles |
| 151 | + |
| 152 | +- **Readability** - Write code that's easy to understand and maintain |
| 153 | +- **Consistency** - Follow existing patterns and conventions |
| 154 | +- **Documentation** - Document complex logic and public APIs |
| 155 | +- **Error handling** - Implement proper error handling and validation |
| 156 | + |
| 157 | +### Backend (Python/FastAPI) |
| 158 | + |
| 159 | +- **Python 3.12+** - Use modern Python features and type hints |
| 160 | +- **Pydantic** - Use Pydantic models for data validation |
| 161 | +- **Async/await** - Prefer async operations for I/O-bound tasks |
| 162 | +- **Type hints** - Include type annotations for all functions and variables |
| 163 | +- **Docstrings** - Use Google-style docstrings for public functions |
| 164 | + |
| 165 | +```python |
| 166 | +from typing import List, Optional |
| 167 | +from pydantic import BaseModel |
| 168 | + |
| 169 | +class BiomodelResponse(BaseModel): |
| 170 | + """Response model for biomodel data.""" |
| 171 | + id: str |
| 172 | + name: str |
| 173 | + description: Optional[str] = None |
| 174 | + simulations: List[str] = [] |
| 175 | + |
| 176 | +async def get_biomodel(biomodel_id: str) -> Optional[BiomodelResponse]: |
| 177 | + """Retrieve a biomodel by ID. |
| 178 | + |
| 179 | + Args: |
| 180 | + biomodel_id: The unique identifier for the biomodel |
| 181 | + |
| 182 | + Returns: |
| 183 | + BiomodelResponse if found, None otherwise |
| 184 | + """ |
| 185 | + # Implementation here |
| 186 | + pass |
| 187 | +``` |
| 188 | + |
| 189 | +### Frontend (TypeScript/React) |
| 190 | + |
| 191 | +- **TypeScript** - Use strict TypeScript with proper type definitions |
| 192 | +- **React Hooks** - Prefer functional components with hooks |
| 193 | +- **Component structure** - Follow the established component patterns |
| 194 | +- **State management** - Use appropriate state management patterns |
| 195 | +- **Accessibility** - Ensure components are accessible |
| 196 | + |
| 197 | +```typescript |
| 198 | +interface ChatMessage { |
| 199 | + id: string; |
| 200 | + content: string; |
| 201 | + timestamp: Date; |
| 202 | + isUser: boolean; |
| 203 | +} |
| 204 | + |
| 205 | +interface ChatBoxProps { |
| 206 | + messages: ChatMessage[]; |
| 207 | + onSendMessage: (message: string) => void; |
| 208 | + isLoading?: boolean; |
| 209 | +} |
| 210 | + |
| 211 | +export const ChatBox: React.FC<ChatBoxProps> = ({ |
| 212 | + messages, |
| 213 | + onSendMessage, |
| 214 | + isLoading = false |
| 215 | +}) => { |
| 216 | + // Component implementation |
| 217 | +}; |
| 218 | +``` |
| 219 | + |
| 220 | +### Styling |
| 221 | + |
| 222 | +- **Tailwind CSS** - Use Tailwind utility classes for styling |
| 223 | +- **Component consistency** - Follow the established design system |
| 224 | +- **Responsive design** - Ensure components work on all screen sizes |
| 225 | +- **Dark mode** - Support both light and dark themes |
| 226 | + |
| 227 | +## Testing |
| 228 | + |
| 229 | +### Backend Testing |
| 230 | + |
| 231 | +- **Pytest** - Use pytest for all backend tests |
| 232 | +- **Async testing** - Use pytest-asyncio for async function testing |
| 233 | +- **Test coverage** - Aim for high test coverage on new features |
| 234 | +- **Mocking** - Mock external dependencies appropriately |
| 235 | + |
| 236 | +```bash |
| 237 | +# Run all tests |
| 238 | +poetry run pytest |
| 239 | + |
| 240 | +# Run with coverage |
| 241 | +poetry run pytest --cov=app |
| 242 | + |
| 243 | +# Run specific test file |
| 244 | +poetry run pytest tests/test_biomodel.py |
| 245 | +``` |
| 246 | + |
| 247 | +### Frontend Testing |
| 248 | + |
| 249 | +- **Component testing** - Test React components in isolation |
| 250 | +- **Integration testing** - Test component interactions |
| 251 | +- **Accessibility testing** - Ensure components meet accessibility standards |
| 252 | + |
| 253 | +```bash |
| 254 | +# Run tests |
| 255 | +pnpm test |
| 256 | + |
| 257 | +# Run tests in watch mode |
| 258 | +pnpm test:watch |
| 259 | + |
| 260 | +# Run tests with coverage |
| 261 | +pnpm test:coverage |
| 262 | +``` |
| 263 | + |
| 264 | +## Submitting Changes |
| 265 | + |
| 266 | +### Pull Request Guidelines |
| 267 | + |
| 268 | +1. **Title** - Use a clear, descriptive title |
| 269 | +2. **Description** - Explain what the PR does and why it's needed |
| 270 | +3. **Related issues** - Link to any related issues |
| 271 | +4. **Screenshots** - Include screenshots for UI changes |
| 272 | +5. **Testing** - Describe how you tested the changes |
| 273 | + |
| 274 | +### Pull Request Template |
| 275 | + |
| 276 | +```markdown |
| 277 | +## Description |
| 278 | +Brief description of what this PR accomplishes. |
| 279 | + |
| 280 | +## Type of Change |
| 281 | +- [ ] Bug fix (non-breaking change which fixes an issue) |
| 282 | +- [ ] New feature (non-breaking change which adds functionality) |
| 283 | +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) |
| 284 | +- [ ] Documentation update |
| 285 | + |
| 286 | +## Testing |
| 287 | +- [ ] I have tested this change locally |
| 288 | +- [ ] I have added tests that prove my fix is effective or that my feature works |
| 289 | +- [ ] All existing tests pass |
| 290 | + |
| 291 | +## Checklist |
| 292 | +- [ ] My code follows the style guidelines of this project |
| 293 | +- [ ] I have performed a self-review of my own code |
| 294 | +- [ ] I have commented my code, particularly in hard-to-understand areas |
| 295 | +- [ ] I have made corresponding changes to the documentation |
| 296 | +- [ ] My changes generate no new warnings |
| 297 | +- [ ] I have added tests that prove my fix is effective or that my feature works |
| 298 | +- [ ] New and existing unit tests pass locally with my changes |
| 299 | +``` |
| 300 | + |
| 301 | +## Issue Reporting |
| 302 | + |
| 303 | +### Before Creating an Issue |
| 304 | + |
| 305 | +1. **Search existing issues** - Check if your problem has already been reported |
| 306 | +2. **Check documentation** - Ensure the issue isn't covered in the docs |
| 307 | +3. **Reproduce the issue** - Make sure you can consistently reproduce the problem |
| 308 | + |
| 309 | +### Issue Template |
| 310 | + |
| 311 | +```markdown |
| 312 | +## Bug Description |
| 313 | +A clear and concise description of what the bug is. |
| 314 | + |
| 315 | +## Steps to Reproduce |
| 316 | +1. Go to '...' |
| 317 | +2. Click on '....' |
| 318 | +3. Scroll down to '....' |
| 319 | +4. See error |
| 320 | + |
| 321 | +## Expected Behavior |
| 322 | +A clear and concise description of what you expected to happen. |
| 323 | + |
| 324 | +## Actual Behavior |
| 325 | +A clear and concise description of what actually happened. |
| 326 | + |
| 327 | +## Environment |
| 328 | +- OS: [e.g. Windows 10, macOS 12.0] |
| 329 | +- Browser: [e.g. Chrome 120, Firefox 119] |
| 330 | +- Version: [e.g. 1.0.0] |
| 331 | + |
| 332 | +## Additional Context |
| 333 | +Add any other context about the problem here. |
| 334 | +``` |
| 335 | + |
| 336 | +## Community Guidelines |
| 337 | + |
| 338 | +### Code of Conduct |
| 339 | + |
| 340 | +We are committed to providing a welcoming and inclusive environment for all contributors. Please: |
| 341 | + |
| 342 | +- **Be respectful** - Treat all contributors with respect and dignity |
| 343 | +- **Be inclusive** - Welcome people from all backgrounds and experience levels |
| 344 | +- **Be collaborative** - Work together to solve problems and improve the project |
| 345 | +- **Be constructive** - Provide constructive feedback and suggestions |
| 346 | + |
| 347 | +### Communication |
| 348 | + |
| 349 | +- **GitHub Issues** - Use issues for bug reports and feature requests |
| 350 | +- **GitHub Discussions** - Use discussions for questions and general conversation |
| 351 | +- **Pull Requests** - Use PRs for code changes and improvements |
| 352 | +- **Be patient** - Maintainers and contributors are volunteers with limited time |
| 353 | + |
| 354 | +### Getting Help |
| 355 | + |
| 356 | +If you need help or have questions: |
| 357 | + |
| 358 | +1. **Check the documentation** - Start with the README files |
| 359 | +2. **Search existing issues** - Look for similar problems |
| 360 | +3. **Ask in discussions** - Create a discussion for general questions |
| 361 | +4. **Be specific** - Provide clear details about your problem |
| 362 | + |
| 363 | +## Recognition |
| 364 | + |
| 365 | +Contributors will be recognized in several ways: |
| 366 | + |
| 367 | +- **Contributors list** - All contributors are listed in the project README |
| 368 | +- **Release notes** - Contributors are credited in release notes |
| 369 | +- **Community appreciation** - Recognition in project discussions and updates |
| 370 | + |
| 371 | +## License |
| 372 | + |
| 373 | +By contributing to VCell AI Platform, you agree that your contributions will be licensed under the MIT License. |
| 374 | + |
| 375 | +--- |
| 376 | + |
| 377 | +Thank you for contributing to VCell AI Platform! Your contributions help make this project better for everyone in the scientific community. |
| 378 | + |
| 379 | +If you have any questions about contributing, please don't hesitate to ask in the GitHub discussions or create an issue. |
0 commit comments