-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refatoração da lista de Eventos de predição e Filtros (#750)
* A method was implemented that calculates the prediction path for occultation events. #734 * Implemented first version of user location x event visibilit in Occultation endpoint #734 * Changed Map folder limit. Added more occultation path fields. * Added maps folder highlights * Commands were created to perform the creation of maps and occultation paths manually. * Fix nightside computation and addition lat max min * Foi reescrito os componentes PredictionDataGrid e PredictionFilter. Foi removido a autenticação de algumas páginas * Filters by date, magnitude, name, dynclass and base_dynclass Done * Removed Material ui icons 4 * Replaced material ui card for MUI card * Geo Filter parcialmente implementado * Geo Filter implmentado e funcionando * Lista de eventos de predição e filtros funcionando corretamente * Events datagrid e filter separados como components * finished filter and events datagrid components * Página publica foi atualizada com os novos componentes de lista de eventos de preodição e filtro * implement prediction highlights * reorganization of cards, hidden aladdin * Fixed highlihts * Fix map highlight when asteroid name have - * Fixed asteroid alias when asteroid have - in name * Closes #728 - 'LIneA is supported by' and 'Footer' are together on all public pages * Closes #737 - reorganization of cards as agreed and 'sky-map' (Aladin) has been hidden * Fixed geo filter * Change map size in list events * Fixed map size in prediction list. * Changed pagesize in geofilter * Closes #726 - layout for displaying prediction highlights * Added devcontainer compose file * Change default radius * Changed line height * Added Hide/Show Columns toolbar * Highlight cards formating and color * Text updated in prediction filter * Prediction occultation table alignment * Occultation filter text fix * Cards text formating * Column CA Instant now formated in UTC * Minor fix * Fixed prediction occultation submit interface --------- Co-authored-by: rcboufleur <rcboufleur@gmail.com> Co-authored-by: Jandson Vitorino <jandson1512@gmail.com>
- Loading branch information
1 parent
1ee6ab0
commit fc6e69c
Showing
106 changed files
with
6,089 additions
and
42,815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3.6' | ||
services: | ||
# Update this to the name of the service you want to work with in your docker-compose.yml file | ||
vscode: | ||
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer | ||
# folder. Note that the path of the Dockerfile and context is relative to the *primary* | ||
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" | ||
# array). The sample below assumes your primary file is in the root of your project. | ||
# | ||
build: | ||
context: . | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
volumes: | ||
# Update this to wherever you want VS Code to mount the folder of your project | ||
- ..:/workspaces:cached | ||
# Diretório de Logs | ||
- ./log:/log | ||
# Diretório de Dados | ||
- ./archive:/archive | ||
|
||
|
||
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. | ||
# cap_add: | ||
# - SYS_PTRACE | ||
# security_opt: | ||
# - seccomp:unconfined | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: /bin/sh -c "while sleep 1000; do :; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ZoneTransfer] | ||
ZoneId=3 | ||
HostUrl=https://files.slack.com/files-pri/T0E00562F-F062R9XLMJS/download/trojaninformation.csv?origin_team=T0E00562F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from django.core.management.base import BaseCommand | ||
from datetime import datetime, timezone | ||
from tno.tasks import upcoming_events_to_create_maps, create_occ_map_task, prediction_maps_log_error | ||
from celery import group | ||
|
||
class Command(BaseCommand): | ||
help = "Create Occultation Maps by Period." | ||
|
||
def add_arguments(self, parser): | ||
# Named (optional) arguments | ||
parser.add_argument( | ||
"start", | ||
help="Start Data in format YYYY-MM-DD", | ||
) | ||
parser.add_argument( | ||
"--end", | ||
default=None, | ||
help="End Data in format YYYY-MM-DD", | ||
) | ||
|
||
parser.add_argument( | ||
"--limit", | ||
default=1000, | ||
type=int, | ||
help="Maximum number of jobs to be submitted, default is 1000", | ||
) | ||
|
||
def handle(self, *args, **options): | ||
|
||
start = datetime.strptime(options["start"], '%Y-%m-%d').astimezone(tz=timezone.utc) | ||
end = datetime.strptime(options.get("end"), '%Y-%m-%d').replace(hour=23, minute=59, second=59).astimezone(tz=timezone.utc) if options.get("end", None) != None else None | ||
limit = options['limit'] | ||
|
||
if end == None: | ||
self.stdout.write(f"Submitting background tasks to create occultation maps for date {start}") | ||
else: | ||
self.stdout.write(f"Submitting background tasks to create occultation maps for period {start} to {end}") | ||
|
||
to_run = upcoming_events_to_create_maps( | ||
start, end, limit) | ||
self.stdout.write(f"Tasks to be executed in this block: [{len(to_run)}].") | ||
|
||
# Celery tasks signature | ||
header = [create_occ_map_task.s(**i) for i in to_run] | ||
job = group(header) | ||
job.link_error(prediction_maps_log_error.s()) | ||
|
||
results = job.apply_async() | ||
self.stdout.write(f"All [{len(results)}] subtasks are submited.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from django.core.management.base import BaseCommand | ||
from datetime import datetime, timezone | ||
from tno.tasks import calculate_occultation_path | ||
from celery import group | ||
from tno.models import Occultation | ||
class Command(BaseCommand): | ||
help = "Create Occultation Paths Coeff by Period." | ||
|
||
def add_arguments(self, parser): | ||
# Named (optional) arguments | ||
parser.add_argument( | ||
"start", | ||
help="Start Data in format YYYY-MM-DD", | ||
) | ||
parser.add_argument( | ||
"--end", | ||
default=None, | ||
help="End Data in format YYYY-MM-DD", | ||
) | ||
|
||
parser.add_argument( | ||
"--limit", | ||
default=1000, | ||
type=int, | ||
help="Maximum number of jobs to be submitted, default is 1000", | ||
) | ||
parser.add_argument( | ||
"--force", | ||
default=False, | ||
type=bool, | ||
help="Creates the path by overwriting previous results", | ||
) | ||
|
||
parser.add_argument( | ||
"--id", | ||
default=None, | ||
type=int, | ||
help="Run only for select ID",) | ||
|
||
def handle(self, *args, **options): | ||
|
||
if options['id'] != None: | ||
to_run = [Occultation.objects.get(pk=options['id'])] | ||
self.stdout.write(f"Submitting background tasks to create occultation paths for id {options['id']}") | ||
limit = 1 | ||
else: | ||
start = datetime.strptime(options["start"], '%Y-%m-%d').astimezone(tz=timezone.utc) | ||
end = datetime.strptime(options.get("end"), '%Y-%m-%d').replace(hour=23, minute=59, second=59).astimezone(tz=timezone.utc) if options.get("end", None) != None else None | ||
limit = options['limit'] | ||
|
||
if end == None: | ||
self.stdout.write(f"Submitting background tasks to create occultation paths for date {start}") | ||
else: | ||
self.stdout.write(f"Submitting background tasks to create occultation paths for period {start} to {end}") | ||
|
||
to_run = Occultation.objects.filter( | ||
date_time__gte=start).order_by('date_time') | ||
if end != None: | ||
to_run.filter( | ||
date_time__lte=end | ||
) | ||
if options['force'] == False: | ||
to_run.filter(have_path_coeff=False) | ||
|
||
self.stdout.write(f"Events to run [{len(to_run)}].") | ||
job = group( | ||
calculate_occultation_path.s( | ||
occultation_id = event.id, | ||
date_time=event.date_time.isoformat(), | ||
ra_star_candidate=event.ra_star_candidate, | ||
dec_star_candidate=event.dec_star_candidate, | ||
closest_approach=event.closest_approach, | ||
position_angle=event.position_angle, | ||
velocity=event.velocity , | ||
delta_distance=event.delta, | ||
offset_ra=event.off_ra, | ||
offset_dec=event.off_dec, | ||
object_diameter=event.diameter, | ||
ring_radius=None) for event in to_run[0:limit]) | ||
|
||
# Submete as tasks aos workers | ||
results = job.apply_async() | ||
|
||
|
||
self.stdout.write(f"All [{len(results)}] subtasks are submited.") | ||
self.stdout.write("For monitoring use celery*.log in log directory") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.core.management.base import BaseCommand | ||
from datetime import datetime, timezone | ||
from tno.tasks import garbage_collector | ||
from celery import group | ||
|
||
class Command(BaseCommand): | ||
help = "Run Garbage Collector." | ||
|
||
def handle(self, *args, **options): | ||
|
||
self.stdout.write("Running garbage collector.") | ||
self.stdout.write("For monitoring use garbage_collector.log in log directory") | ||
garbage_collector() | ||
self.stdout.write("Done") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 3.2.18 on 2023-10-05 23:21 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tno', '0037_auto_20230726_1846'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='occultation', | ||
name='have_path_coeff', | ||
field=models.BooleanField(blank=True, default=False, help_text='Have Path Coeff', null=True, verbose_name='Have Path Coeff'), | ||
), | ||
migrations.AddField( | ||
model_name='occultation', | ||
name='max_longitude', | ||
field=models.FloatField(blank=True, default=None, help_text='Max Logintude Occultation Path', null=True, verbose_name='Max Logintude'), | ||
), | ||
migrations.AddField( | ||
model_name='occultation', | ||
name='min_longitude', | ||
field=models.FloatField(blank=True, default=None, help_text='Min Logintude Occultation Path', null=True, verbose_name='Min Logintude'), | ||
), | ||
migrations.AddField( | ||
model_name='occultation', | ||
name='occultation_path_coeff', | ||
field=models.JSONField(blank=True, default={}, help_text='Occultation Path Coeff', null=True, verbose_name='Occultation Path Coeff'), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
backend/tno/migrations/0039_alter_occultation_occultation_path_coeff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.18 on 2023-10-05 23:21 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tno', '0038_auto_20231005_2321'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='occultation', | ||
name='occultation_path_coeff', | ||
field=models.JSONField(blank=True, default=dict, help_text='Occultation Path Coeff', null=True, verbose_name='Occultation Path Coeff'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 3.2.18 on 2023-10-16 16:06 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tno', '0039_alter_occultation_occultation_path_coeff'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='occultation', | ||
name='max_latitude', | ||
field=models.FloatField(blank=True, default=None, help_text='Max Latitude Occultation Path', null=True, verbose_name='Max Latitude'), | ||
), | ||
migrations.AddField( | ||
model_name='occultation', | ||
name='min_latitude', | ||
field=models.FloatField(blank=True, default=None, help_text='Min Latitude Occultation Path', null=True, verbose_name='Min Latitude'), | ||
), | ||
] |
Oops, something went wrong.