I am trying to pull images from an SQLite database from a cell phone application (used to perform personal spirometry: lung function testing).
I have been able to access all the numerical data I need, but cannot access the image data showing the flow curves (air volume is plotted and shown over the duration a person exhales). Based on the shape of the flow curve, a clinician can determine if the test is valid. My goal is to create an R package to view the numerical data and flow curves so the data can be reviewed by a clinician.
The data structure:
> str(s_blobs)
'data.frame': 6 obs. of 2 variables:
$ Z_PK : int 1 2 3 4 5 6
$ ZFVCCURVECOMPRESSED: blob [1:6]
..$ : raw 62 70 6c 69 ...
..$ : raw 62 70 6c 69 ...
..$ : raw 62 70 6c 69 ...
..$ : raw 62 70 6c 69 ...
..$ : raw 62 70 6c 69 ...
..$ : raw 62 70 6c 69 ...
..@ ptype: raw
>
My issue is very similar to this. However, I am unable to open the exported file because it says it is empty. I can open the database with DB Browser and view/export the binary data. When I upload the binary to an online tool, an image is not created. I could not open the file with ImageJ either.
I have the option to view the file as 'binary' or 'image' in DB Browser. When I select the mode as 'image,' no image appears. Is it possible to pull the image?
Session info:
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.5.1
I am using RSQLite
and DBI
to connect and read the database.
UPDATE
A sample dataset (xb
) has been uploaded to my R package: https://github.com/wolfeclw/spirobankR.
Here is the script I am working with using @MrFlick's package myphone
.
library(spirobankR)
library(myphone)
ex_blob <- xb[[1]]
decode_binary_plist(ex_blob)
Trying to use decode_binary_plist
throws me the following error:
Error in expanded_values[[i]] : subscript out of bounds
.