Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Production builds
/dist
/build

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE files
.vscode/
.idea/
*.swp
*.swo
*~

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/
.nyc_output

# Temporary folders
tmp/
temp/

# Model files (large files should not be committed)
*.h5
*.pb
model/
models/

# Test artifacts
.coverage
test-results/
playwright-report/
test-results.xml

# Cache
.cache/
.parcel-cache/

# Local development
.local
.tmp

# Backup files
*.bak
*.backup
*.old
241 changes: 241 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# Contributing to NightscoutAI

Thank you for your interest in contributing to NightscoutAI! This document provides guidelines for contributing to the project.

## 🀝 How to Contribute

### Reporting Issues
- Use the [GitHub Issues](https://github.com/code2344/NightscoutAI/issues) page
- Provide a clear description of the problem
- Include steps to reproduce the issue
- Mention your browser and operating system
- Include any error messages or screenshots

### Suggesting Features
- Open a feature request issue
- Explain the use case and benefits
- Provide mockups or examples if applicable
- Discuss the implementation approach

### Code Contributions

#### Development Setup
1. Fork the repository
2. Clone your fork: `git clone https://github.com/your-username/NightscoutAI.git`
3. Create a feature branch: `git checkout -b feature/amazing-feature`
4. Set up local development environment

#### Local Development
```bash
# Start local server
python3 -m http.server 8000
# or
npx http-server -p 8000

# Run tests
node test/test.js

# Open in browser
open http://localhost:8000
```

#### Code Standards

**JavaScript Style:**
- Use ES6+ syntax
- Follow consistent naming conventions
- Add JSDoc comments for all functions
- Use meaningful variable and function names
- Keep functions small and focused

**Architecture:**
- Maintain modular structure
- Separate concerns (model, data, UI)
- Use configuration-driven approach
- Implement proper error handling
- Follow the existing patterns

**Testing:**
- Add tests for new functionality
- Ensure existing tests pass
- Test edge cases and error conditions
- Test on multiple browsers
- Test offline/demo mode functionality

#### Pull Request Process

1. **Before submitting:**
- Run tests: `node test/test.js`
- Test in multiple browsers
- Test both online and demo modes
- Check code style and documentation

2. **Pull Request requirements:**
- Clear description of changes
- Reference related issues
- Include screenshots for UI changes
- Update documentation if needed
- Add or update tests

3. **Review process:**
- Maintainers will review your PR
- Address feedback and requested changes
- Once approved, your PR will be merged

### AI Model Improvements

We particularly welcome contributions to improve model accuracy:

**Model Architecture:**
- New layer types or configurations
- Advanced optimization techniques
- Hyperparameter tuning
- Feature engineering

**Training Enhancements:**
- Better data preprocessing
- Advanced validation techniques
- Training monitoring and visualization
- Performance optimization

**Data Handling:**
- Improved data validation
- Better error handling
- Enhanced synthetic data generation
- Data augmentation techniques

## πŸ“‹ Development Guidelines

### File Structure
```
NightscoutAI/
β”œβ”€β”€ index.html # Main HTML file
β”œβ”€β”€ config.js # Configuration settings
β”œβ”€β”€ css/
β”‚ └── styles.css # Enhanced styling
β”œβ”€β”€ js/
β”‚ β”œβ”€β”€ app.js # Main application controller
β”‚ β”œβ”€β”€ model.js # AI model implementation
β”‚ β”œβ”€β”€ data-manager.js # Data handling
β”‚ β”œβ”€β”€ ui-manager.js # UI management
β”‚ └── demo-mode.js # Fallback functionality
β”œβ”€β”€ test/
β”‚ └── test.js # Test suite
└── README.md # Documentation
```

### Configuration Management
- Use `config.js` for all configurable parameters
- Don't hardcode values in the application code
- Provide sensible defaults
- Document configuration options

### Error Handling
- Implement graceful degradation
- Provide meaningful error messages
- Log errors for debugging
- Fallback to demo mode when appropriate

### Performance
- Optimize TensorFlow.js operations
- Dispose of tensors properly
- Minimize memory usage
- Implement efficient data processing

### Accessibility
- Use semantic HTML elements
- Provide alt text for images
- Ensure keyboard navigation works
- Test with screen readers
- Maintain good color contrast

### Browser Compatibility
- Test on Chrome, Firefox, Safari, Edge
- Ensure mobile responsiveness
- Handle different screen sizes
- Test with different network conditions

## πŸ§ͺ Testing

### Test Categories
1. **Unit Tests:** Individual function testing
2. **Integration Tests:** Component interaction testing
3. **E2E Tests:** Full workflow testing
4. **Performance Tests:** Model accuracy and speed
5. **Compatibility Tests:** Browser and device testing

### Running Tests
```bash
# Run all tests
node test/test.js

# Test specific functionality
# (modify test.js to focus on specific areas)
```

### Test Coverage
Aim for comprehensive test coverage:
- Configuration validation
- Data processing and validation
- Model training and prediction
- UI interactions
- Error handling
- Demo mode functionality

## πŸ“ Documentation

### Code Documentation
- Add JSDoc comments for all public functions
- Include parameter types and descriptions
- Document return values
- Provide usage examples

### User Documentation
- Update README.md for new features
- Include screenshots for UI changes
- Document configuration options
- Provide troubleshooting guides

## πŸ”’ Security Guidelines

- Never commit sensitive data
- Validate all user inputs
- Use HTTPS for external requests
- Implement proper error handling
- Follow security best practices

## πŸš€ Release Process

1. **Version Bumping:**
- Update version in package.json
- Update CHANGELOG.md
- Tag the release

2. **Testing:**
- Run full test suite
- Test in multiple environments
- Verify demo mode functionality

3. **Documentation:**
- Update README.md
- Update API documentation
- Create release notes

## πŸ’¬ Communication

- **GitHub Issues:** Bug reports and feature requests
- **GitHub Discussions:** General questions and ideas
- **Pull Requests:** Code review and discussion

## πŸ“„ License

By contributing to NightscoutAI, you agree that your contributions will be licensed under the MIT License.

## πŸ™ Recognition

Contributors will be recognized in:
- README.md contributors section
- Release notes
- Git commit history

Thank you for helping make NightscoutAI better! 🩺✨
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 NightscoutAI Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading