Thank you for your interest in contributing to Tshong AI! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Workflow
- Code Standards
- Testing
- Documentation
- Submitting Changes
By participating in this project, you agree to abide by our Code of Conduct. We are committed to providing a welcoming and inclusive environment for all contributors.
- Node.js 18+
- Git
- AWS CLI (for testing)
- Google Cloud SDK (for Vision API testing)
# Fork the repository
# Clone your fork
git clone https://github.com/your-username/Image-recognition-System.git
cd Image-recognition-System
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your credentials
# Start development server
npm run devCreate a .env file with the following variables:
# Development mode
NODE_ENV=development
# AWS Configuration (use test credentials)
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your_test_access_key
AWS_SECRET_ACCESS_KEY=your_test_secret_key
AWS_BUCKET_NAME=your-test-bucket
# Google Cloud Vision (use test API key)
GOOGLE_CLOUD_VISION_API_KEY=your_test_vision_api_key
# Google Sheets (use test service account)
GOOGLE_APPLICATION_CREDENTIALS_JSON={"type":"service_account",...}
# Test customer IDs
GOOGLE_SHEETS_SPREADSHEET_TEST_ID=your_test_spreadsheet_id# Update your fork
git fetch upstream
git checkout main
git merge upstream/main
# Create feature branch
git checkout -b feature/your-feature-name- Write clean, readable code
- Add tests for new functionality
- Update documentation
- Follow the coding standards below
# Run linting
npm run lint
# Run tests
npm test
# Run integration tests
npm run test:integration
# Build the project
npm run build# Stage changes
git add .
# Commit with conventional commit message
git commit -m "feat: add new bank recognition support
- Add support for Bank XYZ
- Implement new OCR patterns
- Add unit tests for new functionality
- Update documentation"# Push to your fork
git push origin feature/your-feature-name
# Create Pull Request on GitHub- Use ES6+ features
- Follow ESLint configuration
- Use meaningful variable and function names
- Add JSDoc comments for public APIs
- Keep functions small and focused
/**
* Processes receipt data and extracts relevant information
* @param {string} text - Raw OCR text from receipt
* @param {string} bankKey - Identified bank type
* @returns {Object} Extracted receipt data
*/
export function parseReceiptData(text, bankKey) {
// Validate inputs
if (!text || typeof text !== 'string') {
throw new Error('Invalid text input');
}
// Process data
const result = {
amount: null,
reference: null,
date: null,
bank: bankKey
};
// Extract data based on bank type
switch (bankKey) {
case 'BNB':
result.amount = extractBNBAmount(text);
result.reference = extractBNBReference(text);
break;
// ... other cases
}
return result;
}- Use BEM methodology for class names
- Keep styles modular and reusable
- Use CSS custom properties for theming
- Ensure responsive design
- Use semantic HTML elements
- Ensure accessibility (ARIA labels, alt text)
- Keep markup clean and minimal
# Run unit tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- --grep "receipt parsing"# Run integration tests
npm run test:integration
# Test API endpoints
npm run test:api- Test on different devices and browsers
- Test with various receipt formats
- Verify AWS S3 integration
- Test Google Sheets synchronization
// Example test file: tests/vision-api.test.js
import { describe, it, expect, beforeEach } from 'jest';
import { parseReceiptData } from '../server.js';
describe('Vision API', () => {
beforeEach(() => {
// Setup test environment
});
describe('parseReceiptData', () => {
it('should extract BNB receipt data correctly', () => {
const mockText = 'BNB Transaction Successful\nAmount: Nu. 1500.00\nRRN: 123456789012';
const result = parseReceiptData(mockText, 'BNB');
expect(result.amount).toBe('1500.00');
expect(result.reference).toBe('123456789012');
expect(result.bank).toBe('BNB');
});
it('should handle invalid input gracefully', () => {
expect(() => parseReceiptData(null, 'BNB')).toThrow('Invalid text input');
});
});
});- Add JSDoc comments for all public functions
- Include examples in documentation
- Document API endpoints with OpenAPI/Swagger
- Keep README updated with new features
/**
* @api {post} /vision-api Process single receipt
* @apiName ProcessReceipt
* @apiGroup Receipt
* @apiVersion 1.0.0
*
* @apiParam {String} image Base64 encoded image
* @apiParam {String} customerID Customer identifier
*
* @apiSuccess {String} amount Extracted amount
* @apiSuccess {String} referenceNo Reference number
* @apiSuccess {String} bank Bank type
*
* @apiError {String} error Error message
*/-
Title: Use conventional commit format
feat: add new bank supportfix: resolve OCR accuracy issuedocs: update API documentation
-
Description: Include:
- What changes were made
- Why changes were necessary
- How to test the changes
- Screenshots (if UI changes)
-
Checklist:
- Code follows style guidelines
- Tests pass
- Documentation updated
- No breaking changes (or documented)
## Description
Adds support for Bank XYZ receipt recognition with improved OCR accuracy.
## Changes
- Add new bank patterns in `BANK_KEYS` object
- Implement `extractXYZAmount()` function
- Add unit tests for new functionality
- Update API documentation
## Testing
- [x] Unit tests pass
- [x] Integration tests pass
- [x] Manual testing with sample receipts
- [x] Cross-browser testing
## Screenshots

## Related Issues
Closes #123bug: Something isn't workingenhancement: New feature or requestdocumentation: Improvements to documentationgood first issue: Good for newcomershelp wanted: Extra attention is neededpriority: high: High priority issuepriority: low: Low priority issue
- Add support for more banks
- Improve OCR accuracy
- Add unit test coverage
- Performance optimizations
- UI/UX improvements
- Documentation updates
- Code refactoring
- Security enhancements
- Additional language support
- Advanced analytics
- Mobile app development
- Third-party integrations
- GitHub Issues: For bug reports and feature requests
- GitHub Discussions: For questions and general discussion
- Email: keldendraduldorji@gmail.com
- Slack: Join our community workspace
Contributors will be recognized in:
- Project README
- Release notes
- Contributor hall of fame
- Conference presentations
Thank you for contributing to Tshong AI! 🚀