opensatx / sawaterlevel

An iOS app that shows aquifer levels in San Antonio.
MIT License
2 stars 1 forks source link

Add SAWS stage restriction level to API #4

Closed waynehartman closed 10 years ago

waynehartman commented 10 years ago

I was doing some research on the business rules on scheduling reminders when I noticed that the current Edwards Aquifer 'stage level' didn't correspond to the current SAWS stage level. I did some additional research and found out that this happens frequently because when the Edwards stage level gets to a certain level, SAWS has to tapper off on the water that it pumps out. This means that because SAWS is pumping less, it's stage trigger doesn't necessarily have to correspond to that of the Edwards.

What this means: The server API is going to have to tell me what the current stage level is for SAWS. There's a bar at the top of the SAWS site from which the value can be scraped: http://saws.org/

I'd like to see the API enhanced to add a stageLevel property to the level API. Also, I think that the timestamp attribute could be more descriptively named (totally my fault) to something like lastUpdated. (I'm a programmer, not a poet.) The entire payload would look like this:

{
    "level" : {
        "level" : 633.0,
        "average" : 635.0,
        "lastUpdated" : "2014-07-12T20:00:00+00:00"
    },
    "stageLevel" : 2
}

The stage level is an integer enumerated value with the following domain:

No Restrictions= 0 Stage 1=1 Stage 2= 2 Stage 3= 3 Stage 4=4 Stage 5=5

davidrleonard commented 10 years ago

Sounds good.

In keeping with trying to be more human-readable, what if our second instance of level is "recent"?

i.e.

{
    "level" : {
        "recent" : 633.0,
        "average" : 635.0,
        "lastUpdated" : "2014-07-12T20:00:00+00:00"
    },
    "stageLevel" : 2
}
waynehartman commented 10 years ago

Perfect

davidrleonard commented 10 years ago

Implemented in opensatx/sawaterlevel-api#5