Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad JSON files #305

Closed
sc00n opened this issue Jan 9, 2023 · 3 comments
Closed

bad JSON files #305

sc00n opened this issue Jan 9, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@sc00n
Copy link
Contributor

sc00n commented Jan 9, 2023

As dataEndPoint we use FileDataEndPoint. Unfortenatelly, the JSONs in this file are broken. We often (almost always) see the following pattern:

{"carp_header":{"study_id":"StudyMerijn","device_role_name":"masterphone","trigger_id":"13","user_id":"43190a10-9019-11ed-a6a5-051decb2df1c","start_time":"2023-01-09T12:31:31.452237Z","data_format":{"namespace":"dk.cachet.carp","name":"memory"}},"carp_body":{"id":"8bed24b0-9019-11ed-8065-ffe756b129c4","timestamp":"2023-01-09T12:31:31.451719Z","free_physical_memory":204419072,"free_virtual_memory":1940180992}}{"carp_header":{"study_id":"StudyMerijn","device_role_name":"masterphone","trigger_id":"4","user_id":"43190a10-9019-11ed-a6a5-051decb2df1c","start_time":"2023-01-09T12:31:31.453709Z","data_format":{"namespace":"dk.cachet.carp","name":"pedometer"}},"carp_body":{"id":"8bed72d0-9019-11ed-a864-97ae77e357e3","timestamp":"2023-01-09T12:31:31.453545Z","step_count":13389}}{"carp_header":{"study_id":"StudyMerijn","device_role_name":"masterphone","trigger_id":"12","user_id":"43190a10-9019-11ed-a6a5-051decb2df1c","start_time":"2023-01-09T12:31:31.454797Z","data_format":{"namespace":"dk.cachet.carp","name":"connectivity"}},"carp_body":{"id":"8bed99e0-9019-11ed-a9bb-a3362f2bf6ee","timestamp":"2023-01-09T12:31:31.454645Z","connectivity_status":"mobile"}}
,
 
,
 
,

Three entries, and only then we see the three commas. The commas obviously should be between the entries. This makes it very difficult to read the files. Sometimes its more or less entries that are posted without commas.

sc00n added a commit to sc00n/carp.sensing-flutter that referenced this issue Jan 9, 2023
Related to cph-cachet#305
As the current version writes activeSink.write('\n,\n')  in async, they are sometimes not added directly after the json. This pull request fixes this.
@sc00n
Copy link
Contributor Author

sc00n commented Jan 9, 2023

created a pull request to fix this: sc00n#1

@bardram bardram self-assigned this Jan 13, 2023
@bardram
Copy link
Contributor

bardram commented Jan 13, 2023

I will try to look into this.

But, since v. 0.40 CAMS have supported the SQLiteDataEndPoint data endpoint which stores data in a local SQLite database using the SQLiteDataManager.

This method is much more stable (and fast) than the file endpoint and I recommend using this instead. The data format is the same, just stored in a table in SQLite.

@bardram bardram added the bug Something isn't working label Jan 13, 2023
bardram added a commit that referenced this issue Jan 13, 2023
@bardram
Copy link
Contributor

bardram commented Jan 13, 2023

Fixed and released as carp_mobile_sensing 0.40.11

@bardram bardram closed this as completed Jan 13, 2023
bardram added a commit that referenced this issue Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants