API goal lastday question

Hi,

Eessentially I just want to know if I can always use goal.lastday to guide me as to how far back I need to go when adding new datapoints?

I ask because I am not quite sure I understand this correctly:

lastday (number): Unix timestamp (in seconds) of the last (explicitly entered) datapoint.

What does “explicitly entered” mean?

Is it possible to have datapoints that have been added with later timestamps that have not updated goal.lastday?

Basically I’m trying to find the right value to use as the limit when asking for all rides from Strava that have not yet been put on beeminder. If an extra ride with an earlier date has been added manually as the last datapoint then I guess I might be retrieving more activities than I need. However, if I put the strava id in the datapoint requestid then I won’t risk putting rides in more than once.

Thanks

Non-authoratitive guess: there are a handful of system-generated pseudo-datapoints that get created, I bet they don’t count for lastday.

Looks as though it’s set by beebrain, i.e. during graph generation, where the comments describe it as the timestamp of last actually entered datapoint, pre-flatline. (Don’t ask me what that means!)
.
The two pseudo-datapoints that I see most often are the graph’s INITIAL datapoint and the RECOMMITTED datapoint. I think of them as a hack that doubtless will get resolved eventually.

I’ve just thought of a significant simplification for strava activities.

I plan to put the Strava id into the datapoint requestid. Hence, I can just start at the most recent strava activity and post it as a new datapoint. If I don’t get “duplicate datapoint” then I post the next activity and continue until I get a “duplicate datapoint” which shows I have reached activities already posted.

BUT

The first time I run I need to make sure that I don’t post activities going back for years (I have 1,000’s) so I should not post any activities prior to the first datapoint.

Is there any way to reliably find the oldest datapoint other than to loop through them all finding the earliest timestamp?

Think I can partially answer my own question.

Is goal.initday the day the goal was created? ie don’t create datapoints before this

However, that begs the question. Why does the api not return an error if I post a datapoint earlier than goal.initday?

For that matter do I get errors if I post a datapoint?

  • after goal.goaldate
  • if the goal is frozen
  • if the goal is won
  • if the user is deadbeat

It looks to me as if the api does not reject datapoints that fail in these ways because when I connected to fitbit for my weight I have got 8 pages of datapoints (all the same value and going back to August 2015, although I created the fitbit account less than a week ago).

Personally I think the api should reject at least some of these datapoints (not least because it will significantly reduce the number of calls I need to make)

I think the general answer is that the oldest datapoint is only the oldest datapoint until you create one that happened before that… :slight_smile:

As you’ve noticed, some of our official integrations update Beeminder with your entire history. If that’s not what you want, one approach might be to only create at most N datapoints on the first run, or only the past month/quarter/year.