This script now works with the new event log.
Fixes#234. Midnight positions can be added via a cronjob such
as:
$DOUGAL_ROOT/BIN/insert_event.py -t "$(date -I) 00:00:00Z" \
-l Daily -l Prod \
"Midnight position: @DMS@ (@POS@)"
Events being created or edited via the API now call
replace_placeholders() making it possible to use
shortcuts to enter some event-related information.
See #229 for details.
This redefines augment_event_data() to use interpolation rather than
nearest neighbour. It now takes an argument indicating the maximum
allowed interpolation timespan. An overload with a default of ten
minutes is also provided, as an in situ replacement for the previous
version.
The ten minute default is based on Triggerfish headers behaviour seen
on crew 248 during soft starts.
This defines a interpolate_geometry_from_tstamp(), taking a timestamp
and a maximum timespan in seconds. It will then interpolate a position
at the exact timestamp based on data from real_time_inputs, provided
that the effective interpolation timespan does not exceed the maximum
requested.
Fixes#243.
This defines a replace_placeholders() function, taking as arguments
a text string and either a timestamp or a sequence / point pair. It
uses the latter arguments to find metadata from which it can extract
relevant information and replace it into the text string wherever the
appropriate placeholders appear. For instance, given a call such as
replace_placeholders('The position is @POS@', NULL, 11, 2600) it will
replace '@POS@' with the position of point 2600 in sequence 11, if it
exists (or leave the placeholder untouched otherwise).
A scan_placeholders() procedure is also defined, which calls the above
function on the entire event log.
Fixes#229.
This adds event_position() and event_meta() functions which are used
to retrieve position or metadata, respectively, given either a timestamp
or a sequence / point pair. Intended to be used in the context of #229.
We take the first label associated with the event (if any) and use
the label's colour for the event marker. We override the colour for
QC events and use a default value for events with no labels or if
the label does not have an associated colour.
It uses https://github.com/debug-js/debug but it is meant to be
called like this:
const debug = require("DOUGAL_ROOT/debug")(__filename);
That way the calling module's path is used as the debug namespace.
This can be used as a shortcut when requiring a module from deep
within the file hierarchy, e.g., instead of:
require("../../../../lib/db");
one can do:
require("DOUGAL_ROOT/lib/db");
Strictly speaking, it doesn't consider (or know) what the shooting
status is (but see #214). All it does is colour events differently
if they have all three of: sequence, point and timestamp.
This is probably good enough for the time being to close#134.
* Adds label_in_sequence() function
NOTE: This function is already defined in schema-template.sql but
seemingly never got pushed into production.
Fixes#211.
Related to #206. If this is indeed what is causing the alerts,
we will change the logic so that it simply logs (or ignores)
invalid speeds rather than throwing.
When importing an old project, the first QC run could take a while
and cause a bit of backlog, but during normal shooting it is expected
that it will finish quite quickly (and this is monitored anyway).
NOTE: guests still do have access to the relevant API endpoint.
In theory, a persistent and computer literate guest user could
visit the API endpoint directly and retrieve the edit history.
As the edit history may need to be given to users who otherwise
do not have write access, it is considered quite acceptable to
allow guest users to access the endpoint.
Closes#194.