https://github.com/erlete/scoretree
Easy to use, multi-level grade weighting system
https://github.com/erlete/scoretree
grade grading-system score scoreboard tree
Last synced: about 1 month ago
JSON representation
Easy to use, multi-level grade weighting system
- Host: GitHub
- URL: https://github.com/erlete/scoretree
- Owner: erlete
- License: agpl-3.0
- Created: 2023-11-15T02:51:10.000Z (over 2 years ago)
- Default Branch: stable
- Last Pushed: 2023-12-21T14:13:08.000Z (over 2 years ago)
- Last Synced: 2025-09-29T13:23:46.680Z (9 months ago)
- Topics: grade, grading-system, score, scoreboard, tree
- Language: Python
- Homepage: https://pypi.org/project/scoretree
- Size: 66.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScoreTree
[](https://github.com/erlete/scoretree/actions/workflows/python-publish.yml) [](https://github.com/erlete/scoretree/actions/workflows/python-tests.yml) [](https://coveralls.io/github/erlete/scoretree?branch=stable) 
**ScoreTree is an *easy to use*, *multi-level* grade weighting system that serves as excellent tool for cascade grading methods.**
## Installation
This package [has been released through PyPI](https://pypi.org/project/scoretree/), so it can be installed using Python's `pip` module:
```shell
python -m pip install scoretree
```
> [!NOTE]
> The command above asumes that your Python interpreter is aliased to `python` and references a version equal to or greater than 3.10
Alternatively, it is also possible to clone this repository and install the package via `pip` and/or `build`.
## Usage
Here is an usage example. Feel free to take a look at [other examples](src/examples/) in the corresponding section of the repository.
```python
from scoretree import Score, ScoreArea, ScoreTree
# Define a score tree:
st = ScoreTree([
# Add a list of areas to be evaluated:
ScoreArea(name=f"Simulation", weight=1, items=[
# Each area can contain other areas and/or scores:
ScoreArea("Stop maneuver", .2, [
# Scores are the minimal grading unit:
Score(
name="Distance to end",
weight=.8,
score_range=(0, 10),
value=9.8848,
inverse=True
),
Score("Deceleration intensity", .2, (0, 20), value=185555)
]),
# Different instance creation syntax:
ScoreArea("Track performance", .8, [
Score("Speed", .3, (0, 20), 5),
ScoreArea("Efficiency", .7, [
Score("Track time", .5, (0, 40), 30),
Score("Track distance", .5, (0, 200), value=10, inverse=True)
])
])
])
], colorized=True) # Enable or disable colorized output.
print(f"Total simulation score: {st.score}")
```
This would be the colorized output for the code snippet above:

## Contributing
Since this is a very small project that can be easily improved and can expand its functionality way further down the development process, any contributions, suggestions or bug reports are more than welcome!