Skip to content

Commit 2ec2fb5

Browse files
committed
remove some broker references
1 parent 28490ac commit 2ec2fb5

6 files changed

Lines changed: 18 additions & 10 deletions

File tree

docs/introduction/tomarchitecture.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ A ``ReducedDatum`` is a single point of data associated with a ``Target`` and op
275275
spectrum. The ``ReducedDatum`` model has the following fields, in addition to its aforementioned
276276
foreign key relationships:
277277

278-
- ``data_type`` is maintained on both the ``ReducedDatum`` and ``DataProduct`` for the case when data is brought in from another source, such as a broker
279-
- The ``source_name`` optionally refers to the original source of the data. The intent of this field was to track data ingested from brokers, but could potentially be used for other purposes.
278+
- ``data_type`` is maintained on both the ``ReducedDatum`` and ``DataProduct`` for the case when data is brought in from another source, such as an external data service.
279+
- The ``source_name`` optionally refers to the original source of the data. The intent of this field was to track data ingested from a dataservice, such as a broker, but could potentially be used for other purposes.
280280
- ``source_location`` optionally gives a hard location to the source--for a broker, it would be a link to the original alert.
281281
- The ``timestamp`` time at which the datum was produced.
282282
- ``value`` is a ``TextField`` that can take any series of data. As implemented, photometry is stored as JSON with keys for magnitude and error, but the ``TextField`` provides flexibility for additional photometry values on the datum. Spectroscopy is also stored as JSON, with keys for ``magnitude`` and ``flux``.

tom_dataproducts/management/commands/updatereduceddata.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212

1313

1414
class Command(BaseCommand):
15-
help = 'Gets and updates time-series data for a target with data extracted from data services.'
15+
help = 'Gets and updates time-series data for a target with data extracted from data services. This will search' \
16+
'existing data for sources that match installed data services and check those data services for new data.'
1617

1718
def add_arguments(self, parser):
1819
parser.add_argument(
1920
'--target_id',
21+
help='ID of target for which you would like updated data. Leave blank to update all targets.'
2022
)
2123

2224
def handle(self, *args, **options):
@@ -28,12 +30,16 @@ def handle(self, *args, **options):
2830
if options['target_id']:
2931
try:
3032
target = Target.objects.get(pk=options['target_id'])
31-
sources = [s.source_name for s in ReducedDatum.objects.filter(target=target).filter(source_name__in=dataservice_classes.keys()).distinct()]
33+
sources = [s.source_name for s in ReducedDatum.objects.filter(target=target).filter(
34+
source_name__in=dataservice_classes.keys()).distinct()
35+
]
3236
targets = [target]
3337
except ObjectDoesNotExist:
3438
raise Exception('Invalid target id provided')
3539
else:
36-
sources = [s.source_name for s in ReducedDatum.objects.filter(source_name__in=dataservice_classes.keys()).distinct()]
40+
sources = [s.source_name for s in ReducedDatum.objects.filter(
41+
source_name__in=dataservice_classes.keys()).distinct()
42+
]
3743
targets = Target.objects.filter(
3844
id__in=ReducedDatum.objects.filter(
3945
source_name__in=sources

tom_dataproducts/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ class ReducedDatum(models.Model):
350350
DATA_PRODUCT_TYPES in settings.py.
351351
:type data_type: str
352352
353-
:param source_name: The original source of this datum. The current major use of this field is to track the broker a
354-
datum came from, but can be used for other sources.
353+
:param source_name: The original source of this datum. The current major use of this field is to track the data
354+
service a datum came from, but can be used for other sources.
355+
355356
:type source_name: str
356357
357358
:param source_location: A reference to the location that this datum was originally sourced from. The current major

tom_dataproducts/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ def form_valid(self, form):
498498

499499
class UpdateReducedDataView(LoginRequiredMixin, RedirectView):
500500
"""
501-
View that handles the updating of reduced data tied to a ``DataProduct`` that was automatically ingested from a
502-
broker. Requires authentication.
501+
View that handles the updating of reduced data tied to a ``DataProduct`` that was ingested from a
502+
dataservice. The ReducedDatum.source must match the DataService.name Requires authentication.
503503
"""
504504
def get(self, request, *args, **kwargs):
505505
"""

tom_dataservices/dataservices.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def create_reduced_datums_from_query(self, target, data: List, data_type=None, *
323323
"""
324324
Create and save new reduced_datums of the appropriate data_type from the query results
325325
Be sure to use `ReducedDatum.objects.get_or_create()` when creating new objects.
326+
NOTE: Setting `ReducedDatum.source` to the the `DataService.name` will allow for automated data updates.
326327
327328
:param target: Target Object to be associated with the reduced data
328329
:param data: List of data dictionaries of the appropriate `data_type`

tom_dataservices/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DataServiceQuery(models.Model):
1111
parameters: Parameters for this ``DataServiceQuery``, stored as a JSON string.
1212
created: The time at which this ``DataServiceQuery`` was created in the TOM database.
1313
modified: The time at which this ``DataServiceQuery`` was changed in the TOM database.
14-
last_run: The time at which this ``DataServiceQuery`` was last run against its corresponding broker.
14+
last_run: The time at which this ``DataServiceQuery`` was last run against its corresponding query service.
1515
"""
1616
name = models.CharField(max_length=500)
1717
data_service = models.CharField(max_length=50)

0 commit comments

Comments
 (0)