{"id":29035516,"url":"https://github.com/qianqianq/stats-test-analyzer","last_synced_at":"2026-05-05T04:41:02.103Z","repository":{"id":299413015,"uuid":"1000050640","full_name":"QianqianQ/stats-test-analyzer","owner":"QianqianQ","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-16T12:07:46.000Z","size":925,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-16T12:48:09.183Z","etag":null,"topics":["angular","flask","python","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QianqianQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-11T07:34:44.000Z","updated_at":"2025-06-16T12:20:09.000Z","dependencies_parsed_at":"2025-06-16T12:58:25.919Z","dependency_job_id":null,"html_url":"https://github.com/QianqianQ/stats-test-analyzer","commit_stats":null,"previous_names":["qianqianq/stats-test-analyzer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/QianqianQ/stats-test-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianqianQ%2Fstats-test-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianqianQ%2Fstats-test-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianqianQ%2Fstats-test-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianqianQ%2Fstats-test-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QianqianQ","download_url":"https://codeload.github.com/QianqianQ/stats-test-analyzer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianqianQ%2Fstats-test-analyzer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262063551,"owners_count":23252767,"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","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":["angular","flask","python","typescript"],"created_at":"2025-06-26T12:10:34.360Z","updated_at":"2026-05-05T04:40:57.082Z","avatar_url":"https://github.com/QianqianQ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Statistical Analysis Platform\n\n## Overview\n\nThis is a full-stack web application for performing statistical significance testing on A/B test data. The platform provides comprehensive statistical analysis including chi-square tests, z-tests, confidence intervals, and effect size calculations. It features a Flask backend with scientific computing capabilities and an Angular frontend with modern UI components and data visualization.\n\n## System Architecture\n\n### Backend Architecture\n- **Framework**: Flask (Python 3.12) with RESTful API design\n- **Scientific Computing**: NumPy and SciPy for advanced statistical calculations\n- **Web Server**: Gunicorn for production deployment with autoscale capabilities\n- **API Design**: Single JSON endpoint (`/api/calculate`) for statistical computations\n- **Static Serving**: Flask serves Angular build artifacts for production deployment\n\n### Frontend Architecture\n- **Framework**: Angular 19 with TypeScript and standalone components\n- **Build System**: Angular CLI with modern application builder\n- **Styling**: SCSS with Bootstrap 5 integration and custom dark theme\n- **Components**: Modular architecture with form input, results display, and educational components\n- **HTTP Client**: Angular HttpClient for API communication\n\n### Data Storage\n- **Current State**: No persistent storage - stateless calculations\n- **Database Ready**: Project structure includes PostgreSQL dependencies for future data persistence\n\n## Key Components\n\n### Backend Components\n\n1. **Statistical Engine** (`statistical_analysis.py`):\n   - A/B testing with multiple statistical tests (Chi-square, Z-test)\n   - Fisher's Exact Test and Barnard's Exact Test support\n   - Chi-square with Yates' correction and G-test for likelihood ratios\n   - Confidence interval calculations and effect size measurements (Cohen's h)\n   - Advanced statistical metrics and comprehensive result formatting\n\n2. **API Layer** (`app.py`):\n   - Single POST endpoint `/api/calculate` for statistical computations\n   - JSON input/output with comprehensive validation\n   - Error handling for invalid inputs and edge cases\n   - Static file serving for Angular frontend integration\n\n3. **Application Entry Point** (`main.py`): Development server configuration\n\n### Frontend Components\n\n1. **Main Application** (`app.component.ts`): Root component with hero section and navigation\n2. **Form Component** (`ab-test-form.component.ts`): Input interface with validation for A/B test data\n3. **Results Component** (`ab-test-results.component.ts`): Statistical results display with Chart.js visualizations\n4. **Concepts Component** (`statistical-concepts.component.ts`): Educational content about statistical testing\n5. **Service Layer** (`ab-test.service.ts`): HTTP service for API communication\n\n### Data Models\n\n**AbTestInput Interface**:\n- `control_size`: Sample size of control group\n- `control_conversions`: Number of conversions in control group\n- `variation_size`: Sample size of variation group  \n- `variation_conversions`: Number of conversions in variation group\n\n**AbTestResults Interface**:\n- Individual group statistics (conversion rates, confidence intervals)\n- Difference metrics (absolute, relative, confidence intervals)\n- Statistical test results (chi-square, z-test, Fisher's exact, Barnard's exact, G-test)\n- Effect size calculations and interpretations\n- Significance determination and recommendations\n\n## Data Flow\n\n1. **User Input**: Users enter A/B test data (sample sizes and conversions) via Angular form\n2. **Validation**: Frontend validates inputs before submission\n3. **API Request**: Angular service sends POST request to `/api/calculate`\n4. **Statistical Processing**: Flask backend processes data using NumPy/SciPy\n5. **Results Return**: Comprehensive statistical results returned as JSON\n6. **Visualization**: Angular displays results with charts and statistical interpretations\n\n## External Dependencies\n\n### Backend Dependencies\n- **Flask 3.1.1+**: Web framework and API layer\n- **NumPy 2.2.5+**: Numerical computing and array operations\n- **SciPy 1.15.3+**: Advanced statistical functions and tests\n- **Gunicorn 23.0.0+**: Production WSGI server\n- **psycopg2-binary**: PostgreSQL adapter (for future database integration)\n- **email-validator**: Email validation utilities\n- **flask-sqlalchemy**: SQLAlchemy integration for Flask\n\n### Frontend Dependencies\n- **Angular 19.2.14**: Complete frontend framework with TypeScript support\n- **Bootstrap 5.3.6**: CSS framework for responsive design and components\n- **Chart.js 4.4.9**: Data visualization library for statistical charts\n- **RxJS 7.8.2**: Reactive programming library for HTTP operations\n\n### External CDN Resources\n- **Bootstrap Dark Theme**: Replit-hosted Bootstrap theme (`https://cdn.replit.com/agent/bootstrap-agent-dark-theme.min.css`)\n- **Font Awesome 6.4.0**: Icon library from Cloudflare CDN\n\n## Deployment Strategy\n\n### Development Environment\n- **Platform**: Replit with multi-language support (Python 3.12 + Node.js 20)\n- **Process Management**: Gunicorn with `--reload` flag for development\n- **Port Configuration**: Internal port 5000 mapped to external port 80\n- **Build Process**: Angular CLI builds to `frontend/dist/` served by Flask\n\n### Production Deployment\n- **Autoscale Deployment**: Configured for automatic scaling based on demand\n- **Process Management**: Gunicorn with optimized worker configuration\n- **Static Assets**: Angular production build with optimization and minification\n- **Error Handling**: Comprehensive error responses and logging\n\n### Architectural Decisions\n\n1. **Single-page Application**: Chosen for better user experience and real-time calculations\n2. **RESTful API**: Simple, stateless design for easy testing and integration\n3. **Scientific Libraries**: NumPy/SciPy selected for robust, peer-reviewed statistical implementations\n4. **Standalone Components**: Angular standalone architecture for better tree-shaking and performance\n5. **Dark Theme**: Modern UI design with comprehensive CSS variable system for maintainability\n\n## Getting Started\n\n### Prerequisites\n- Python 3.12+\n- Node.js 20+\n- npm or yarn\n\n### Installation\n\n1. **Backend Setup**:\n   ```bash\n   pip install -r requirements.txt\n   # or using uv\n   uv sync\n   ```\n\n2. **Frontend Setup**:\n   ```bash\n   cd frontend\n   npm install\n   ng build --configuration production\n   ```\n\n3. **Run the Application**:\n   ```bash\n   python main.py\n   # or using gunicorn\n   gunicorn --bind 0.0.0.0:5000 --reload main:app\n   ```\n\n4. **Access the Application**:\n   - Open your browser to `http://localhost:5000`\n   - Enter A/B test data and calculate statistical significance\n\n### Development Workflow\n\n1. **Backend Development**: Edit Python files in the root directory\n2. **Frontend Development**: Work in `frontend/src/` and rebuild using `ng build`\n3. **Testing**: Use the web interface to validate statistical calculations\n4. **Deployment**: Push to production with proper environment configuration\n\n## Features\n\n### Statistical Tests Supported\n- **Chi-square Test**: With Yates' continuity correction\n- **Z-test for Proportions**: Standard normal test for proportion differences\n- **Fisher's Exact Test**: Exact test for independence in 2x2 tables\n- **Barnard's Exact Test**: More powerful alternative to Fisher's exact test\n- **G-test**: Likelihood ratio test for independence\n\n### Calculations Provided\n- Conversion rates with confidence intervals\n- Absolute and relative difference measurements\n- Effect size (Cohen's h) with interpretation\n- P-values and statistical significance determination\n- Recommended sample sizes for future tests\n\n### User Interface Features\n- Professional dark theme with Bootstrap styling\n- Interactive form with real-time validation\n- Chart.js visualizations for data comparison\n- Educational content about statistical concepts\n- Responsive design for mobile and desktop\n\n## Changelog\n\n- **June 14, 2025**: Renamed ab_test.py to statistical_analysis.py to reflect comprehensive test suite\n- **June 14, 2025**: Upgraded to Python 3.12.7 with latest NumPy (2.2.5) and SciPy (1.15.3)\n- **June 14, 2025**: Initial setup and platform development\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## User Preferences\n\nPreferred communication style: Simple, everyday language.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqianqianq%2Fstats-test-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqianqianq%2Fstats-test-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqianqianq%2Fstats-test-analyzer/lists"}