BHTOM-Team / bhtom2

7 stars 2 forks source link

API to return all calibId for a given target and MJD range #223

Open wyrzykow opened 1 day ago

wyrzykow commented 1 day ago

It is needed for re-calibration. We need to be able to ask for a list of calibId for a target and mjd range. The API should have these params: target_name target_id mjd_min mjd_max

The minimum is either target_name or target_id. if mjd_min is provided only, without mjd_max, then it returns all calibId to the very last one. And vice versa for mjd_max.

Additionally, the get-calibration-res should return also the dat file which was uploaded. Together with this API, we will be able to script the re-calibration of selected targets: first ask for calibIds for a target, then loop through calibIds and read the files and upload them again.

Idea: maybe we should have another API which takes as a parameter the entire dat file as an array. This could speed up things for recalibration, as no file would be downloaded/uploaded. But then the API get-calibration-res should return not the file, but just the array of data. However, with this solution, at the BHTOM level we should still create a file, which is then attached to the dataproduct. Unless we decide to store the dat "files" information in a database instead.