Skip to content

Commit

Permalink
Merge branch 'hotfix/feature-11503-download-processed-data' into 'mod…
Browse files Browse the repository at this point in the history
…is_master'

#78 - fixed filters in backend to download processed data

See merge request datalake/docker_datalake!140
  • Loading branch information
TheoLGG-Modis committed Jan 24, 2022
2 parents a80a97c + 986902e commit b485961
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions service_zone/backend/flask/neocampus/routers/mongo_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,28 @@ def get_handled_data_list():
influxDB)
nb_lines_influxDB = len(list(influxDB))

# If there is Influx data (> 1 because Header is present at minimum in csv file) and filter "Time series" is selected
if number_of_rows_influxdb > 1 and "csv" in params.get('filetype'):
# Mimetypes arrays which are configured in frontend and where we compare input parameter "filetype"

mimetypes_time_series = [
"application/csv,application/vnd.ms-excel",
"text/plain"
]

mimetypes_metadata = [
"image/png,image/jpeg"
]

# If there is Influx data (> 1 because Header row is present at the first line in csv file)
# and filter related to time series is selected
if number_of_rows_influxdb > 1 and params.get('filetype') in mimetypes_time_series:
metadata_influx_file = {
'filename': 'donnees-serie-temporelle-influxdb.csv',
'filesize': sys.getsizeof(influxdb_result)
}
result['influxDB'] = metadata_influx_file

# If there is Mongo data and filter "Images" or "Time series" are selected
if mongo_nb_results > 0 and "image" in params.get('filetype'):
if mongo_nb_results > 0 and params.get('filetype') in mimetypes_metadata:
metadata_mongo_file = {
'filename': 'metadonnees-images-mongodb.json',
'filesize': sys.getsizeof(mongoDB)
Expand Down

0 comments on commit b485961

Please sign in to comment.