Skip to content

Commit 524b280

Browse files
committed
adding datetime field to sarracenia messages for #5
1 parent 079c716 commit 524b280

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

opendcs-acquisition/Compared_to_Sundew.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ So, about 10x less stuff to manage.
6666
* Sarracenia provides much more built-in functionality, the only code here is to interface with OpenDCS
6767
* The Sundew plugin had to implement AMQP, building messages manually, and various availability strategies with stuff being left around from previous attempts.
6868
* In the Sarracenia plugin, availability is implemented with two lines of code in producing the query selection criteria instead of an array of scripts.
69-
* Sundew's pxRouting table, which is also needed, was left out from the comparison (it's 104klines... would have dwarfed everything else.)
69+
* Sundew's pxRouting table, which is also needed, was left out from the comparison (it's 104klines... would have dwarfed everything else, would have been 100:1 in that case.)
7070
* the maintenance interventions in Sarracenia are straightforward, edit one file, and restart. in Sundew, one has to re-run a sort
71-
of compiler to rebuild configurations as an intermediate step.
72-
* in the Sundew version one must have one configuration per LRGS server, the Sarracenia plugin uses a single configuration to query all three with redundancy included.
71+
of compiler to rebuild configurations as an intermediate step. The configuration files to manage are also larger.
72+
* In the Sundew version, one has a configuration per LRGS server, the Sarracenia plugin uses a single configuration to query all three with redundancy included.
7373
* The Sarracenia version sanity checks PDTs, noting the ones missing from the OpenDCS reference, for later resolution.
74-
74+
* the Sarracenia plugin includes "geometry" (GeoJSON compatible location data) and "datetime" (observation datetime) headers in the messages,
75+
not present in Sundew ones.
7576

7677

opendcs-acquisition/INSTALL.md

+5
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ input data for dcpflow callback is the initial output from getDcpMessage -e -x (
232232
feedback from processing would be needed to understand whether this decode is easily
233233
understood by downstream consumers.
234234

235+
* in the message that accompanies the file, the following fields are set:
236+
* datetime ( e.g. 'datetime': '2023-07-16T16:16:00Z' ) the observation time from the DCS message header.
237+
* geometry ( e.g. 'geometry': {'type': 'Point', 'coordinates': (47.1714, -101.2025)} the location of the
238+
ob as per the Pdt database.
239+
235240
## Maintenance Activities
236241

237242
### Robustness to single LRGS Server failure

opendcs-acquisition/config/sr3/plugins/dcpflow.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def on_start(self):
235235

236236
self.pdts_setup()
237237

238-
def generate_message( self, BulletinFile, Pdt ):
238+
def generate_message( self, BulletinFile, Pdt , ob_time):
239239
bulletin_stat = sarracenia.stat( BulletinFile )
240240

241241

@@ -265,6 +265,8 @@ def generate_message( self, BulletinFile, Pdt ):
265265
logger.debug( f" msg: {msg} " )
266266
except Exception as ex:
267267
pass
268+
if ob_time:
269+
msg['datetime'] = ob_time.strftime("%Y-%m-%dT%H:%M:%SZ")
268270
return msg
269271
else:
270272
logger.info( f"{bf2} already received, no need to publish again. discarding {BulletinFile}" )
@@ -343,7 +345,7 @@ def gather(self):
343345
FirstLine=True
344346
if bf:
345347
bf.close()
346-
msg=self.generate_message(BulletinFile,Pdt)
348+
msg=self.generate_message(BulletinFile,Pdt,ob_time)
347349
if msg:
348350
messages.append(msg)
349351
continue
@@ -385,7 +387,7 @@ def gather(self):
385387

386388
if bf:
387389
bf.close()
388-
msg=self.generate_message(BulletinFile,Pdt)
390+
msg=self.generate_message(BulletinFile,Pdt,ob_time)
389391
if msg:
390392
messages.append(msg)
391393
rof.close()

0 commit comments

Comments
 (0)