Code Monkey home page Code Monkey logo

frequenz-api-weather's People

Contributors

cwasicki avatar dependabot[bot] avatar llucax avatar noah-kreutzer-frequenz avatar shsms avatar talwesingh avatar tiyash-basu-frequenz avatar

Watchers

 avatar  avatar  avatar  avatar

frequenz-api-weather's Issues

Setup Repo

  • Labels
  • Discussions
  • General
  • Collaborators and Teams
  • Branches
  • Tags
  • Code security and analysis

Rename `StreamLiveWeatherForecast` rpc call to `ReceiveLiveWeatherForecastStream`

What's needed?

Please rename StreamLiveWeatherForecast rpc call to ReceiveLiveWeatherForecastStream to keep it in sync with the other APIs. This is needed to better differentiate between rpc endpoints receiving a stream or sending a stream.

rpc StreamLiveWeatherForecast (StreamLiveWeatherForecastRequest)

Proposed solution

No response

Use cases

No response

Alternatives and workarounds

No response

Additional context

No response

Support multiple locations requests

What's needed?

We need the ability to request multiple locations at a time.

Proposed solution

Please add the following below to the common Protobuf repository and import it from there:

+// Pagination parameters for list requests.
+message PaginationParams {
+ // Maximum number of results to be returned per request.
+ // If not set, the default value is 50.
+  uint32 page_size = 1;
+
+  // Identifies a specific page of the list results.
+ string page_token = 2;
+}

+// Metadata for paginated list responses.
+message PaginationInfo {
+  // Total number of orders that match the filter criteria.
+  uint32 total_items = 1;
+
+  // Token for retrieving the next set of results.
+  string next_page_token = 2;
+}

Please apply the diff to the Weater API Protofbuf spec:

// ... (no change)

service WeatherForecastService {
 // ... (no change)
 rpc GetHistoricalWeatherForecast (GetHistoricalWeatherForecastRequest)
-   returns (ForecastResponse);
+  returns (GetHistoricalWeatherForecastResponse);

 // Streams live weather forecast features for a geo location as they become
 // available. Initially, the most recent forecast will be streamed.
 rpc ReceiveLiveWeatherForecastStream (ReceiveLiveWeatherForecastStreamRequest)
-  returns (stream ForecastResponse);
+  returns (ReceiveLiveWeatherForecastStreamResponse);

}

message GetHistoricalWeatherForecastRequest {
-  // The location for which the forecast is being requested.
+  // The locations for which the forecast is being requested.
+  // The maximum number of locations that can be requested is 50.
-  frequenz.api.common.location.Location location = 1;
+  repeated frequenz.api.common.location.Location location = 1;

  // List of required features. If none are specified, all available features
  // will be returned.
  repeated ForecastFeature features = 2;

  // The UTC timestamp indicating the start of the requested historical forecast
  // period.
  google.protobuf.Timestamp start_ts = 3;

  // The UTC timestamp indicating the end of the requested historical forecast
  // period.
  google.protobuf.Timestamp end_ts = 4;

+ // Pagination parameters.
+ //
  // Specifies the maximum number of forecasts to be returned in a single
  // response. If not provided, a default page size will be used.
-  int32 page_size = 5;
+ PaginationParams pagination_params = 4;
}

message StreamLiveWeatherForecastRequest {
-  // The location for which the forecast is being requested.
+  // The locations for which the forecast is being streamed.
+  // The maximum number of locations that can be streamed is 50.
-  frequenz.api.common.location.Location location = 1;
+  repeated frequenz.api.common.location.Location location = 1;
  
  // ... (no change)
}

- // The ForecastResponse message encapsulates the weather forecast data returned
- // by the SubscribeWeatherForecast method. It provides a structured format for
+ // The ForecastResponse message provides a structured format for
// representing forecast data for a specific location, including timestamps
// for validity and creation.
-message ForecastResponse {
+message LocationForecast {
  // ... (no change)
}

+// A list of forecasts for the requested locations.
+message GetHistoricalWeatherForecastResponse {
+  // List of forecasts per location.
+  repeated LocationForecast forecast= 1;

+  // Metadata for pagination, including token for next page to retrieve.
+  PaginationInfo pagination_info = 4;
+}

// Response to a subscription request for a stream of forecasts for a list of locations.
// Real-time information on forecasts is pushed through this response.
+message ReceiveLiveWeatherForecastStreamResponse {
+  // Forecast for a location being broadcasted in real-time.
+  LocationForecast forecast= 1;
+}
}

Use cases

No response

Alternatives and workarounds

No response

Additional context

Depending on #18

Split `ForecastRequest` into two messages for each RPC

What's needed?

Currently there is only one request message used for both RPCs GetHistoricalWeatherForecast and StreamLiveWeatherForecast. We need to split this up because StreamLiveWeatherForecast does not support start_ts, end_ts, and page_size parameters.

Proposed solution

syntax = "proto3";

package frequenz.api.weatherforecast.v1;

import "frequenz/api/common/location.proto";
import "google/protobuf/timestamp.proto";

// Service provides operations related to retrieving weather forecasts for
// locations.
//
// The forecasts are updated regularly, and the service will stream the latest
// available data unless a specific time range is requested.
// !!! note
//     Weather forecasts are inherently uncertain and actual conditions may
//     vary. Use the data responsibly.
service WeatherForecastService {
  // Returns historical weather forecast features for a geo location for a
  // specified time range.
- rpc GetHistoricalWeatherForecast (ForecastRequest)
+ rpc GetHistoricalWeatherForecast (GetHistoricalWeatherForecastRequest)
    returns (ForecastResponse);

  // Streams live weather forecast features for a geo location as they become
  // available. Initially, the most recent forecast will be streamed.
- rpc StreamLiveWeatherForecast (ForecastRequest)
+ rpc StreamLiveWeatherForecast (StreamLiveWeatherForecastRequest)
    returns (stream ForecastResponse);
}

// Weather features (e.g. wind speeds or solar radiation) available for query
// through the API.
enum ForecastFeature {
  // ... (no change)
}

-// The ForecastRequest message is used to specify the parameters for the
-// SubscribeWeatherForecast method. It allows users to request weather forecasts
-// for a specific location and time period, with specified features. 
+// The GetHistoricalWeatherForecast message is used to specify the parameters for 
+// requesting historical weather forecasts for a specific location and time period, 
+// with specified features.
- message ForecastRequest {
+message GetHistoricalWeatherForecastRequest {
  // The location for which the forecast is being requested.
  frequenz.api.common.location.Location location = 1;

  // List of required features. If none are specified, all available features
-  // will be streamed.
+  // will be returned.
  repeated ForecastFeature features = 2;

-// Optional for StreamLiveWeatherForecast, ignored if provided.
-// The start of the period for which the forecast is being requested.
+// The start of the period for which the historical forecast is being requested.
  google.protobuf.Timestamp start_ts = 3;

-// Optional for StreamLiveWeatherForecast, ignored if provided.
-// The end of the period for which the forecast is being requested.
+// The end of the period for which the historical forecast is being requested.
  google.protobuf.Timestamp end_ts = 4;

-// Optional for StreamLiveWeatherForecast, ignored if provided.
-// Specifies the maximum number of forecasts to be returned in a single
-// response.
+// Specifies the maximum number of forecasts to be returned in a single
+// response. If not provided, a default page size will be used.  
  int32 page_size = 5;
}

+// The LiveForecastRequest message is for requesting live weather forecasts.
+message StreamLiveWeatherForecastRequest {
+  // The location for which the forecast is being requested.
+  frequenz.api.common.location.Location location = 1;
+
+  // List of required features. If none are specified, all available features
+  // will be streamed.
+  repeated ForecastFeature features = 2;
+}

Use cases

No response

Alternatives and workarounds

No response

Additional context

No response

Allow clients to request a subset of validity times

What's needed?

Currently the weather forecast streaming method and the historical forecast method would return all available validity times for every request. This could be a lot more data than what's actually necessary when there's high resolution data or longer term predictions.

To avoid this, the methods should accept an optional filter for validity times in their requests.

Proposed solution

A possible implementation could look like this: https://github.com/frequenz-floss/frequenz-api-weather/pull/56/files

Use cases

No response

Alternatives and workarounds

No response

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.