34 Commits

Author SHA1 Message Date
D. Berge
cfa771a830 Skip info for saillines with no preplot.
It may happen that the sailline info file has data for more lines
than are actually in the preplot (e.g., if importing a reduced
preplot file). In this case, we don't want a constraint violation
error due to missing corresponding lines in `preplot_lines` so we
check for that and only import lines that do exist in `preplot_lines`
2025-07-19 11:31:52 +02:00
D. Berge
90782c1b09 Support import of preplot lines ancillary information.
Closes #264.
2024-05-04 17:32:30 +02:00
D. Berge
934b921f69 Include schema in returned survey configuration object 2024-05-01 10:40:04 +02:00
D. Berge
b71489cee1 Add get_file_data() function to datastore 2023-09-12 11:04:37 +02:00
D. Berge
ccf4bbf547 Use logical paths rather than physical 2023-08-30 14:54:27 +02:00
D. Berge
c99a625b60 Add function to retrieve survey configurations from DB.
As the survey definitions will no longer be stored in files
under etc/surveys/ but directly on the database, this
function replaces configuration.surveys()
2023-08-30 14:27:15 +02:00
D. Berge
455888bdac Fix method signature 2023-08-30 14:16:08 +02:00
D. Berge
04df9f41cc Add script for daily database housekeeping.
The script bin/daily_tasks.py is intended to be run shortly after
midnight every day (e.g., via cron).

At the moment it inserts any missing LDSP / FDSP events. It can
be extended with other tasks as needed either by expanding
Datastore.run_daily_tasks() or by adding to bin/daily_tasks.py.

Fixes #223.
2022-05-13 19:04:39 +02:00
D. Berge
632dd1ee75 Add placeholder replacement to log housekeeping tasks 2022-05-12 22:57:23 +02:00
D. Berge
2b20a5d69f Update line details on reimport conflict.
To deal with misnamed lines.

Fixes #240.
2022-05-08 15:25:11 +02:00
D. Berge
40d96230d2 Adjust planner times from runner.
Fixes #167.
2022-05-01 20:27:19 +02:00
D. Berge
fd41d2a6fa Launch database housekeeping tasks from runner 2022-05-01 20:10:27 +02:00
D. Berge
53ed096e1b Modify file hashing function.
We remove the inode from the hash as it is unstable when the
files are on an SMB filesystem, and replace it with an MD5
of the absolute file path.
2022-02-07 17:03:10 +01:00
D. Berge
7aecb514db Clear QC metadata when importing gun data.
Fixes #118.
2021-05-26 00:30:58 +02:00
D. Berge
523ec937dd Always merge metadata on import.
The INSERT INTO raw_lines / final_lines will not always be executed as
the lines may already exist (particularly in raw_lines because of
*online*), so whether it worked or not we merge the metadata immediately
afterwards (this may cause an extra notification to be fired).
2021-05-25 03:19:42 +02:00
D. Berge
bc5aef5144 Run post-import functions after final lines.
The reason why need to do it like this instead of relying on a trigger
is because the entry in final_lines is created first and the final_shots
are populated. If we first the trigger on final_lines it is not going
to find any shots; if we fire it as a row trigger on final_shots it
would try to label every point in sequence as it is imported; finally if
we fire it as a statement trigger on final_shots we have no idea which
sequence was imported.
2021-05-24 16:59:56 +02:00
D. Berge
9875ae86f3 Record P1/11 line name in database on import 2021-05-24 13:30:25 +02:00
D. Berge
67af85eca9 Recognise PENDING status in sequence imports.
If a final sequence file or directory name matches a pattern
which is recognised to indicate a ‘pending acceptance’ status,
the final data (if any exists) for that sequence will be deleted
and a comment added to the effect that the sequence has been
marked as ‘pending’.

To accept the sequence, rename its final file or directory name
accordingly.

Note: it is the *final* data that is searched for a matching
pattern, not the raw.

Closes #91.
2021-05-21 15:15:15 +02:00
D. Berge
f1cbbdb56b Check if raw P1/11 has records.
Even if it hasn't, the file gets imported anyway
(into the `files` table) but we exit early to avoid
an error when trying to determine shooting direction.

This check is not necessary for final P1/11 or gun data.

Fixes #104.
2021-05-12 20:35:51 +02:00
D. Berge
83d966c4b7 Do not import gun data into online shots.
These shots will be deleted when the raw P1 is
imported deleting the gun data, but the gun data
file will show as having been imported.

(#29)
2020-10-06 18:33:59 +02:00
D. Berge
3ed5558490 Fix query to account for new column type.
The type of the file_data.data column was
changed from JSON to JSONB by commit
2d270cdef9.

Fixes #54.
2020-10-04 04:29:14 +02:00
D. Berge
0a684cd02a Add option to import file data for preplot files 2020-10-04 03:41:20 +02:00
D. Berge
947bf72260 Rename variable.
To be consistent with the other methods.
2020-10-04 03:39:58 +02:00
D. Berge
a101542bc2 Do not import gun data if sequence has no shots.
Doing otherwise will result in the gun data file
appearing has having been read, but no data will
have been saved as there was nowhere to save to.

Fixes #29.
2020-10-03 00:44:55 +02:00
D. Berge
c013073104 Save deferred import data as a single transaction.
Each of the save_* operations starts a transaction
(which is automatically commited if all goes well).

The main reason for this is to ensure that by the
time raw_lines and final_lines events fire, the
corresponding entries in raw_shots and final_shots
have already been populated.
2020-10-02 19:31:14 +02:00
D. Berge
d192eb3668 Add CRUD operations for project info table 2020-09-10 20:39:06 +02:00
D. Berge
351d2a474b Fix NTBP detection.
Fixes #25.
2020-09-08 18:36:30 +02:00
D. Berge
19ce158329 Import SmartSource header data.
Provided that the SmartSource headers are being
saved to file, and that the path to those files
is present in the survey configuration, we now
import SmartSource information as metadata in
raw_shots.meta->'smsrc'.

Closes #19.
2020-09-06 13:45:56 +02:00
D. Berge
c6285e881e Add function to delete data by file hash 2020-09-06 13:38:37 +02:00
D. Berge
c4c09f0a9d Delete online data before importing sequence.
The deferred import routing will delete any online
data for any raw sequences that it imports.
2020-08-31 13:09:57 +02:00
D. Berge
5363ce8bab Handle NTBP flags in raw data.
This works by matching a regular expression against
the full path name (not just the file name). If it
matches, the NTBP flag is set to true.
2020-08-31 13:04:46 +02:00
D. Berge
0c7b3146ae Update label definitions when updating survey config.
It will not delete any labels that have been removed
from the configuration, as those may be used, but it
will add new labels and modify existing ones if they
changed.
2020-08-25 17:52:17 +02:00
D. Berge
4c54b7002a Add DB functions to save raw and final data from P1/11 2020-08-10 22:58:31 +02:00
D. Berge
4c5d29494c Initial commit 2020-08-08 23:59:13 +02:00