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

Investigate alternative response layouts #143

Open
jdemaeyer opened this issue Apr 13, 2023 · 4 comments
Open

Investigate alternative response layouts #143

jdemaeyer opened this issue Apr 13, 2023 · 4 comments

Comments

@jdemaeyer
Copy link
Owner

With alerts (#106) and daily aggregates (#117, #119), we'll be hitting the limits of our current response layout, where weather is an array of hourly records.

We can possibly squeeze these new data structures into the current response layout, keeping the current key weather instead of the more adequate hourly (but can we stick to sources being an array of sources, given that the sources will be different for daily and alerts?):

{
  "weather": […],
  "daily": […],
  "alerts": […],
  "sources": […],
}

But we could also seize the opportunity to start from scratch, maybe using the layout of OpenWeatherMap's One Call API:

{
  "lat": …,
  # … and other source info on top level
  "current": {…},
  "hourly": […],
  "daily": […],
  "alerts": […],
}

or Dark Sky's layout:

{
  "latitude": …,
  # … and other source info on top level
  "currently": {…},
  "hourly": {
    "summary": "…",
    "icon": "…",
    "data": […],
  },
  "daily": {
    "summary": "…",
    "icon": "…",
    "data": […],
  },
  "alerts": […],
  "flags": {
    "sources": […],
    "dwd-stations": […],
    "wmo-stations": […],
    "units": "dwd",
  }
}
@AndiLeni
Copy link

Hey, it might be helpful to see the layout from the bund.dev proxy: https://dwd.api.proxy.bund.dev/v30/stationOverviewExtended?stationIds=10865

@AndiLeni
Copy link

@jdemaeyer any news on this topic?
I'd really love to see daily aggregates, because it is tedious to create the daily statistics over and over again in every project where I use brightsky 😄

@tawissus
Copy link

I would find aggregated values great too, but am I misunderstanding something?

First of all, this is just a loop for the included days. I just take the first 24 hours in an array and calculate min and max. Then it goes on the next 24 hours. I do this as often as the days are needed. The function can be used again and again or are the projects so different?

@AndiLeni
Copy link

Yes, it is not difficult to do it manually :)
The codebases I have are written in different languages, so I have to adapt it for each one.
The point is not the difficulty, it's for the sake of simplicity :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants