levylabpitt / Krohn-Hite-7008

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Save to database #7

Open ciozi137 opened 1 month ago

ciozi137 commented 1 month ago

Each "Krohn-Hite Monitor & Control" should log its state to the database. I propose something like the following structure:

Table: KH_sn123: Time status
t0 {json_status}
t1 {json_status}
... ...

A instance of the instrument will query the KH7008 its attached to, get the serial number, look for a matching table with that number, and if one doesn't exist then make a new one. Also using this method the path to the KH__X table can be generated dynamically and the paths DO NOT need to be stored inside the code

ciozi137 commented 1 month ago

image

ciozi137 commented 1 month ago
Discussion yesterday leads to the following table design: Table: "KH": time [timestampTZ] device_id [text] properties [jsonb]
t0 OC_251 {allChannelProperties}
t1 OC_241 {...}
t2 OC_251 {...}
t3
t4
...
ciozi137 commented 1 month ago

table and hypertable is created but I am having difficulty doing any inserts other than using the table editor in DBeaver: image

ciozi137 commented 1 month ago

@AriaHajikhani and @pgwijesinghe I can use some help with this problem.

ciozi137 commented 1 month ago

OK libpq may be the issue:

Screenshot 2024-09-28 at 11 03 07 AM

LV-Data.PGSQL.lvclass calls pq-labview library which uses libpq.dll v9.3

I have open pull requests to pq-labview, https://bitbucket.org/drjdpowell/pq-labview/pull-requests, one of which addresses the libpq version, https://bitbucket.org/drjdpowell/pq-labview/pull-requests

Next week I can build new version of these libraries. After we confirm the build works I can ping drjdpowell to merge the pulls and perhaps push a build to vipm.io https://www.vipm.io/package/jdp_science_postgresql/

ciozi137 commented 1 month ago

I have this working. I think it was a database connection issue on my end

ciozi137 commented 1 month ago

There is an issue with timestamp vs timestamptz that needs to be resolved by an update to LV-Data package (https://github.com/levylabpitt/LV-Data/issues/117)

ciozi137 commented 2 days ago

@roysoumya687