From b10bb7151fca9e4ce9df0583f82ffda764cc0be4 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 1 Apr 2021 18:31:41 +0000 Subject: [PATCH 1/2] added: .devcontainer .github CONTRIBUTING MAINTAINERS LICENSE README SECURITY moved fiels into correct structure deleted unessasary workflows --- .devcontainer/Dockerfile | 2 + .devcontainer/devcontainer.json | 28 ++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++ .github/workflows/ut-superscript.yml | 38 +++++++++++ .gitignore | 9 +++ CONTRIBUTING.md | 66 +++++++++++++++++++ LICENSE | 29 ++++++++ MAINTAINERS | 3 + README.md | 45 +++++++++++++ SECURITY.md | 6 ++ config.json => src/config.json | 0 data.py => src/data.py | 0 design.kv => src/design.kv | 0 main.py => src/main.py | 0 requirements.txt => src/requirements.txt | 0 superscript.py => src/superscript.py | 0 .../test_superscript.py | 0 18 files changed, 284 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/ut-superscript.yml create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 MAINTAINERS create mode 100644 README.md create mode 100644 SECURITY.md rename config.json => src/config.json (100%) rename data.py => src/data.py (100%) rename design.kv => src/design.kv (100%) rename main.py => src/main.py (100%) rename requirements.txt => src/requirements.txt (100%) rename superscript.py => src/superscript.py (100%) rename test_superscript.py => src/test_superscript.py (100%) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..364066e --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,2 @@ +FROM python +WORKDIR ~/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..a14a6fb --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "TRA Analysis Development Environment", + "build": { + "dockerfile": "Dockerfile", + }, + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": "/usr/local/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", + "python.testing.pytestPath": "/usr/local/py-utils/bin/pytest" + }, + "extensions": [ + "mhutchie.git-graph", + "ms-python.python", + "waderyan.gitblame" + ], + "postCreateCommand": "apt install vim -y ; pip install -r src/requirements.txt ; pip install pylint ; pip install tra-analysis; pip install pytest" +} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/ut-superscript.yml b/.github/workflows/ut-superscript.yml new file mode 100644 index 0000000..fcd2b69 --- /dev/null +++ b/.github/workflows/ut-superscript.yml @@ -0,0 +1,38 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Superscript Unit Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8] + + env: + working-directory: ./data-analysis/ + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + working-directory: ${{ env.working-directory }} + - name: Test with pytest + run: | + pytest + working-directory: ${{ env.working-directory }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c766f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/.vscode/ + +**/__pycache__/ +**/.pytest_cache/ +**/*.pyc + +**/build/ +**/*.egg-info/ +**/dist/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..357ccc4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,66 @@ +# Contributing Guidelines + +This project accept contributions via GitHub pull requests. +This document outlines some of the +conventions on development workflow, commit message formatting, contact points, +and other resources to make it easier to get your contribution accepted. + +## Certificate of Origin + +By contributing to this project, you agree to the [Developer Certificate of +Origin (DCO)](https://developercertificate.org/). This document was created by the Linux Kernel community and is a +simple statement that you, as a contributor, have the legal right to make the +contribution. + +In order to show your agreement with the DCO you should include at the end of the commit message, +the following line: `Signed-off-by: John Doe `, using your real name. + +This can be done easily using the [`-s`](https://github.com/git/git/blob/b2c150d3aa82f6583b9aadfecc5f8fa1c74aca09/Documentation/git-commit.txt#L154-L161) flag on the `git commit`. + +Visual Studio code also has a flag to enable signoff on commits + +If you find yourself pushed a few commits without `Signed-off-by`, you can still add it afterwards. Read this for help: [fix-DCO.md](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md). + +## Support Channels + +The official support channel, for both users and contributors, is: + +- GitHub issues: each repository has its own list of issues. + +*Before opening a new issue or submitting a new pull request, it's helpful to +search the project - it's likely that another user has already reported the +issue you're facing, or it's a known issue that we're already aware of. + + +## How to Contribute +In general, please use conventional approaches to development and contribution such as: +* Create branches for additions or deletions, and or side projects +* Do not commit to master! +* Use Pull Requests (PRs) to indicate that an addition is ready to merge. +PRs are the main and exclusive way to contribute code to source{d} projects. +In order for a PR to be accepted it needs to pass this list of requirements: + +- The contribution must be correctly explained with natural language and providing a minimum working example that reproduces it. +- All PRs must be written idiomaticly: + - for Node: formatted according to [AirBnB standards](https://github.com/airbnb/javascript), and no warnings from `eslint` using the AirBnB style guide + - for other languages, similar constraints apply. +- They should in general include tests, and those shall pass. + - In any case, all the PRs have to pass the personal evaluation of at least one of the [maintainers](MAINTAINERS) of the project. + + +### Format of the commit message + +Every commit message should describe what was changed, under which context and, if applicable, the issue it relates to (mentioning a GitHub issue number when applicable): + +For small changes, or changes to a testing or personal branch, the commit message should be a short changelog entry + +For larger changes or for changes on branches that are more widely used, the commit message should simply reference an entry to some other changelog system. It is encouraged to use some sort of versioning system to log changes. Example commit messages: +``` +superscript.py v 2.0.5.006 +``` + +The format can be described more formally as follows: + +``` + v +``` \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c75239 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2020, Titan Scouting +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..a8923f7 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,3 @@ +Arthur Lu +Jacob Levine +Dev Singh \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b92a97c --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Red Alliance Analysis · ![GitHub release (latest by date)](https://img.shields.io/github/v/release/titanscout2022/red-alliance-analysis) + +Titan Robotics 2022 Strategy Team Repository for Data Analysis Tools. Included with these tools are the backend data analysis engine formatted as a python package, associated binaries for the analysis package, and premade scripts that can be pulled directly from this repository and will integrate with other Red Alliance applications to quickly deploy FRC scouting tools. + +--- + +# `data-analysis` + +To facilitate data analysis of collected scouting data in a user firendly tool, we created the data-analysis application. At its core it uses the tra-analysis package to conduct any number of user selected tests on data collected from the TRA scouting app. It uploads these tests back to MongoDB where it can be viewed from the app at any time. + +The data-analysis application also uses the TRA API to interface with MongoDB and uses the TBA API to collect additional data (match win/loss). + +The application can be configured with a configuration tool or by editing the config.json directly. + +## Prerequisites + +--- + +Before installing and using data-analysis, make sure that you have installed the folowing prerequisites: +- A common operating system like **Windows** or (*most*) distributions of **Linux**. BSD may work but has not been tested nor is it reccomended. +- [Python](https://www.python.org/) version **3.6** or higher +- [Pip](https://pip.pypa.io/en/stable/) (installation instructions [here](https://pip.pypa.io/en/stable/installing/)) + +## Installing Requirements + +--- + +Once navigated to the data-analysis folder run `pip install -r requirements.txt` to install all of the required python libraries. + +## Scripts + +--- + +The data-analysis application is a collection of various scripts and one config file. For users, only the main application `superscript.py` and the config file `config.json` are important. + +To run the data-analysis application, navigate to the data-analysis folder once all requirements have been installed and run `python superscript.py`. If you encounter the error: + +`pymongo.errors.ConfigurationError: Empty host (or extra comma in host list).` + +don't worry, you may have just not configured the application correctly, but would otherwise work. Refer to [the documentation](https://titanscouting.github.io/analysis/data_analysis/Config) to learn how to configure data-analysis. + +--- + +# Build Statuses +![Superscript Unit Tests](https://github.com/titanscout2022/red-alliance-analysis/workflows/Superscript%20Unit%20Tests/badge.svg?branch=master) \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..7754343 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,6 @@ +# Security Policy + + +## Reporting a Vulnerability + +Please email `titanscout2022@gmail.com` to report a vulnerability. diff --git a/config.json b/src/config.json similarity index 100% rename from config.json rename to src/config.json diff --git a/data.py b/src/data.py similarity index 100% rename from data.py rename to src/data.py diff --git a/design.kv b/src/design.kv similarity index 100% rename from design.kv rename to src/design.kv diff --git a/main.py b/src/main.py similarity index 100% rename from main.py rename to src/main.py diff --git a/requirements.txt b/src/requirements.txt similarity index 100% rename from requirements.txt rename to src/requirements.txt diff --git a/superscript.py b/src/superscript.py similarity index 100% rename from superscript.py rename to src/superscript.py diff --git a/test_superscript.py b/src/test_superscript.py similarity index 100% rename from test_superscript.py rename to src/test_superscript.py From 960a1b3165b2eebccb0a47696f840c79f078bbb6 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Thu, 1 Apr 2021 13:38:53 -0500 Subject: [PATCH 2/2] fix ut and file structure --- .../{ut-superscript.yml => superscript-unit.yml} | 8 ++------ {src => test}/test_superscript.py | 0 2 files changed, 2 insertions(+), 6 deletions(-) rename .github/workflows/{ut-superscript.yml => superscript-unit.yml} (76%) rename {src => test}/test_superscript.py (100%) diff --git a/.github/workflows/ut-superscript.yml b/.github/workflows/superscript-unit.yml similarity index 76% rename from .github/workflows/ut-superscript.yml rename to .github/workflows/superscript-unit.yml index fcd2b69..3a4e4c5 100644 --- a/.github/workflows/ut-superscript.yml +++ b/.github/workflows/superscript-unit.yml @@ -17,8 +17,6 @@ jobs: matrix: python-version: [3.7, 3.8] - env: - working-directory: ./data-analysis/ steps: - uses: actions/checkout@v2 @@ -30,9 +28,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - working-directory: ${{ env.working-directory }} + if [ -f src/requirements.txt ]; then pip install -r src/requirements.txt; fi - name: Test with pytest run: | - pytest - working-directory: ${{ env.working-directory }} + pytest test/ diff --git a/src/test_superscript.py b/test/test_superscript.py similarity index 100% rename from src/test_superscript.py rename to test/test_superscript.py