pychanga 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pychanga-0.1.0/.gitignore +152 -0
- pychanga-0.1.0/LICENSE +21 -0
- pychanga-0.1.0/PKG-INFO +83 -0
- pychanga-0.1.0/README.md +55 -0
- pychanga-0.1.0/dev/dashboard/README.md +32 -0
- pychanga-0.1.0/dev/dashboard/honours/README.md +12 -0
- pychanga-0.1.0/dev/dashboard/league_journey/README.md +12 -0
- pychanga-0.1.0/dev/dashboard/rivals/README.md +12 -0
- pychanga-0.1.0/pychanga/__init__.py +50 -0
- pychanga-0.1.0/pychanga/base/__init__.py +0 -0
- pychanga-0.1.0/pychanga/base/db.py +141 -0
- pychanga-0.1.0/pychanga/base/definitions.py +85 -0
- pychanga-0.1.0/pychanga/base/directory.py +154 -0
- pychanga-0.1.0/pychanga/base/protocols.py +84 -0
- pychanga-0.1.0/pychanga/base/tools.py +218 -0
- pychanga-0.1.0/pychanga/city.py +22 -0
- pychanga-0.1.0/pychanga/cli.py +25 -0
- pychanga-0.1.0/pychanga/competition.py +981 -0
- pychanga-0.1.0/pychanga/completeness.py +47 -0
- pychanga-0.1.0/pychanga/edition.py +224 -0
- pychanga-0.1.0/pychanga/ground.py +230 -0
- pychanga-0.1.0/pychanga/io/csv_to_pych.py +416 -0
- pychanga-0.1.0/pychanga/io/parquet_to_json.py +56 -0
- pychanga-0.1.0/pychanga/matches.py +80 -0
- pychanga-0.1.0/pychanga/py.typed +0 -0
- pychanga-0.1.0/pychanga/sport.py +20 -0
- pychanga-0.1.0/pychanga/stage.py +888 -0
- pychanga-0.1.0/pychanga/stats/__init__.py +4 -0
- pychanga-0.1.0/pychanga/stats/distance.py +916 -0
- pychanga-0.1.0/pychanga/stats/elo.py +341 -0
- pychanga-0.1.0/pychanga/stats/goleadas.py +6 -0
- pychanga-0.1.0/pychanga/stats/h2h.py +612 -0
- pychanga-0.1.0/pychanga/stats/performance.py +557 -0
- pychanga-0.1.0/pychanga/stats/streaks.py +194 -0
- pychanga-0.1.0/pychanga/table.py +75 -0
- pychanga-0.1.0/pychanga/team.py +1168 -0
- pychanga-0.1.0/pyproject.toml +104 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# data and old code
|
|
2
|
+
data/
|
|
3
|
+
old/
|
|
4
|
+
sample/
|
|
5
|
+
testing/
|
|
6
|
+
database.ini
|
|
7
|
+
|
|
8
|
+
# Byte-compiled / optimized / DLL files
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[cod]
|
|
11
|
+
*$py.class
|
|
12
|
+
|
|
13
|
+
# editor config
|
|
14
|
+
.vscode/
|
|
15
|
+
|
|
16
|
+
# C extensions
|
|
17
|
+
*.so
|
|
18
|
+
|
|
19
|
+
# Distribution / packaging
|
|
20
|
+
.Python
|
|
21
|
+
build/
|
|
22
|
+
develop-eggs/
|
|
23
|
+
dist/
|
|
24
|
+
downloads/
|
|
25
|
+
eggs/
|
|
26
|
+
.eggs/
|
|
27
|
+
lib/
|
|
28
|
+
lib64/
|
|
29
|
+
parts/
|
|
30
|
+
sdist/
|
|
31
|
+
var/
|
|
32
|
+
wheels/
|
|
33
|
+
pip-wheel-metadata/
|
|
34
|
+
share/python-wheels/
|
|
35
|
+
*.egg-info/
|
|
36
|
+
.installed.cfg
|
|
37
|
+
*.egg
|
|
38
|
+
MANIFEST
|
|
39
|
+
|
|
40
|
+
# PyInstaller
|
|
41
|
+
# Usually these files are written by a python script from a template
|
|
42
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
43
|
+
*.manifest
|
|
44
|
+
*.spec
|
|
45
|
+
|
|
46
|
+
# Installer logs
|
|
47
|
+
pip-log.txt
|
|
48
|
+
pip-delete-this-directory.txt
|
|
49
|
+
|
|
50
|
+
# Unit test / coverage reports
|
|
51
|
+
htmlcov/
|
|
52
|
+
.tox/
|
|
53
|
+
.nox/
|
|
54
|
+
.coverage
|
|
55
|
+
.coverage.*
|
|
56
|
+
.cache
|
|
57
|
+
nosetests.xml
|
|
58
|
+
coverage.xml
|
|
59
|
+
*.cover
|
|
60
|
+
*.py,cover
|
|
61
|
+
.hypothesis/
|
|
62
|
+
.pytest_cache/
|
|
63
|
+
|
|
64
|
+
# Translations
|
|
65
|
+
*.mo
|
|
66
|
+
*.pot
|
|
67
|
+
|
|
68
|
+
# Django stuff:
|
|
69
|
+
*.log
|
|
70
|
+
local_settings.py
|
|
71
|
+
db.sqlite3
|
|
72
|
+
db.sqlite3-journal
|
|
73
|
+
|
|
74
|
+
# Flask stuff:
|
|
75
|
+
instance/
|
|
76
|
+
.webassets-cache
|
|
77
|
+
|
|
78
|
+
# Scrapy stuff:
|
|
79
|
+
.scrapy
|
|
80
|
+
|
|
81
|
+
# Sphinx documentation
|
|
82
|
+
docs/_build/
|
|
83
|
+
|
|
84
|
+
# PyBuilder
|
|
85
|
+
target/
|
|
86
|
+
|
|
87
|
+
# Jupyter Notebook
|
|
88
|
+
.ipynb_checkpoints
|
|
89
|
+
|
|
90
|
+
# IPython
|
|
91
|
+
profile_default/
|
|
92
|
+
ipython_config.py
|
|
93
|
+
|
|
94
|
+
# pyenv
|
|
95
|
+
.python-version
|
|
96
|
+
|
|
97
|
+
# pipenv
|
|
98
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
99
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
100
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
101
|
+
# install all needed dependencies.
|
|
102
|
+
#Pipfile.lock
|
|
103
|
+
|
|
104
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
105
|
+
__pypackages__/
|
|
106
|
+
|
|
107
|
+
# Celery stuff
|
|
108
|
+
celerybeat-schedule
|
|
109
|
+
celerybeat.pid
|
|
110
|
+
|
|
111
|
+
# SageMath parsed files
|
|
112
|
+
*.sage.py
|
|
113
|
+
|
|
114
|
+
# Environments
|
|
115
|
+
.env
|
|
116
|
+
.venv
|
|
117
|
+
env/
|
|
118
|
+
venv/
|
|
119
|
+
ENV/
|
|
120
|
+
env.bak/
|
|
121
|
+
venv.bak/
|
|
122
|
+
|
|
123
|
+
# Spyder project settings
|
|
124
|
+
.spyderproject
|
|
125
|
+
.spyproject
|
|
126
|
+
|
|
127
|
+
# Rope project settings
|
|
128
|
+
.ropeproject
|
|
129
|
+
|
|
130
|
+
# mkdocs documentation
|
|
131
|
+
/site
|
|
132
|
+
|
|
133
|
+
# mypy
|
|
134
|
+
.mypy_cache/
|
|
135
|
+
.dmypy.json
|
|
136
|
+
dmypy.json
|
|
137
|
+
|
|
138
|
+
# Pyre type checker
|
|
139
|
+
.pyre/
|
|
140
|
+
**__pycache__
|
|
141
|
+
|
|
142
|
+
# PyCharm
|
|
143
|
+
.idea/
|
|
144
|
+
|
|
145
|
+
# RStudio project files
|
|
146
|
+
**.Rproj.user/
|
|
147
|
+
**.Rproj.user*
|
|
148
|
+
**.Rproj
|
|
149
|
+
**.Rhistory
|
|
150
|
+
|
|
151
|
+
# MacOS
|
|
152
|
+
.DS_Store
|
pychanga-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Saldivia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pychanga-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pychanga
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: sports db manager
|
|
5
|
+
Project-URL: Homepage, https://github.com/DavidSaldivia/pychanga
|
|
6
|
+
Project-URL: Repository, https://github.com/DavidSaldivia/pychanga
|
|
7
|
+
Project-URL: Issues, https://github.com/DavidSaldivia/pychanga/issues
|
|
8
|
+
Author-email: David Saldivia <david.saldivia.s@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: database,football,polars,sports,statistics
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: <4.0,>=3.12
|
|
21
|
+
Requires-Dist: great-tables<0.19.0,>=0.18.0
|
|
22
|
+
Requires-Dist: matplotlib>=3.9.2
|
|
23
|
+
Requires-Dist: numpy>=2.0
|
|
24
|
+
Requires-Dist: plotly>=5.24.1
|
|
25
|
+
Requires-Dist: polars>=1.9.0
|
|
26
|
+
Requires-Dist: rich<15.0.0,>=14.1.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
*-# pychanga - python-based sports database manager
|
|
30
|
+
|
|
31
|
+
Pychanga (pronounced as the Chilean Spanish word) is a light-weight sports database manager written in python, using polars and parquet files. It is the db manager in golessonamores.cl, a Chilean football stats website launched in 2018. This code started as a rewritten version of this website's original code (written in php). As a python package aims to provide support for different sports and its user target are sports stats aficionados with some basic python knowledge and access to data.
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
install it with pip:
|
|
35
|
+
py -m pip install pychanga
|
|
36
|
+
|
|
37
|
+
## Data configuration
|
|
38
|
+
pychanga is now data-root driven. Your app must point pychanga to a folder that contains:
|
|
39
|
+
- `parquet/*.parquet` for runtime queries
|
|
40
|
+
- optionally `csv/*.csv` if you run conversion scripts
|
|
41
|
+
|
|
42
|
+
You can configure it in two ways:
|
|
43
|
+
- Environment variable: `PYCHANGA_DATA_DIR=/path/to/data_root`
|
|
44
|
+
- Runtime setup:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import pychanga as pc
|
|
48
|
+
|
|
49
|
+
pc.set_data_dir("/path/to/data_root")
|
|
50
|
+
comp = pc.Competition("CHI-1A")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If neither is configured, pychanga will try a local `.dirs` file (for backwards compatibility), and then a bundled sample dataset.
|
|
54
|
+
|
|
55
|
+
## Build sample dataset
|
|
56
|
+
To generate a minimal sample dataset from your Golessonamores data:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
python dev/build_sample_dataset.py \
|
|
60
|
+
--source-data-dir /path/to/golessonamores/data \
|
|
61
|
+
--target-data-dir sample \
|
|
62
|
+
--comp-id CHI-1A \
|
|
63
|
+
--edition-id CHI-1A-1994
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This creates `sample/parquet/*.parquet` with only:
|
|
67
|
+
- competition `CHI-1A`
|
|
68
|
+
- edition `CHI-1A-1994`
|
|
69
|
+
- teams that appear in those matches
|
|
70
|
+
- related reference tables (sports, countries, stages, sources, etc.)
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
- It provides some classes to represent sports entities, such as: Competition, Edition, Team, Player, Match, Ground, Sport, among others.
|
|
74
|
+
- It provides classes to ask some common queries, such as: HeadToHead, Streaks,
|
|
75
|
+
- Each class provides methods to retrieve stats based on an id.
|
|
76
|
+
- The queries are all written in polars' DSL (domain specific language)
|
|
77
|
+
|
|
78
|
+
## Example
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
## Collaboration
|
|
83
|
+
|
pychanga-0.1.0/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
*-# pychanga - python-based sports database manager
|
|
2
|
+
|
|
3
|
+
Pychanga (pronounced as the Chilean Spanish word) is a light-weight sports database manager written in python, using polars and parquet files. It is the db manager in golessonamores.cl, a Chilean football stats website launched in 2018. This code started as a rewritten version of this website's original code (written in php). As a python package aims to provide support for different sports and its user target are sports stats aficionados with some basic python knowledge and access to data.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
install it with pip:
|
|
7
|
+
py -m pip install pychanga
|
|
8
|
+
|
|
9
|
+
## Data configuration
|
|
10
|
+
pychanga is now data-root driven. Your app must point pychanga to a folder that contains:
|
|
11
|
+
- `parquet/*.parquet` for runtime queries
|
|
12
|
+
- optionally `csv/*.csv` if you run conversion scripts
|
|
13
|
+
|
|
14
|
+
You can configure it in two ways:
|
|
15
|
+
- Environment variable: `PYCHANGA_DATA_DIR=/path/to/data_root`
|
|
16
|
+
- Runtime setup:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import pychanga as pc
|
|
20
|
+
|
|
21
|
+
pc.set_data_dir("/path/to/data_root")
|
|
22
|
+
comp = pc.Competition("CHI-1A")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If neither is configured, pychanga will try a local `.dirs` file (for backwards compatibility), and then a bundled sample dataset.
|
|
26
|
+
|
|
27
|
+
## Build sample dataset
|
|
28
|
+
To generate a minimal sample dataset from your Golessonamores data:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python dev/build_sample_dataset.py \
|
|
32
|
+
--source-data-dir /path/to/golessonamores/data \
|
|
33
|
+
--target-data-dir sample \
|
|
34
|
+
--comp-id CHI-1A \
|
|
35
|
+
--edition-id CHI-1A-1994
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This creates `sample/parquet/*.parquet` with only:
|
|
39
|
+
- competition `CHI-1A`
|
|
40
|
+
- edition `CHI-1A-1994`
|
|
41
|
+
- teams that appear in those matches
|
|
42
|
+
- related reference tables (sports, countries, stages, sources, etc.)
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
- It provides some classes to represent sports entities, such as: Competition, Edition, Team, Player, Match, Ground, Sport, among others.
|
|
46
|
+
- It provides classes to ask some common queries, such as: HeadToHead, Streaks,
|
|
47
|
+
- Each class provides methods to retrieve stats based on an id.
|
|
48
|
+
- The queries are all written in polars' DSL (domain specific language)
|
|
49
|
+
|
|
50
|
+
## Example
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
## Collaboration
|
|
55
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Dashboard Workspace
|
|
2
|
+
|
|
3
|
+
This folder contains web dashboards for interactive football statistics built on top of `pychanga` data models.
|
|
4
|
+
|
|
5
|
+
## Dashboards
|
|
6
|
+
|
|
7
|
+
- `h2h`: Head-to-head explorer (implemented)
|
|
8
|
+
- `league_journey`: planned
|
|
9
|
+
- `honours`: planned
|
|
10
|
+
- `rivals`: planned
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
1. Install project dependencies with Poetry (from repository root):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
poetry install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. Run the first dashboard:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
poetry run python dashboard/h2h/app.py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. Open your browser at:
|
|
27
|
+
|
|
28
|
+
- http://127.0.0.1:8050
|
|
29
|
+
|
|
30
|
+
## Plan
|
|
31
|
+
|
|
32
|
+
See `dashboard/IMPLEMENTATION_PLAN.md` for the full roadmap.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Honours Dashboard
|
|
2
|
+
|
|
3
|
+
Status: planned
|
|
4
|
+
|
|
5
|
+
This dashboard will focus on champions and title distribution insights.
|
|
6
|
+
|
|
7
|
+
Planned features:
|
|
8
|
+
|
|
9
|
+
- Competition selector
|
|
10
|
+
- Champions distribution charts
|
|
11
|
+
- Timeline / decade comparison
|
|
12
|
+
- Team comparison mode
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# League Journey Dashboard
|
|
2
|
+
|
|
3
|
+
Status: planned
|
|
4
|
+
|
|
5
|
+
This dashboard will focus on interactive team evolution across league levels and seasons.
|
|
6
|
+
|
|
7
|
+
Planned features:
|
|
8
|
+
|
|
9
|
+
- Team selector
|
|
10
|
+
- Competition/division filters
|
|
11
|
+
- Championship markers
|
|
12
|
+
- Season drilldown
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
from pychanga.competition import Competition
|
|
4
|
+
from pychanga.edition import Edition
|
|
5
|
+
# from pychanga.matches import Matches
|
|
6
|
+
from pychanga.team import Team
|
|
7
|
+
from pychanga.ground import Ground
|
|
8
|
+
from pychanga.base.directory import clear_data_dir, get_data_dir, set_data_dir
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"Competition",
|
|
12
|
+
"Edition",
|
|
13
|
+
"Team",
|
|
14
|
+
"Ground",
|
|
15
|
+
"set_data_dir",
|
|
16
|
+
"clear_data_dir",
|
|
17
|
+
"get_data_dir",
|
|
18
|
+
] # , "Matches"]
|
|
19
|
+
|
|
20
|
+
CHAOS_INDEX: float = 0.9
|
|
21
|
+
|
|
22
|
+
class Sorry:
|
|
23
|
+
|
|
24
|
+
def __repr__(self):
|
|
25
|
+
return f"""Hi, developer from the future
|
|
26
|
+
The last Chaos Index update is:
|
|
27
|
+
{self.category()}. Updated last time {time.strftime()}.
|
|
28
|
+
{self.the_mess()}
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def category(self):
|
|
32
|
+
return CHAOS_INDEX
|
|
33
|
+
|
|
34
|
+
def the_mess(self):
|
|
35
|
+
match CHAOS_INDEX:
|
|
36
|
+
case 0.0:
|
|
37
|
+
the_mess = "Heat Death"
|
|
38
|
+
case bin if 0.0 < bin < 10.0:
|
|
39
|
+
the_mess = "Low entropy. Probably the project is terminal."
|
|
40
|
+
case bin if 10.0 <= bin < 40.0:
|
|
41
|
+
the_mess = "Zen mode. Wow. The dev is happy with its life, oddly. Or the project is stable."
|
|
42
|
+
case bin if 40.0 <= bin < 70.0:
|
|
43
|
+
the_mess = "Medium. Danger zone! Take care of yourself, mate!"
|
|
44
|
+
case bin if 70.0 <= bin < 90.0:
|
|
45
|
+
the_mess = "this shit is either skyrocketing or exploding."
|
|
46
|
+
case bin if 90.0 <= bin:
|
|
47
|
+
the_mess = "what the fuck is goin on."
|
|
48
|
+
case _:
|
|
49
|
+
the_mess = None
|
|
50
|
+
return the_mess
|
|
File without changes
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import polars as pl
|
|
2
|
+
|
|
3
|
+
from pychanga.base import definitions
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SCHEMA:
|
|
7
|
+
changes = {
|
|
8
|
+
"type": str,
|
|
9
|
+
"sport_id": str,
|
|
10
|
+
"ID": str,
|
|
11
|
+
"name": str,
|
|
12
|
+
"date": str,
|
|
13
|
+
"obs": str,
|
|
14
|
+
}
|
|
15
|
+
comps = {
|
|
16
|
+
"comp_id": str,
|
|
17
|
+
"name": str,
|
|
18
|
+
"country_id": str,
|
|
19
|
+
"format": pl.Enum(definitions.COMPS_FORMATS.keys()),
|
|
20
|
+
"sport_id": pl.String,
|
|
21
|
+
"description": str,
|
|
22
|
+
"order": int,
|
|
23
|
+
"show_web": bool,
|
|
24
|
+
}
|
|
25
|
+
countries = {
|
|
26
|
+
"country_id": str,
|
|
27
|
+
"name": str,
|
|
28
|
+
"name_eng": str,
|
|
29
|
+
"confederation": str,
|
|
30
|
+
}
|
|
31
|
+
editions = {
|
|
32
|
+
"edition_id": pl.String,
|
|
33
|
+
"name": pl.String,
|
|
34
|
+
"comp_id": pl.String,
|
|
35
|
+
"ed": pl.Int16,
|
|
36
|
+
"season": pl.String,
|
|
37
|
+
"winner": pl.String,
|
|
38
|
+
"ladder_id": pl.String,
|
|
39
|
+
}
|
|
40
|
+
ladder_obs = {
|
|
41
|
+
"edition_id": pl.String,
|
|
42
|
+
"stage_id": pl.String,
|
|
43
|
+
"team_id": pl.String,
|
|
44
|
+
"type": pl.Enum(definitions.LADDER_OBS_TYPES.keys()),
|
|
45
|
+
"pts_adm": pl.Int16,
|
|
46
|
+
"GF_adm": pl.Int16,
|
|
47
|
+
"GC_adm": pl.Int16,
|
|
48
|
+
"obs": pl.String,
|
|
49
|
+
}
|
|
50
|
+
ladder_type = {
|
|
51
|
+
"ladder_id": pl.String,
|
|
52
|
+
"show": pl.String,
|
|
53
|
+
"order": pl.String,
|
|
54
|
+
"pts_calc": pl.String,
|
|
55
|
+
}
|
|
56
|
+
sources = {
|
|
57
|
+
"source_id": str,
|
|
58
|
+
"description": str,
|
|
59
|
+
"type": pl.Enum(definitions.SOURCES_TYPES),
|
|
60
|
+
}
|
|
61
|
+
sports = {
|
|
62
|
+
"sport_id": str,
|
|
63
|
+
"name_esp": str,
|
|
64
|
+
"name_eng": str,
|
|
65
|
+
"gov_body": str,
|
|
66
|
+
"abrv": str,
|
|
67
|
+
"n_members": str,
|
|
68
|
+
"biggest_comp": str,
|
|
69
|
+
"team_size": int,
|
|
70
|
+
"ball_type": pl.Categorical,
|
|
71
|
+
"family": pl.Categorical,
|
|
72
|
+
"pro": bool,
|
|
73
|
+
"since": str,
|
|
74
|
+
"other_names": str,
|
|
75
|
+
}
|
|
76
|
+
stages = {
|
|
77
|
+
"stage_id": pl.String,
|
|
78
|
+
"name": pl.String,
|
|
79
|
+
"order": pl.Int64,
|
|
80
|
+
"description": pl.String,
|
|
81
|
+
"ladder": pl.Boolean,
|
|
82
|
+
}
|
|
83
|
+
teams = {
|
|
84
|
+
"team_id": str,
|
|
85
|
+
"name": str,
|
|
86
|
+
"country_id": str,
|
|
87
|
+
"sport_id": pl.String,
|
|
88
|
+
"badge": bool,
|
|
89
|
+
"current": bool,
|
|
90
|
+
"obs": str,
|
|
91
|
+
"full_name": str,
|
|
92
|
+
"location": str,
|
|
93
|
+
"founded": str,
|
|
94
|
+
"ground": str,
|
|
95
|
+
"nicknames": str,
|
|
96
|
+
"colours_main": pl.List(pl.Utf8),
|
|
97
|
+
"colours_other": pl.List(pl.Utf8),
|
|
98
|
+
}
|
|
99
|
+
matches = {
|
|
100
|
+
"match_id": pl.Int64,
|
|
101
|
+
"comp_id": pl.String,
|
|
102
|
+
"edition_id": pl.String,
|
|
103
|
+
"day": pl.String,
|
|
104
|
+
"month": pl.String,
|
|
105
|
+
"year": pl.String,
|
|
106
|
+
"stage": pl.String,
|
|
107
|
+
"round": pl.Int8,
|
|
108
|
+
"team_1": pl.String,
|
|
109
|
+
"team_2": pl.String,
|
|
110
|
+
"goal_1": pl.String,
|
|
111
|
+
"goal_2": pl.String,
|
|
112
|
+
"pen_1": pl.String,
|
|
113
|
+
"pen_2": pl.String,
|
|
114
|
+
"host": pl.Categorical,
|
|
115
|
+
"venue": pl.Categorical,
|
|
116
|
+
"location": pl.Categorical,
|
|
117
|
+
"attendance": pl.Int32,
|
|
118
|
+
"referee": pl.Categorical,
|
|
119
|
+
"obs_ext": pl.String,
|
|
120
|
+
"obs_int": pl.String,
|
|
121
|
+
"source_id": pl.Categorical,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
FOREIGN_KEYS = {
|
|
126
|
+
("changes", "sport_id"): ("sports", "sport_id"),
|
|
127
|
+
("comps", "sport_id"): ("sports", "sport_id"),
|
|
128
|
+
("editions", "comp_id"): ("comps", "comp_id"),
|
|
129
|
+
("editions", "winner"): ("teams", "team_id"),
|
|
130
|
+
("editions", "ladder_id"): ("ladder_type", "ladder_id"),
|
|
131
|
+
("ladder_obs", "edition_id"): ("editions", "edition_id"),
|
|
132
|
+
("ladder_obs", "stage_id"): ("stages", "stage_id"),
|
|
133
|
+
("ladder_obs", "team_id"): ("teams", "team_id"),
|
|
134
|
+
("teams", "sport_id"): ("sports", "sport_id"),
|
|
135
|
+
("matches", "comp_id"): ("comps", "comp_id"),
|
|
136
|
+
("matches", "edition_id"): ("editions", "edition_id"),
|
|
137
|
+
("matches", "stage_id"): ("stages", "stage_id"),
|
|
138
|
+
("matches", "team_1"): ("teams", "team_id"),
|
|
139
|
+
("matches", "team_2"): ("teams", "team_id"),
|
|
140
|
+
("matches", "source_id"): ("sources", "source_id"),
|
|
141
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
COMPS_FORMATS = {
|
|
2
|
+
"league": "round-robin competition",
|
|
3
|
+
"mini-league": "short league",
|
|
4
|
+
"inter": "international competition",
|
|
5
|
+
"amateur": "amateur competition",
|
|
6
|
+
"cup": "knockout competition",
|
|
7
|
+
"other": "rare/uncommon formats",
|
|
8
|
+
"friendly": "friendly competitions",
|
|
9
|
+
}
|
|
10
|
+
SPORTS_NAMES = {
|
|
11
|
+
'FT': 'Association Football',
|
|
12
|
+
'RU': 'Rugby Union',
|
|
13
|
+
'RL': 'Rugby League',
|
|
14
|
+
'RS': 'Rugby Sevens',
|
|
15
|
+
'AF': 'American Football',
|
|
16
|
+
'AU': 'Australian Football',
|
|
17
|
+
'FG': 'Gaelic Football',
|
|
18
|
+
'FC': 'Canadian Football',
|
|
19
|
+
'FS': 'Futsal',
|
|
20
|
+
'FP': 'Beach Soccer',
|
|
21
|
+
'BK': 'Basketball',
|
|
22
|
+
'VO': 'Volleyball',
|
|
23
|
+
'HA': 'Handball',
|
|
24
|
+
'WP': 'Waterpolo',
|
|
25
|
+
'BB': 'Baseball',
|
|
26
|
+
'CR': 'Cricket',
|
|
27
|
+
'HO': 'Field Hockey',
|
|
28
|
+
'HH': 'Ice Hockey',
|
|
29
|
+
'HP': 'Quad Hockey',
|
|
30
|
+
'HL': 'Inline Hockey',
|
|
31
|
+
'BN': 'Bandy',
|
|
32
|
+
'PO': 'Polo',
|
|
33
|
+
'LA': 'Lacrosse',
|
|
34
|
+
'UL': 'Ultimate',
|
|
35
|
+
'FL': 'Floorball',
|
|
36
|
+
'HU': 'Hurling',
|
|
37
|
+
'VP': 'Beach Volleyball',
|
|
38
|
+
'FB': 'Fistball',
|
|
39
|
+
'PD': 'Padel',
|
|
40
|
+
'ST': 'Sepak Takraw',
|
|
41
|
+
'KF': 'Korfball',
|
|
42
|
+
'NE': 'Netball',
|
|
43
|
+
'SB': 'Softball',
|
|
44
|
+
'PP': 'Pesäpallo',
|
|
45
|
+
'KB': 'Kin-Ball',
|
|
46
|
+
'QD': 'Quidditch',
|
|
47
|
+
'SH': 'Shinty',
|
|
48
|
+
'TK': 'Tchoukball',
|
|
49
|
+
'KA': 'Kabbadi',
|
|
50
|
+
}
|
|
51
|
+
SOURCES_TYPES = [
|
|
52
|
+
"news_website",
|
|
53
|
+
"official_website",
|
|
54
|
+
"stats_website",
|
|
55
|
+
"newspaper",
|
|
56
|
+
"book",
|
|
57
|
+
"personal_info",
|
|
58
|
+
]
|
|
59
|
+
LADDER_OBS_TYPES = {
|
|
60
|
+
"Z": "inter-zone",
|
|
61
|
+
"B": "bonus",
|
|
62
|
+
"P": "points",
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
COLORS_ESP_ENG = {
|
|
66
|
+
"azul": "blue",
|
|
67
|
+
"rojo": "red",
|
|
68
|
+
"celeste": "skyblue",
|
|
69
|
+
"verde": "green",
|
|
70
|
+
"marrón": "saddlebrown",
|
|
71
|
+
"blanco": "white",
|
|
72
|
+
"amarillo": "yellow",
|
|
73
|
+
"negro": "black",
|
|
74
|
+
"burdeo": "maroon",
|
|
75
|
+
"naranjo": "orange",
|
|
76
|
+
"rosado": "pink",
|
|
77
|
+
"granate": "maroon",
|
|
78
|
+
"café": "saddlebrown",
|
|
79
|
+
"plomo": "grey",
|
|
80
|
+
"calipso": "turquoise",
|
|
81
|
+
"dorado": "goldenrod",
|
|
82
|
+
"morado": "purple",
|
|
83
|
+
"violeta": "darkviolet",
|
|
84
|
+
"lila": "purple",
|
|
85
|
+
}
|