open-nomie / nomie6-oss

Opensource version of Nomie 6
MIT License
505 stars 56 forks source link

API for adding log notes #61

Open alexkutsan opened 1 year ago

alexkutsan commented 1 year ago

Nomie uses CouchDB as a backend, so I'm looking for a way to add log notes through curl. I've tried exploring the CouchDB structure, but I couldn't find a document that stores all logs in the format mentioned in the README.md. I was trying to explore browser history when I add a log note, but it makes dozen of requests at that time and it is hard to extract the required requests. It would be helpful to have this feature, especially when multiple trackable data points such as weight, sleep, and walking are collected by smart devices and I want to send them to Nomie automatically. Can someone provide some tips on how to add trackable logs to CouchDB using an HTTP request?

RdeLange commented 1 year ago

Hi, I am currently not able to help you with the specific CouchDB APi as I was not involved in that part of the code (yet).

But there is an alternative solution to have automatically push data to Nomie. This can be achieved by the Nomie API Plugin.

More details can be found at: https://github.com/RdeLange/nomie-plugin-api

Any questions concerning that plugin I should be able to answer for you.

Regards, Ronald

alexkutsan commented 1 year ago

Thanks for the recommendation! nomie-plugin-api looks quire good. The only drawback - is actually performs sync when the user enters nomie in the browser. I'll try this for the beginning, but if someone has know how to push data directly to couch DB - would be cool

alexkutsan commented 1 year ago

I found python package that is trying to use HTTP API to couch DB https://github.com/huberf/nomiepy But looks like it is compatible with some other version of nomie :-(

But inspired by this package I tried to reverse how the browser inserts data into couchdb in nomie. I was pretty surprised then when I triggered only one tracker - it sends to couch DB all trackers states with their revision history 😮

I was trying to do the same post request as browser do, and it responds 200! 🥳
изображение

But nomie does not show these changes in the timeline or dashboard :-(

If anyone could tip me how to insert tracker value with curl request to couch DB - would be extremely cool

nogweii commented 1 year ago

I think this is because the web app only reads from the locally (in-browser) stored data. And it doesn't accept data changes from CouchDB, if I understand the code correctly.

I haven't gotten around to testing this yet, but I believe it should be as simple as removing the conditional around calling change listeners.