From fad9a91fb4140b2d5896d8d757ae61ca7be7b8e2 Mon Sep 17 00:00:00 2001 From: Rob Dennett Date: Tue, 26 Nov 2024 10:12:23 -0600 Subject: [PATCH] Fixes #428 --- src/data_hub/analytics/models.py | 330 ------------------ src/data_hub/analytics/templates/hello.html | 1 - .../analytics/templates/stats-old.html | 85 ----- src/data_hub/analytics/templates/stats.html | 2 +- src/data_hub/analytics/views.py | 2 - 5 files changed, 1 insertion(+), 419 deletions(-) delete mode 100644 src/data_hub/analytics/models.py delete mode 100644 src/data_hub/analytics/templates/hello.html delete mode 100644 src/data_hub/analytics/templates/stats-old.html diff --git a/src/data_hub/analytics/models.py b/src/data_hub/analytics/models.py deleted file mode 100644 index 8545a4af..00000000 --- a/src/data_hub/analytics/models.py +++ /dev/null @@ -1,330 +0,0 @@ -from django.db import models - -# Create your models here. -class DownloadLog2021(models.Model): - class Meta: - managed = False - db_table = "download_log_2021" - verbose_name = 'Download log 2021 entry' - verbose_name_plural = 'Download logs 2021' - - id = models.UUIDField( - 'ID', - primary_key=True - ) - - date = models.DateField( - "Date" - ) - - time = models.TimeField( - "Time without timezone" - ) - - x_edge_result_type = models.CharField( - "X Edge Result Type" - ) - - x_edge_detailed_result_type = models.TextField( - "X Edge Detailed Result Type" - ) - - x_host_header = models.CharField( - "X Host Header" - ) - - cs_uri_stem = models.TextField( - "CS URI Stem" - ) - - collection_id = models.CharField( - "Collection ID" - ) - - collection_shortname = models.CharField( - "Collection Short Name" - ) - - area_type_id = models.CharField( - "Area Type ID" - ) - - file_type = models.CharField( - "File Type" - ) - - hist_band = models.CharField( - "Hist Band" - ) - - hist_collective = models.CharField( - "Hist Collective" - ) - - hist_mission = models.CharField( - "Hist Mission" - ) - - hist_type = models.CharField( - "Hist Type" - ) - - hist_product = models.CharField( - "Hist Product" - ) - - hist_file = models.CharField( - "Hist File" - ) - - def __str__(self): - return str(self.id) - - def getYear(): - return 2021 - -class DownloadLog2022(models.Model): - class Meta: - managed = False - db_table = "download_log_2022" - verbose_name = 'Download log 2022 entry' - verbose_name_plural = 'Download logs 2022' - - id = models.UUIDField( - 'ID', - primary_key=True - ) - - date = models.DateField( - "Date" - ) - - time = models.TimeField( - "Time without timezone" - ) - - x_edge_result_type = models.CharField( - "X Edge Result Type" - ) - - x_edge_detailed_result_type = models.TextField( - "X Edge Detailed Result Type" - ) - - x_host_header = models.CharField( - "X Host Header" - ) - - cs_uri_stem = models.TextField( - "CS URI Stem" - ) - - collection_id = models.CharField( - "Collection ID" - ) - - collection_shortname = models.CharField( - "Collection Short Name" - ) - - area_type_id = models.CharField( - "Area Type ID" - ) - - file_type = models.CharField( - "File Type" - ) - - hist_band = models.CharField( - "Hist Band" - ) - - hist_collective = models.CharField( - "Hist Collective" - ) - - hist_mission = models.CharField( - "Hist Mission" - ) - - hist_type = models.CharField( - "Hist Type" - ) - - hist_product = models.CharField( - "Hist Product" - ) - - hist_file = models.CharField( - "Hist File" - ) - - def __str__(self): - return str(self.id) - - def getYear(): - return 2022 - -class DownloadLog2023(models.Model): - class Meta: - managed = False - db_table = "download_log_2023" - verbose_name = 'Download log 2023 entry' - verbose_name_plural = 'Download logs 2023' - - id = models.UUIDField( - 'ID', - primary_key=True - ) - - date = models.DateField( - "Date" - ) - - time = models.TimeField( - "Time without timezone" - ) - - x_edge_result_type = models.CharField( - "X Edge Result Type" - ) - - x_edge_detailed_result_type = models.TextField( - "X Edge Detailed Result Type" - ) - - x_host_header = models.CharField( - "X Host Header" - ) - - cs_uri_stem = models.TextField( - "CS URI Stem" - ) - - collection_id = models.CharField( - "Collection ID" - ) - - collection_shortname = models.CharField( - "Collection Short Name" - ) - - area_type_id = models.CharField( - "Area Type ID" - ) - - file_type = models.CharField( - "File Type" - ) - - hist_band = models.CharField( - "Hist Band" - ) - - hist_collective = models.CharField( - "Hist Collective" - ) - - hist_mission = models.CharField( - "Hist Mission" - ) - - hist_type = models.CharField( - "Hist Type" - ) - - hist_product = models.CharField( - "Hist Product" - ) - - hist_file = models.CharField( - "Hist File" - ) - - def __str__(self): - return str(self.id) - - def getYear(): - return 2023 - -class DownloadLog2024(models.Model): - class Meta: - managed = False - db_table = "download_log_2024" - verbose_name = 'Download log 2024 entry' - verbose_name_plural = 'Download logs 2024' - - id = models.UUIDField( - 'ID', - primary_key=True - ) - - date = models.DateField( - "Date" - ) - - time = models.TimeField( - "Time without timezone" - ) - - x_edge_result_type = models.CharField( - "X Edge Result Type" - ) - - x_edge_detailed_result_type = models.TextField( - "X Edge Detailed Result Type" - ) - - x_host_header = models.CharField( - "X Host Header" - ) - - cs_uri_stem = models.TextField( - "CS URI Stem" - ) - - collection_id = models.CharField( - "Collection ID" - ) - - collection_shortname = models.CharField( - "Collection Short Name" - ) - - area_type_id = models.CharField( - "Area Type ID" - ) - - file_type = models.CharField( - "File Type" - ) - - hist_band = models.CharField( - "Hist Band" - ) - - hist_collective = models.CharField( - "Hist Collective" - ) - - hist_mission = models.CharField( - "Hist Mission" - ) - - hist_type = models.CharField( - "Hist Type" - ) - - hist_product = models.CharField( - "Hist Product" - ) - - hist_file = models.CharField( - "Hist File" - ) - - def __str__(self): - return str(self.id) - - def getYear(): - return 2024 \ No newline at end of file diff --git a/src/data_hub/analytics/templates/hello.html b/src/data_hub/analytics/templates/hello.html deleted file mode 100644 index 973e574f..00000000 --- a/src/data_hub/analytics/templates/hello.html +++ /dev/null @@ -1 +0,0 @@ -

{{ reply }}

diff --git a/src/data_hub/analytics/templates/stats-old.html b/src/data_hub/analytics/templates/stats-old.html deleted file mode 100644 index e59a1161..00000000 --- a/src/data_hub/analytics/templates/stats-old.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - -

Total Downloads

-

{{total_downloads}}

-

Successful Data Downloads

-

{{total_success_data}}

-

Successful Map Downloads

-

{{total_success_map}}

-

-----------------------

-

top 10 successfully downloaded files

-{% for item in top_files %} -

{{item.0}} {{item.1}}

-{% endfor %} -

-----------------------

-

- top 10 successfully downloaded data collections (historic imagery included) -

-{% for item in top_cbc %} -

{{item.0}} {{item.1}}

-{% endfor %} -

-----------------------

-

top 10 successfully downloaded historic imagery data collections

-{% for item in top_cbh %} -

{{item.0}} {{item.1}}

-{% endfor %} -

-----------------------

-

top 10 successfully downloaded maps

-{% for item in top_cbm %} -

{{item.0}} {{item.1}}

-{% endfor %} -

-----------------------

-

total successfully downloaded count by resource_type

-{% for item in top_cbrt %} -

{{item.0}} {{item.1}}

-{% endfor %} -

-----------------------

-

- {{no_downloads_num}} of {{total_downloadable}} downloadable collections had - zero download attempts (historic imagery NOT included) -

-{% for item in no_downloads %} -

{{item}}

-{% endfor %} -
-

- Start date - -

-

- End date - -

-

-
diff --git a/src/data_hub/analytics/templates/stats.html b/src/data_hub/analytics/templates/stats.html index a8318955..fa019d00 100644 --- a/src/data_hub/analytics/templates/stats.html +++ b/src/data_hub/analytics/templates/stats.html @@ -299,7 +299,7 @@ #service-types { background-color: white; - width: 600px; + width: 100%; max-height: 365px; overflow-y: auto; order: 2; diff --git a/src/data_hub/analytics/views.py b/src/data_hub/analytics/views.py index 8bf169e5..ddfc2b35 100644 --- a/src/data_hub/analytics/views.py +++ b/src/data_hub/analytics/views.py @@ -3,9 +3,7 @@ from django.contrib.auth.decorators import login_required from lcd.models import Collection, TemplateType from msd.models import MapCollection -from analytics.models import DownloadLog2024 import inspect -import analytics.models import os from datetime import datetime import time