mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:07:09 +00:00
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.
This commit is contained in:
@@ -438,6 +438,32 @@ class Datastore:
|
||||
|
||||
self.maybe_commit()
|
||||
|
||||
def save_raw_smsrc (self, records, fileinfo, filepath, filedata = None):
|
||||
|
||||
with self.conn.cursor() as cursor:
|
||||
hash = self.add_file(filepath, cursor)
|
||||
|
||||
# Start by deleting any online data we may have for this sequence
|
||||
# NOTE: Do I need to do this?
|
||||
#self.del_hash("*online*", cursor)
|
||||
|
||||
# The shots should already exist, e.g., from a P1 import
|
||||
|
||||
values = [ (json.dumps(record), fileinfo["sequence"], record["shot"]) for record in records ]
|
||||
|
||||
qry = """
|
||||
UPDATE raw_shots
|
||||
SET meta = jsonb_set(meta, '{smsrc}', %s::jsonb, true)
|
||||
WHERE sequence = %s AND point = %s;
|
||||
"""
|
||||
|
||||
cursor.executemany(qry, values)
|
||||
|
||||
if filedata is not None:
|
||||
self.save_file_data(filepath, json.dumps(filedata), cursor)
|
||||
|
||||
self.maybe_commit()
|
||||
|
||||
|
||||
def save_file_data(self, path, filedata, cursor = None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user