From 917cef0a31a02c590af2830b739e4c7d67804852 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 20 Oct 2023 22:26:56 +0000 Subject: [PATCH] Add fits filename and path to image information --- api/db.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/db.py b/api/db.py index 0a92cdc..d1446aa 100644 --- a/api/db.py +++ b/api/db.py @@ -92,6 +92,14 @@ def get_image_pkg(self): """ header_dictionary = json.loads(self.header) if self.header is not None else None + # Attempt to reconstruct the fits filename and archive file path from the header data + fits_filename = '' + fits_path = '' + if header_dictionary: + fits_path = header_dictionary.get('SITEID') + '/' + header_dictionary.get('INSTRUME') + fits_path += '/' + header_dictionary.get('DAY-OBS') + '/raw' + fits_filename = header_dictionary.get('ORIGNAME') + package = { "image_id": self.image_id, "base_filename": self.base_filename, @@ -115,6 +123,8 @@ def get_image_pkg(self): "username": self.username, "user_id": self.user_id, + "fits_filename": fits_filename, + "fits_path": fits_path, "SMARTSTK": header_dictionary.get("SMARTSTK", '') if header_dictionary is not None else '', "SSTKNUM": header_dictionary.get("SSTKNUM", '') if header_dictionary is not None else '' }