Merge branch 'feature/py39' of bitbucket.org:sanderroosendaal/rowsandall into feature/py39
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
import os
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
class BoatmoversConfig(AppConfig):
|
class BoatmoversConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'boatmovers'
|
name = 'boatmovers'
|
||||||
|
path = os.path.join(settings.BASE_DIR, 'boatmovers')
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-22 17:41
|
|
||||||
|
|
||||||
import boatmovers.models
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Athlete',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('first_name', models.CharField(max_length=200)),
|
|
||||||
('last_name', models.CharField(max_length=200)),
|
|
||||||
('club', models.CharField(max_length=200)),
|
|
||||||
('trueskill_mu', models.FloatField(default=25.0)),
|
|
||||||
('trueskill_sigma', models.FloatField(default=8.333)),
|
|
||||||
('birth_year', models.IntegerField(default=1972)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Crew',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('name', models.CharField(max_length=200)),
|
|
||||||
('athletes', models.ManyToManyField(to='boatmovers.Athlete')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Race',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('date', models.DateField(default=boatmovers.models.current_day)),
|
|
||||||
('crew_size', models.IntegerField(default=1)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Result',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('order', models.PositiveIntegerField()),
|
|
||||||
('crew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='boatmovers.crew')),
|
|
||||||
('race', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='boatmovers.race')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='race',
|
|
||||||
name='resultlist',
|
|
||||||
field=models.ManyToManyField(through='boatmovers.Result', to='boatmovers.Crew'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-22 17:49
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='athlete',
|
|
||||||
unique_together={('first_name', 'last_name', 'birth_year')},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-22 17:53
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0002_alter_athlete_unique_together'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='race',
|
|
||||||
name='name',
|
|
||||||
field=models.CharField(default='Race1', max_length=200),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='race',
|
|
||||||
name='resulturl',
|
|
||||||
field=models.URLField(null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='race',
|
|
||||||
unique_together={('date', 'name')},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-22 18:35
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0003_auto_20220622_1753'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='race',
|
|
||||||
name='verified',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='result',
|
|
||||||
unique_together={('crew', 'race', 'order')},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-22 18:48
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0004_auto_20220622_1835'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='athlete',
|
|
||||||
name='gender',
|
|
||||||
field=models.CharField(choices=[('m', 'M'), ('f', 'F')], default='m', max_length=200),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-24 08:11
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0005_athlete_gender'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='athlete',
|
|
||||||
name='trueskill_exposed',
|
|
||||||
field=models.FloatField(default=0),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='athlete',
|
|
||||||
name='trueskill_sigma',
|
|
||||||
field=models.FloatField(default=8.333333333333334),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-24 08:20
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0006_auto_20220624_0811'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='result',
|
|
||||||
name='crew',
|
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='results', to='boatmovers.crew'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='result',
|
|
||||||
name='race',
|
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='results', to='boatmovers.race'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-24 11:35
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0007_auto_20220624_0820'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='race',
|
|
||||||
name='processed',
|
|
||||||
field=models.BooleanField(default=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='race',
|
|
||||||
name='crew_size',
|
|
||||||
field=models.IntegerField(default=1, verbose_name='Nr of rowers per crew (1, 2, 4, 8)'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-24 12:48
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0008_auto_20220624_1135'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='race',
|
|
||||||
name='crew_size',
|
|
||||||
field=models.IntegerField(choices=[(1, 1), (2, 2), (4, 4), (8, 8)], default=1, verbose_name='Nr of rowers per crew (1, 2, 4, 8)'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-24 12:50
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0009_alter_race_crew_size'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='race',
|
|
||||||
name='resultlist',
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-24 12:53
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0010_remove_race_resultlist'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='race',
|
|
||||||
name='processed',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-25 13:28
|
|
||||||
|
|
||||||
import boatmovers.models
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0011_alter_race_processed'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='crew',
|
|
||||||
name='athletes',
|
|
||||||
field=models.ManyToManyField(related_name='crews', to='boatmovers.Athlete'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='race',
|
|
||||||
name='date',
|
|
||||||
field=models.DateField(default=boatmovers.models.current_day, verbose_name='Race Date'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='race',
|
|
||||||
name='resulturl',
|
|
||||||
field=models.URLField(null=True, verbose_name='URL Link to results'),
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='result',
|
|
||||||
unique_together={('crew', 'order')},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-25 13:31
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0012_auto_20220625_1328'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='crew',
|
|
||||||
name='athletes',
|
|
||||||
field=models.ManyToManyField(related_name='athlete_crews', to='boatmovers.Athlete'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-29 15:45
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0013_alter_crew_athletes'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='athlete',
|
|
||||||
name='dummy',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-29 17:44
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0014_athlete_dummy'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='athlete',
|
|
||||||
unique_together={('first_name', 'last_name', 'birth_year', 'gender')},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-06-29 18:23
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0015_alter_athlete_unique_together'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='race',
|
|
||||||
name='gender',
|
|
||||||
field=models.CharField(choices=[('m', 'M'), ('f', 'F')], default='m', max_length=200),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-07-08 12:37
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('boatmovers', '0016_race_gender'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='athlete',
|
|
||||||
name='full_name',
|
|
||||||
field=models.CharField(default=' ', max_length=200),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
]
|
|
||||||
8
django_extensions/apps.py
Normal file
8
django_extensions/apps.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
import os
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class DjangoExtensionsConfig(AppConfig):
|
||||||
|
name = 'django_extensions'
|
||||||
|
path = os.path.join(settings.BASE_DIR, 'django_extensions')
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
import os
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
# Store metadata for the app
|
# Store metadata for the app
|
||||||
|
|
||||||
|
|
||||||
class RowersConfig(AppConfig):
|
class RowersConfig(AppConfig):
|
||||||
name = 'rowers'
|
name = 'rowers'
|
||||||
|
path = os.path.join(settings.BASE_DIR, 'rowers')
|
||||||
|
|||||||
@@ -786,9 +786,9 @@ def split_workout(r, parent, splitsecond, splitmode):
|
|||||||
data1.fillna(method='bfill', inplace=True)
|
data1.fillna(method='bfill', inplace=True)
|
||||||
|
|
||||||
# Some new stuff to try out
|
# Some new stuff to try out
|
||||||
data1 = data1.groupby('time', axis=0).mean()
|
#data1 = data1.groupby('time', axis=0).mean()
|
||||||
data1['time'] = data1.index
|
#data1['time'] = data1.index
|
||||||
data1.reset_index(drop=True, inplace=True)
|
#data1.reset_index(drop=True, inplace=True)
|
||||||
|
|
||||||
data2 = data2.sort_values(['time'])
|
data2 = data2.sort_values(['time'])
|
||||||
data2 = data2.interpolate(method='linear', axis=0, limit_direction='both',
|
data2 = data2.interpolate(method='linear', axis=0, limit_direction='both',
|
||||||
@@ -796,9 +796,9 @@ def split_workout(r, parent, splitsecond, splitmode):
|
|||||||
data2.fillna(method='bfill', inplace=True)
|
data2.fillna(method='bfill', inplace=True)
|
||||||
|
|
||||||
# Some new stuff to try out
|
# Some new stuff to try out
|
||||||
data2 = data2.groupby('time', axis=0).mean()
|
#data2 = data2.groupby('time', axis=0).mean()
|
||||||
data2['time'] = data2.index
|
#data2['time'] = data2.index
|
||||||
data2.reset_index(drop=True, inplace=True)
|
#data2.reset_index(drop=True, inplace=True)
|
||||||
|
|
||||||
data1['pace'] = data1['pace'] / 1000.
|
data1['pace'] = data1['pace'] / 1000.
|
||||||
data2['pace'] = data2['pace'] / 1000.
|
data2['pace'] = data2['pace'] / 1000.
|
||||||
|
|||||||
@@ -1369,6 +1369,7 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
|||||||
|
|
||||||
extracols = []
|
extracols = []
|
||||||
|
|
||||||
|
|
||||||
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
||||||
columns = [x for x in columns if x != 'None']
|
columns = [x for x in columns if x != 'None']
|
||||||
columns = list(set(columns))
|
columns = list(set(columns))
|
||||||
@@ -1381,27 +1382,35 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
|||||||
elif len(ids) == 1: # pragma: no cover
|
elif len(ids) == 1: # pragma: no cover
|
||||||
try:
|
try:
|
||||||
filename = 'media/strokedata_{id}.parquet.gz'.format(id=ids[0])
|
filename = 'media/strokedata_{id}.parquet.gz'.format(id=ids[0])
|
||||||
df = pd.read_parquet(filename, columns=columns)
|
pq_file = pq.ParquetDataset(filename)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(filename, columns=columns_in_file)
|
||||||
except OSError:
|
except OSError:
|
||||||
rowdata, row = getrowdata(id=ids[0])
|
rowdata, row = getrowdata(id=ids[0])
|
||||||
if rowdata and len(rowdata.df):
|
if rowdata and len(rowdata.df):
|
||||||
_ = dataprep(rowdata.df,
|
_ = dataprep(rowdata.df,
|
||||||
id=ids[0], bands=True, otwpower=True, barchart=True)
|
id=ids[0], bands=True, otwpower=True, barchart=True)
|
||||||
df = pd.read_parquet(filename, columns=columns)
|
pq_file = pq.ParquetDataset(filename)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(filename, columns=columns_in_file)
|
||||||
else:
|
else:
|
||||||
data = []
|
data = []
|
||||||
filenames = [
|
filenames = [
|
||||||
'media/strokedata_{id}.parquet.gz'.format(id=id) for id in ids]
|
'media/strokedata_{id}.parquet.gz'.format(id=id) for id in ids]
|
||||||
for id, f in zip(ids, filenames):
|
for id, f in zip(ids, filenames):
|
||||||
try:
|
try:
|
||||||
df = pd.read_parquet(f, columns=columns)
|
pq_file = pq.ParquetDataset(f)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(f, columns=columns_in_file)
|
||||||
data.append(df)
|
data.append(df)
|
||||||
except (OSError, IndexError, ArrowInvalid):
|
except (OSError, IndexError, ArrowInvalid):
|
||||||
rowdata, row = getrowdata(id=id)
|
rowdata, row = getrowdata(id=id)
|
||||||
if rowdata and len(rowdata.df): # pragma: no cover
|
if rowdata and len(rowdata.df): # pragma: no cover
|
||||||
_ = dataprep(rowdata.df, id=id,
|
_ = dataprep(rowdata.df, id=id,
|
||||||
bands=True, otwpower=True, barchart=True)
|
bands=True, otwpower=True, barchart=True)
|
||||||
df = pd.read_parquet(f, columns=columns)
|
pq_file = pq.ParquetDataset(f)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(f, columns=columns_in_file)
|
||||||
data.append(df)
|
data.append(df)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -1471,7 +1480,7 @@ def datafusion(id1, id2, columns, offset):
|
|||||||
'fpace',
|
'fpace',
|
||||||
'workoutid',
|
'workoutid',
|
||||||
'id'],
|
'id'],
|
||||||
1, errors='ignore')
|
axis=1, errors='ignore')
|
||||||
|
|
||||||
# Add coordinates to DataFrame
|
# Add coordinates to DataFrame
|
||||||
latitude, longitude = get_latlon(id1)
|
latitude, longitude = get_latlon(id1)
|
||||||
@@ -1494,7 +1503,7 @@ def datafusion(id1, id2, columns, offset):
|
|||||||
|
|
||||||
for c in df1.columns:
|
for c in df1.columns:
|
||||||
if c not in keep1:
|
if c not in keep1:
|
||||||
df1 = df1.drop(c, 1, errors='ignore')
|
df1 = df1.drop(c, axis=1, errors='ignore')
|
||||||
|
|
||||||
df = pd.concat([df1, df2], ignore_index=True)
|
df = pd.concat([df1, df2], ignore_index=True)
|
||||||
df = df.sort_values(['time'])
|
df = df.sort_values(['time'])
|
||||||
@@ -1503,9 +1512,9 @@ def datafusion(id1, id2, columns, offset):
|
|||||||
df.fillna(method='bfill', inplace=True)
|
df.fillna(method='bfill', inplace=True)
|
||||||
|
|
||||||
# Some new stuff to try out
|
# Some new stuff to try out
|
||||||
df = df.groupby('time', axis=0).mean()
|
#df = df.groupby('time',axis=0).mean()
|
||||||
df['time'] = df.index
|
#df['time'] = df.index
|
||||||
df.reset_index(drop=True, inplace=True)
|
#df.reset_index(drop=True, inplace=True)
|
||||||
|
|
||||||
df['time'] = df['time'] / 1000.
|
df['time'] = df['time'] / 1000.
|
||||||
df['pace'] = df['pace'] / 1000.
|
df['pace'] = df['pace'] / 1000.
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ def getmaxwattinterval(tt, ww, i):
|
|||||||
w_roll = ww.rolling(i+2).mean().dropna()
|
w_roll = ww.rolling(i+2).mean().dropna()
|
||||||
if len(w_roll):
|
if len(w_roll):
|
||||||
# now goes with # data points - should be fixed seconds
|
# now goes with # data points - should be fixed seconds
|
||||||
indexmax = w_roll.idxmax(axis=1)
|
indexmax = w_roll.idxmax(axis=0)
|
||||||
# indexmaxpos = indexmax.get_loc(indexmax)
|
# indexmaxpos = indexmax.get_loc(indexmax)
|
||||||
indexmaxpos = indexmax
|
indexmaxpos = indexmax
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -3589,8 +3589,9 @@ def interactive_otwcpchart(powerdf, promember=0, rowername="", r=None, cpfit='da
|
|||||||
title = "Critical Power for "+rowername
|
title = "Critical Power for "+rowername
|
||||||
plot.title.text = title
|
plot.title.text = title
|
||||||
|
|
||||||
xaxis = plot.select(dict(type=Axis, layout="below"))[0]
|
#xaxis = plot.select(dict(type=Axis, layout="below")) #[0]
|
||||||
xaxis.formatter = PrintfTickFormatter()
|
#print(xaxis)
|
||||||
|
#xaxis.formatter = PrintfTickFormatter()
|
||||||
|
|
||||||
hover = plot.select(dict(type=HoverTool))
|
hover = plot.select(dict(type=HoverTool))
|
||||||
|
|
||||||
@@ -4654,7 +4655,7 @@ def interactive_chart(id=0, promember=0, intervaldata={}):
|
|||||||
])
|
])
|
||||||
|
|
||||||
hover.mode = 'mouse'
|
hover.mode = 'mouse'
|
||||||
hover.names = ["spm", "pace"]
|
# hover.name = ["spm", "pace"]
|
||||||
|
|
||||||
script, div = components(plot)
|
script, div = components(plot)
|
||||||
|
|
||||||
@@ -4853,18 +4854,17 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
|
|||||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap'
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap'
|
||||||
|
|
||||||
if groupby != 'date':
|
if groupby != 'date':
|
||||||
hover = HoverTool(names=['data'],
|
hover = HoverTool(tooltips=[
|
||||||
tooltips=[
|
(groupby, '@groupval{1.1}'),
|
||||||
(groupby, '@groupval{1.1}'),
|
(xparamname, '@x{1.1}'),
|
||||||
(xparamname, '@x{1.1}'),
|
(yparamname, '@y')
|
||||||
(yparamname, '@y')
|
|
||||||
])
|
])
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
hover = HoverTool(names=['data'],
|
hover = HoverTool(
|
||||||
tooltips=[
|
tooltips=[
|
||||||
(groupby, '@groupval'),
|
(groupby, '@groupval'),
|
||||||
(xparamname, '@x{1.1}'),
|
(xparamname, '@x{1.1}'),
|
||||||
(yparamname, '@y'),
|
(yparamname, '@y'),
|
||||||
])
|
])
|
||||||
|
|
||||||
hover.mode = 'mouse'
|
hover.mode = 'mouse'
|
||||||
@@ -6851,7 +6851,7 @@ def interactive_otw_advanced_pace_chart(id=0, promember=0):
|
|||||||
)
|
)
|
||||||
|
|
||||||
plot.title.text = row.name
|
plot.title.text = row.name
|
||||||
plot.title.text_font_size = value("1.2em")
|
#plot.title.text_font_size = value("1.2em")
|
||||||
plot.xaxis.axis_label = "Time"
|
plot.xaxis.axis_label = "Time"
|
||||||
plot.yaxis.axis_label = "Pace (/500m)"
|
plot.yaxis.axis_label = "Pace (/500m)"
|
||||||
plot.xaxis[0].formatter = DatetimeTickFormatter(
|
plot.xaxis[0].formatter = DatetimeTickFormatter(
|
||||||
@@ -7236,8 +7236,10 @@ def interactive_zoneschart(rower, data, startdate, enddate, trainingzones='hr',
|
|||||||
p.extra_y_ranges["yax2"] = Range1d(start=0, end=y2rangemax)
|
p.extra_y_ranges["yax2"] = Range1d(start=0, end=y2rangemax)
|
||||||
p.line('date', 'hours', source=source2,
|
p.line('date', 'hours', source=source2,
|
||||||
y_range_name="yax2", color="black", width=5)
|
y_range_name="yax2", color="black", width=5)
|
||||||
p.circle('date', 'hours', source=source2, y_range_name="yax2", color="black", size=10,
|
p.circle('date', 'hours', source=source2, y_range_name="yax2", color="black", size=10)
|
||||||
legend_label='Hours')
|
|
||||||
|
# p.circle('date', 'hours', source=source2, y_range_name="yax2", color="black", size=10,
|
||||||
|
# legend_label='Hours')
|
||||||
p.add_layout(LinearAxis(y_range_name="yax2",
|
p.add_layout(LinearAxis(y_range_name="yax2",
|
||||||
axis_label='Hours'), 'right')
|
axis_label='Hours'), 'right')
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -137,6 +137,8 @@ def save_scoring(name, user, filename, id=0, notes=""):
|
|||||||
adaptiveclass = 'None'
|
adaptiveclass = 'None'
|
||||||
except KeyError: # pragma: no cover
|
except KeyError: # pragma: no cover
|
||||||
adaptiveclass = 'None'
|
adaptiveclass = 'None'
|
||||||
|
except AttributeError:
|
||||||
|
adaptiveclass = 'None'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
skillclass = row['SkillClass']
|
skillclass = row['SkillClass']
|
||||||
|
|||||||
@@ -3691,12 +3691,13 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec,
|
|||||||
newc2id = workout.uploadedtoc2
|
newc2id = workout.uploadedtoc2
|
||||||
|
|
||||||
parkedids = []
|
parkedids = []
|
||||||
with open('c2blocked.json', 'r') as c2blocked:
|
with open('c2blocked.json', 'a+') as c2blocked:
|
||||||
try:
|
try:
|
||||||
jsondata = json.load(c2blocked)
|
jsondata = json.load(c2blocked)
|
||||||
parkedids = jsondata['ids']
|
parkedids = jsondata['ids']
|
||||||
except JSONDecodeError: # pragma: no cover
|
except JSONDecodeError: # pragma: no cover
|
||||||
parkedids = []
|
parkedids = []
|
||||||
|
|
||||||
|
|
||||||
newparkedids = [id for id in parkedids if id != newc2id]
|
newparkedids = [id for id in parkedids if id != newc2id]
|
||||||
with open('c2blocked.json', 'wt') as c2blocked:
|
with open('c2blocked.json', 'wt') as c2blocked:
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
{{ js_res | safe }}
|
{{ js_res | safe }}
|
||||||
{{ css_res| safe }}
|
{{ css_res| safe }}
|
||||||
|
|
||||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-3.1.1.min.js"></script>
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-3.1.1.min.js"></script>
|
||||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script>
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script>
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
Bokeh.set_log_level("info");
|
Bokeh.set_log_level("info");
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -332,12 +332,18 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="id_css_res">
|
<div id="id_css_res">
|
||||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-3.1.1.min.css" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-3.1.1.min.css" type="text/css" />
|
|
||||||
</div>
|
</div>
|
||||||
<div id="id_js_res">
|
<div id="id_js_res">
|
||||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-3.1.1.min.js"></script>
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-3.1.1.min.js"
|
||||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script>
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.1.1.min.js"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.1.1.min.js"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.1.1.min.js"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.1.1.min.js"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
@@ -533,9 +539,10 @@
|
|||||||
var script = json.script;
|
var script = json.script;
|
||||||
var div = json.div;
|
var div = json.div;
|
||||||
$("#id_sitready").remove();
|
$("#id_sitready").remove();
|
||||||
$("#id_chart").append(div);
|
$("#id_chart").append(div);
|
||||||
console.log(div);
|
|
||||||
$("#id_script").append("<script>"+script+"</s"+"cript>");
|
$("#id_script").append(script);
|
||||||
|
/* $("#id_script").append("<script>"+script+"</s"+"cript>"); */
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -414,11 +414,26 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
||||||
labels=False))
|
labels=False))
|
||||||
|
|
||||||
xvalues = groups.mean()[xparam]
|
xvalues = []
|
||||||
yvalues = groups.mean()[yparam]
|
yvalues = []
|
||||||
xerror = groups.std()[xparam]
|
xerror = []
|
||||||
yerror = groups.std()[yparam]
|
yerror = []
|
||||||
groupsize = groups.count()[xparam]
|
groupsize = []
|
||||||
|
groupval = []
|
||||||
|
for key, item in groups:
|
||||||
|
xvalues.append(groups.get_group(key)[xparam].mean())
|
||||||
|
yvalues.append(groups.get_group(key)[yparam].mean())
|
||||||
|
xerror.append(groups.get_group(key)[xparam].std())
|
||||||
|
yerror.append(groups.get_group(key)[yparam].std())
|
||||||
|
groupsize.append(len(groups.get_group(key)[xparam]))
|
||||||
|
groupval.append(groups.get_group(key)[groupby].mean())
|
||||||
|
|
||||||
|
|
||||||
|
xvalues = pd.Series(xvalues)
|
||||||
|
yvalues = pd.Series(yvalues)
|
||||||
|
xerror = pd.Series(xerror)
|
||||||
|
yerror = pd.Series(yerror)
|
||||||
|
groupsize = pd.Series(groupsize)
|
||||||
|
|
||||||
mask = groupsize <= min([0.01*groupsize.sum(), 0.2*groupsize.mean()])
|
mask = groupsize <= min([0.01*groupsize.sum(), 0.2*groupsize.mean()])
|
||||||
xvalues.loc[mask] = np.nan
|
xvalues.loc[mask] = np.nan
|
||||||
@@ -458,7 +473,7 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
|
|
||||||
if groupby != 'date':
|
if groupby != 'date':
|
||||||
try:
|
try:
|
||||||
df['groupval'] = groups.mean()[groupby]
|
df['groupval'] = pd.Series(groupval)
|
||||||
df.loc[mask, 'groupval'] = np.nan
|
df.loc[mask, 'groupval'] = np.nan
|
||||||
|
|
||||||
groupcols = df['groupval']
|
groupcols = df['groupval']
|
||||||
@@ -520,8 +535,6 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
spmmin=spmmin, spmmax=spmmax,
|
spmmin=spmmin, spmmax=spmmax,
|
||||||
workmin=workmin, workmax=workmax)
|
workmin=workmin, workmax=workmax)
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
|
||||||
script = ''.join(scripta)
|
|
||||||
|
|
||||||
return(script, div)
|
return(script, div)
|
||||||
|
|
||||||
@@ -568,9 +581,6 @@ def flexalldata(workouts, options):
|
|||||||
script = res[0]
|
script = res[0]
|
||||||
div = res[1]
|
div = res[1]
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
|
||||||
script = ''.join(scripta)
|
|
||||||
|
|
||||||
return(script, div)
|
return(script, div)
|
||||||
|
|
||||||
|
|
||||||
@@ -605,9 +615,6 @@ def histodata(workouts, options):
|
|||||||
extratitle=extratitle,
|
extratitle=extratitle,
|
||||||
workmin=workmin, workmax=workmax)
|
workmin=workmin, workmax=workmax)
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
|
||||||
script = ''.join(scripta)
|
|
||||||
|
|
||||||
return(script, div)
|
return(script, div)
|
||||||
|
|
||||||
|
|
||||||
@@ -703,8 +710,8 @@ def cpdata(workouts, options):
|
|||||||
p1 = [1, 1, 1, 1]
|
p1 = [1, 1, 1, 1]
|
||||||
ratio = 1
|
ratio = 1
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
|
||||||
script = ''.join(scripta)
|
|
||||||
|
|
||||||
minutes = options['piece']
|
minutes = options['piece']
|
||||||
if minutes != 0:
|
if minutes != 0:
|
||||||
@@ -883,9 +890,6 @@ def comparisondata(workouts, options):
|
|||||||
script = res[0]
|
script = res[0]
|
||||||
div = res[1]
|
div = res[1]
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
|
||||||
script = ''.join(scripta)
|
|
||||||
|
|
||||||
return(script, div)
|
return(script, div)
|
||||||
|
|
||||||
|
|
||||||
@@ -949,8 +953,6 @@ def boxplotdata(workouts, options):
|
|||||||
spmmin=spmmin, spmmax=spmmax,
|
spmmin=spmmin, spmmax=spmmax,
|
||||||
workmin=workmin, workmax=workmax)
|
workmin=workmin, workmax=workmax)
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
|
||||||
script = ''.join(scripta)
|
|
||||||
|
|
||||||
return(script, div)
|
return(script, div)
|
||||||
|
|
||||||
|
|||||||
@@ -3859,6 +3859,8 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
|
|||||||
except KeyError: # pragma: no cover
|
except KeyError: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
datadf = datadf.select_dtypes([np.number])
|
||||||
|
|
||||||
# Create a dict with correlation values
|
# Create a dict with correlation values
|
||||||
cor = datadf.corr(method='spearman')
|
cor = datadf.corr(method='spearman')
|
||||||
cor.fillna(value=0, inplace=True)
|
cor.fillna(value=0, inplace=True)
|
||||||
|
|||||||
@@ -12,8 +12,6 @@
|
|||||||
<title>{% block title %}Rowsandall Rowing Data Analytics{% endblock %}</title>
|
<title>{% block title %}Rowsandall Rowing Data Analytics{% endblock %}</title>
|
||||||
{% analytical_head_top %}
|
{% analytical_head_top %}
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.css" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.css" type="text/css" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css"/>
|
<link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css"/>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/admin/css/widgets.css"/>
|
<link rel="stylesheet" type="text/css" href="/static/admin/css/widgets.css"/>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
|
||||||
@@ -60,7 +58,6 @@
|
|||||||
}(document, 'script', 'facebook-jssdk'));</script>
|
}(document, 'script', 'facebook-jssdk'));</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function (){
|
$(document).ready(function (){
|
||||||
FB.XFBML.parse();
|
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user