Commit Graph

521 Commits

Author SHA1 Message Date
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
de2deedfd2 Do not refresh sequence list on raw_shots event.
Otherwise, it will get refreshed continuously while
online, which is not great.
2020-10-02 19:30:24 +02:00
D. Berge
eb37a6b6c6 Listen also to shot events.
We need this because the *_lines event will
always fire before any shots have been imported.
2020-10-02 18:35:05 +02:00
D. Berge
198d0072d4 Show sequence remarks + NTBP status on map.
Closes #50.
2020-10-02 17:58:44 +02:00
D. Berge
11a5020004 Remove old QCs when importing final shots.
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.
2020-10-02 17:30:42 +02:00
D. Berge
e8c230ccc2 React to sequence change notifications in SequenceList 2020-10-02 16:33:06 +02:00
D. Berge
cf1678ed25 Increase body-parser limits.
Fixes #51.
2020-10-02 15:28:43 +02:00
D. Berge
940aea8c7b Run events manager in a separate process.
Not sure if this is going to do anything in
terms of improving the handling of and reacting
to events, but it doesn't seem to hurt terribly.

Eventually, all this will probably need to be
refactored to use EventEmitter.
2020-10-02 01:34:49 +02:00
D. Berge
c404edc4b3 Improve reliability of reaction to events.
Hopefully.
2020-10-02 01:33:58 +02:00
D. Berge
7451433aa4 Remove debugging statements 2020-10-02 01:33:33 +02:00
D. Berge
cf9cb393a9 Fix table labelling 2020-10-02 00:47:39 +02:00
D. Berge
b77ffa5d0f Ensure line statuses are visible on mobile 2020-10-02 00:42:19 +02:00
D. Berge
f30f108e08 React to preplot_lines notifications 2020-10-02 00:41:16 +02:00
D. Berge
746e3405fb Let websocket listen to all DB notification channels 2020-10-02 00:39:53 +02:00
D. Berge
902338f835 Restrict patching actions to vessel lines only.
These are the only type of lines returned by list().
2020-10-01 18:37:49 +02:00
D. Berge
381e3773c6 Allow editing of remarks in preplot lines list 2020-10-01 18:28:59 +02:00
D. Berge
f9ef971802 Add preplot line patching endpoint.
Allows us to change remarks, meta and ntba
fields in preplot lines.
2020-10-01 18:28:02 +02:00
D. Berge
3a87f8959a Add slot for empty line status 2020-10-01 15:31:24 +02:00
D. Berge
c12c2a3861 Update events view.
Searches for timed events geometry within
the event's own metadata.
2020-09-30 22:49:01 +02:00
D. Berge
21439fdd3e Associate a position with timed events if possible.
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.
2020-09-30 22:45:50 +02:00
D. Berge
79a751393c Highlight active row in preplot lines list 2020-09-30 20:12:15 +02:00
D. Berge
60000eeaf1 Make preplot lines list searchable 2020-09-30 20:04:35 +02:00
D. Berge
d2c65b480b Add status information to preplot lines list 2020-09-30 19:44:15 +02:00
D. Berge
589fe07ad6 Add <dougal-line-status/> component.
It shows a graphical representation of the
acquisition status of a preplot line, as
stacked bars where each bar represents the
acquisition extent of a sequence. This is
complemented by colour denoting the raw/final/
ntbp status of the sequence and by a tooltip
with the same information. Sequence bars may be
made clickable by providing a function to the
"sequence-href" property; this function should
take a sequence object and return a URL.
2020-09-30 19:41:09 +02:00
D. Berge
bdf573d4a6 Add Dougal-specific data to structured sequence exports 2020-09-30 15:54:16 +02:00
D. Berge
873c29ad00 Remove logging statement 2020-09-30 15:40:31 +02:00
D. Berge
3c1a5da1a8 Suspend trigger during system data import 2020-09-30 15:39:37 +02:00
D. Berge
19db65c999 Change configuration paths for SSE export 2020-09-30 15:39:10 +02:00
D. Berge
32d97a4856 Fix errors in Multiseis export 2020-09-29 20:28:56 +02:00
D. Berge
e7099643f5 Try harder to produce Multiseis export files.
We try to ensure that for each sequence we have
at least FSP and LSP entries. We do this by:

* If there exists a FGSP / LGSP, we clone those as
FSP / LSP respectively.

* Otherwise, we take the first and last shots
found in the final P1 which have a preplot.

We also include log comments whenever possible and
format the azimuth a bit better.
2020-09-29 18:05:46 +02:00
D. Berge
65c26f56c7 Import proper UTF-8.
What's the point of Python defaulting to ASCII
when JSON is explicitly defined as a binary
format with a default character encoding of
UTF-8? 🙄
2020-09-29 17:46:56 +02:00
D. Berge
2733223037 Refresh the log more aggressively.
On the backend, the events endpoint caches responses
by ETag in order to reduce the load on the database
and response times. That cache is supposed to be
invalidated with the middleware receives a notification
that the underlying data has changed. However, that
change might arrive just *after* the HTTP request,
meaning that if we let the browser do its thing we
will probably be returning stale data.

So what we do is we explicitly request a non-cached
response when we know that something has changed
because we changed it ourselves.

What we do not do is bypass the cache if we receive
a change event notification, as we assume that the
HTTP roundtrip will be more than sufficient for
the server to have invalidated (and perhaps even
refreshed) its response.
2020-09-29 00:30:40 +02:00
D. Berge
77ff9a047c Pass a different copy of the data to each listener 2020-09-28 23:07:27 +02:00
D. Berge
2886bd4943 Do not react to events until we have at least two of them.
This is to avoid false positives when restarting the API
mid-line.
2020-09-28 21:43:24 +02:00
D. Berge
03563bdaf2 Auto-create FSP/LSP events from nav header.
If the nav header is being received, this will
try to detect the start and end of line and create
an entry in the log.

It doesn't check whether FSP/FGSP LSP/LGSP entries
already do exist for that sequence.

Closes # 28.
2020-09-28 21:36:32 +02:00
D. Berge
7758f08a79 Use array instead of set for storing callbacks 2020-09-28 21:33:16 +02:00
D. Berge
b73dd3fe1e Add function to return project ID from schema name 2020-09-28 21:32:28 +02:00
D. Berge
0d72ea3c88 Purge QCs that are no longer failing.
If a QC has failed in the past there will be a
record of it in raw_lines, raw_shots or preplot_points.

If that QC then stopped failing, e.g., because of a
change of parameters, then the QC results would correctly
reflect the change but not the line/shot tables and
hence, the event log.

This commit hopefully takes care of that.
2020-09-28 14:58:48 +02:00
D. Berge
e75e866285 Tidy up formatting 2020-09-28 13:12:18 +02:00
D. Berge
ca41bd8132 Do not lose data during database upgrades.
The database upgrade script is updated to export
also user-entered data stored in columns of tables
containing also derived data, and to re-import
everything after the upgrade.
2020-09-27 19:36:28 +02:00
D. Berge
a05ecfd41c Add functions to export/import specific columns from DB.
Unlike system_imports.py and system_exports.py, which
deal with whole tables via COPY, this allows us to
export / import *either* whole tables or specific
columns only.

The data will be exported to text files containing
the selected columns + the primary key columns for
the table.

When importing, those tables for which a selection
of columns was exported must already be populated.
The import process will overwrite the data of the
non primary key columns it knows about. If whole
tables are exported, on the other hand, when
re-importing rows will be appended rather than
updated. It is the user's responsibility to make
sure that this will not cause any conflicts.
2020-09-27 19:29:48 +02:00
D. Berge
bf313dd8e5 Allow editing of remarks in sequence list 2020-09-27 19:25:45 +02:00
D. Berge
371030e61e Add optional callback to Vuex API action.
The callback has the signature (err, res) where
res is the result object from the fetch() request
and err is non-null if an error occurred and fetch()
threw.

The callback is called before res.json() has had a
chance to run it is really not recommended to
consume the body from this callback as this will cause
an error in the API action itself.
2020-09-27 19:23:04 +02:00
D. Berge
fd1f1a2c1a Implement sequence patching endpoint.
Allows us to change remarks and meta fields in sequences.
2020-09-27 19:21:59 +02:00
D. Berge
bfcc02a140 Comment out logging statement 2020-09-27 19:19:47 +02:00
D. Berge
a7b4b70d59 Remove spurious semicolon 2020-09-27 19:19:19 +02:00
D. Berge
3bd8cbe860 Handle projects for which there is (yet) no QC data 2020-09-27 19:18:19 +02:00
D. Berge
5a74953739 Add vars() method to configuration.py.
Returns some shell variables that are used
by various deferred import processes.
2020-09-27 19:16:44 +02:00
D. Berge
303befef3b Add human exports to runner 2020-09-26 23:41:09 +02:00
D. Berge
4e70090b40 Export structured sequence data to JSON files.
Script meant to be run by runner.sh.

It will not overwrite existing files. If a
sequence is modified after the first export,
the resulting file needs to be removed by the
user before a re-export will occur.

The idea is to eventually export on demand
when a new raw is added to final_lines.
2020-09-26 22:57:36 +02:00