Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ def handle(self, *args, **options):

for doc in registry.get_documents(models):
start_time = timezone.now() - UPDATE_WINDOW
qs = doc().get_queryset().filter(last_modified__gt=start_time).order_by("id")
qs = doc().get_queryset().filter(last_modified_at__gt=start_time).order_by("id")
self.stdout.write("Indexing {} '{}' objects".format(qs.count(), qs.model.__name__))
doc().update(qs)
2 changes: 1 addition & 1 deletion api/data_refinery_api/views/computational_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Meta:
"time_start",
"time_end",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down
8 changes: 4 additions & 4 deletions api/data_refinery_api/views/computed_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Meta:
"s3_url",
"download_url",
"created_at",
"last_modified",
"last_modified_at",
"result",
)
read_only_fields = fields
Expand Down Expand Up @@ -90,7 +90,7 @@ class Meta:
"s3_url",
"download_url",
"created_at",
"last_modified",
"last_modified_at",
"result",
)
read_only_fields = fields
Expand Down Expand Up @@ -137,13 +137,13 @@ class ComputedFileListView(generics.ListAPIView):
"svd_algorithm",
"compendium_version",
"created_at",
"last_modified",
"last_modified_at",
"result__id",
)
ordering_fields = (
"id",
"created_at",
"last_modified",
"last_modified_at",
"compendium_version",
)
ordering = ("-id",)
Expand Down
4 changes: 2 additions & 2 deletions api/data_refinery_api/views/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Meta:
"success",
"failure_reason",
"created_at",
"last_modified",
"last_modified_at",
"start",
"size_in_bytes",
"sha1",
Expand All @@ -235,7 +235,7 @@ class Meta:
"success": {"read_only": True,},
"failure_reason": {"read_only": True,},
"created_at": {"read_only": True,},
"last_modified": {"read_only": True,},
"last_modified_at": {"read_only": True,},
"size_in_bytes": {"read_only": True,},
"sha1": {"read_only": True,},
"download_url": {"read_only": True,},
Expand Down
14 changes: 7 additions & 7 deletions api/data_refinery_api/views/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Meta:
"data",
"is_ccdl",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down Expand Up @@ -56,9 +56,9 @@ class Meta:
"organism_names",
"submitter_institution",
"created_at",
"last_modified",
"last_modified_at",
"source_first_published",
"source_last_modified",
"source_last_modified_at",
"sample_metadata",
"technologies",
)
Expand Down Expand Up @@ -103,9 +103,9 @@ class Meta:
"publication_authors",
"pubmed_id",
"source_first_published",
"source_last_modified",
"source_last_modified_at",
"submitter_institution",
"last_modified",
"last_modified_at",
"created_at",
"organism_names",
"sample_metadata",
Expand Down Expand Up @@ -137,9 +137,9 @@ class ExperimentListView(generics.ListAPIView):
"organisms",
"submitter_institution",
"created_at",
"last_modified",
"last_modified_at",
"source_first_published",
"source_last_modified",
"source_last_modified_at",
)

def get_queryset(self):
Expand Down
2 changes: 1 addition & 1 deletion api/data_refinery_api/views/jobs/downloader_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Meta:
"start_time",
"end_time",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down
2 changes: 1 addition & 1 deletion api/data_refinery_api/views/jobs/processor_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Meta:
"start_time",
"end_time",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down
2 changes: 1 addition & 1 deletion api/data_refinery_api/views/jobs/survey_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Meta:
"start_time",
"end_time",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down
6 changes: 3 additions & 3 deletions api/data_refinery_api/views/original_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Meta:
"is_archive",
"has_raw",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand All @@ -60,7 +60,7 @@ class Meta:
"source_filename",
"has_raw",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand All @@ -83,7 +83,7 @@ class OriginalFileListView(generics.ListAPIView):
ordering_fields = (
"id",
"created_at",
"last_modified",
"last_modified_at",
)
ordering = ("-id",)

Expand Down
2 changes: 1 addition & 1 deletion api/data_refinery_api/views/qn_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Meta:
"s3_key",
"s3_url",
"created_at",
"last_modified",
"last_modified_at",
"result",
)
read_only_fields = fields
Expand Down
18 changes: 9 additions & 9 deletions api/data_refinery_api/views/relation_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Meta:
"s3_bucket",
"s3_key",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand All @@ -71,7 +71,7 @@ class Meta:
"s3_key",
"download_url",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down Expand Up @@ -115,7 +115,7 @@ class Meta:
"is_processed",
"is_unable_to_be_processed",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down Expand Up @@ -143,7 +143,7 @@ class Meta:
"start_time",
"end_time",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand All @@ -169,7 +169,7 @@ class Meta:
"start_time",
"end_time",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down Expand Up @@ -197,7 +197,7 @@ class Meta:
"salmon_version",
"download_url",
"result_id",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down Expand Up @@ -228,7 +228,7 @@ class Meta:
class ComputationalResultAnnotationRelationSerializer(serializers.ModelSerializer):
class Meta:
model = ComputationalResultAnnotation
fields = ("id", "data", "is_ccdl", "created_at", "last_modified")
fields = ("id", "data", "is_ccdl", "created_at", "last_modified_at")
read_only_fields = fields


Expand All @@ -253,7 +253,7 @@ class Meta:
"time_start",
"time_end",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand All @@ -277,6 +277,6 @@ class Meta:
"time_start",
"time_end",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields
4 changes: 2 additions & 2 deletions api/data_refinery_api/views/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Meta:
"data",
"is_ccdl",
"created_at",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down Expand Up @@ -99,7 +99,7 @@ class Meta:
"is_processed",
"is_unable_to_be_processed",
"created_at",
"last_modified",
"last_modified_at",
"original_files",
"computed_files",
"last_processor_job",
Expand Down
12 changes: 6 additions & 6 deletions api/data_refinery_api/views/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ def calculate_dashboard_stats(cls, range_param):

# processed and unprocessed samples stats
data["unprocessed_samples"] = cls._get_object_stats(
Sample.objects.filter(is_processed=False), range_param, "last_modified"
Sample.objects.filter(is_processed=False), range_param, "last_modified_at"
)
data["processed_samples"] = cls._get_object_stats(
Sample.processed_objects, range_param, "last_modified"
Sample.processed_objects, range_param, "last_modified_at"
)

data["dataset"] = cls._get_dataset_stats(range_param)
Expand Down Expand Up @@ -280,17 +280,17 @@ def _get_dataset_stats(cls, range_param):

if range_param:
# We don't save the dates when datasets are processed, but we can use
# `last_modified`, since datasets aren't modified again after they are processed
# `last_modified_at`, since datasets aren't modified again after they are processed
result["timeline"] = cls._get_intervals(
Dataset.processed_filtered_objects, range_param, "last_modified"
Dataset.processed_filtered_objects, range_param, "last_modified_at"
).annotate(total=Count("id"), total_size=Sum("size_in_bytes"))
return result

@classmethod
def _samples_processed_last_hour(cls):
current_date = datetime.now(tz=timezone.utc)
start = current_date - timedelta(hours=1)
return Sample.processed_objects.filter(last_modified__range=(start, current_date)).count()
return Sample.processed_objects.filter(last_modified_at__range=(start, current_date)).count()

@classmethod
def _get_input_data_size(cls):
Expand Down Expand Up @@ -376,7 +376,7 @@ def _get_object_stats(cls, objects, range_param=False, field="created_at"):
return result

@classmethod
def _get_intervals(cls, objects, range_param, field="last_modified"):
def _get_intervals(cls, objects, range_param, field="last_modified_at"):
range_to_trunc = {"day": "hour", "week": "day", "month": "day", "year": "month"}

# truncate the parameterized field so it can be annotated by range
Expand Down
2 changes: 1 addition & 1 deletion api/data_refinery_api/views/transcriptome_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Meta:
"salmon_version",
"download_url",
"result_id",
"last_modified",
"last_modified_at",
)
read_only_fields = fields

Expand Down
Loading