# Uploading candidates All upload scripts live in the `scripts/` directory. ## Uploading candidate data Uploading candidates to the webapp is done using `scripts/upload_cand.py`. It uses a number of POST requests to push the candidate data to the webapp. 1. Ensure you install or use a Python 3.10 environment with `astropy` installed. ```bash pip3 install astropy ``` or you can install the full requirements for the webapp ```bash pip3 install -r requirements.txt ``` 2. Log into the webapp using your credentials and get your upload token from the "User management" button at the top right of the navbar. 3. Use the following Python script to send candidate data to the webapp, ```bash python3 scripts/upload_cand.py --base_url https:// --token --project_id --observation_id --data_directory ``` Notes: - Any user can upload candidates to the webapp. - If the `project_id` given to the upload script does not match one existing in the webapp's database, the webapp will create a new one and upload the candidate data to that newly created `project_id`. The same goes for Observations, Beams and Candidates records. - The `data_directory` path can be relative or absolute but requires the `_beam_final.csv` to be present for the upload script to pull the candidate information in for each beam and upload to the webapp. - All of the relevant fits files, images, and gifs from the beam and candidate are found by the upload script by their filename and will be uploaded with the associated candidate. If there are no files present, then there will be a placeholder for them on the candidate rating page. - You do not need to copy the candidate data to the host machine of the webapp. You should be able to use the python script from a remote machine with an internet connection to send all of the candidate data to the webapp. ## Uploading dynamic spectra A dynamic spectra PNG can be uploaded for an existing candidate using `scripts/upload_dynamic_spectra.py`. The candidate must already exist in the database (uploaded via `upload_cand.py`). The candidate can be identified by name or by its UUID hash ID. ```bash python3 scripts/upload_dynamic_spectra.py \ --base_url https:// \ --token \ --file /path/to/dynamic_spectra.png \ --name ``` Or using the hash ID: ```bash python3 scripts/upload_dynamic_spectra.py \ --base_url https:// \ --token \ --file /path/to/dynamic_spectra.png \ --hash ``` Once uploaded, the dynamic spectra image is displayed in a card on the candidate rating page, above the statistical maps.