Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14301

How to fetch new heart rate point only in python?

$
0
0

I used python script to fetch heart rates from smartwatch and save it to firebase database using the following lines:

for element in dataPoints:    data_ref = db.collection("patients").document("patient0").collection("physioData").document(element["sensor"]).collection("data").document("data" + str(element["index"]))    add_data = {"value": element["value"], "sensor": element["sensor"], "valueFullDate": element["valueFullDate"]}    data_ref.set(add_data) 

The problem is that it fetches all data point every time I run it even the old ones and save it all to firebase which takes huge time (40 min to save 42,000 data points = 12 hours monitoring).But what I want is to fetch new data point only to save time and save the new only to firebase.

One way I thought about it is to run the script daily through a scheduler or run it on the cloud, but is there a better approach?


Viewing all articles
Browse latest Browse all 14301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>