Resolve "Make event log entries for start and end of line upon import of final sequence, if the entries do not already exist"
Closes#57
See merge request wgp/dougal/software!11
These files contain the sequence of SQL commands needed to bring
a database or project schema up to date with the latest template
database or project schema.
These files must be applied manually. Check the comments at the top of
the file for instructions.
Adds:
* label_in_sequence (_sequence integer, _label text):
Returns events containing the specified label.
* handle_final_line_events (_seq integer, _label text, _column text):
- If _label does not exist in the events for sequence _seq:
it adds a new _label label at the shotpoint obtained from
final_lines_summary[_column].
- If _label does exist (and hasn't been auto-added by this function
in a previous run), it will add information about it to the final
line's metadata.
* final_line_post_import (_seq integer):
Calls handle_final_line_events() on the given sequence to check
for FSP, FGSP, LGSP and LSP labels.
* events_seq_labels_single ():
Trigger function to ensure that labels that have the attribute
`model.multiple` set to `false` occur at most only once per
sequence. If a new instance is added to a sequence, the previous
instance is deleted.
* Trigger on events_seq_labels that calls events_seq_labels_single().
* Trigger on events_timed_labels that calls events_seq_labels_single().
There is no concept of ‘current survey’ in Dougal, and
assigning navigation data to a particular survey is full
of edge cases but sometimes it is necessary or at least
convenient to do so.
This commit implements once such strategy, which consists
of checking the distance to the preplots of all active
surveys (well, those that do have preplots anyway) and
picking the nearest one.
To reduce load, we only do this every once in a while as
governed by the `offline_survey_detect_interval` option
in the configuration.
This strategy is only active if the configuration option
`offline_survey_heuristics == "nearest_preplot"` for the
corresponding navigation header.
The `sequences` object now carries the attribute
`has_smsrc_data`, a boolean which is true iff
there is at least one `smsrc` record in the raw
shots metadata.
This is used by:
1. A new sequence-wise test which reports if gun
data is missing for the entire sequence.
2. The individual `missing_gun_data` test which
is inhibited if `has_smsrc_data` for the
corresponding sequence is false.
Closes#93.
We now check that a file is at least a few seconds old
before attempting to import it.
The actual minimum age can be configured in etc/config.yaml or
else is defaults to 10 seconds.
The idea is that this should give the OS enough time to fully
write the file before we import it.
The timestamp being looked at is the modification time.
Fixes#92.
When final shots are inserted, updated or
deleted, the corresponding QC info (which
is always held in raw_shots.meta->'qc')
is deleted.
If applicable, it will be recreated on the
next QC run.
When inserting or updating a timed event, a trigger
searches the real time events table for a position
close (within one minute) of the event time and
adds it to the event's metadata.