tinkershack / meteomunch

Munch is a package/webserver that assimilates select set of meteo data from multiple weather providers.
MIT License
2 stars 3 forks source link

feature: Define and implement Provider interface for providers package #5

Open raamsri opened 2 months ago

raamsri commented 2 months ago

feature: Define and implement Provider interface for providers package

Summary:

Implement Provider interface in the providers package. This interface will provide methods for interacting with various weather data providers.

Package providers must offer an interface and a factory method for weather data providers. This package is designed to facilitate the integration of various weather data providers by defining a common interface that each provider must implement. It may include a factory method to instantiate the appropriate provider based on a given name.

The main components of this package would be(Preemptively. This may change):

Expected usage:

    provider, err := providers.NewProvider("open-meteo")
    if err != nil {
        log.Fatal(err)
    }
    data, err := provider.FetchData(queryParams)
    if err != nil {
        log.Fatal(err)
    }

Details:

  1. Interface Description: Provider interface:

     package providers
    
     type Provider interface {
          FetchData(queryParams map[string]string) (*plumber.BaseData, error)
     }
  2. Package Description:

    • This package will include methods to retrieve data from different weather data providers.
  3. Outcome:

    • Provide a standardized way to interact with various weather data providers.
    • Facilitate easier integration and swapping of different providers in the future.
    • Seamlessly merge API response from multiple providers to realize the required set of plumber.BaseData fields.
  4. Dependencies:

    • No external dependencies apart from the obvious third party API providers
    • Ensure compatibility with existing packages that interact with weather data providers.
  5. Acceptance Criteria:

    • Implement the FetchData method in the new package. More may be added as necessary.
    • Update documentation to include usage examples and integration guidelines.
    • Write unit tests to verify the functionality of the new package. [deferring this for this package til testing modules are implemented for other simpler packages]
  6. Additional Information:

    • Consider future extensions to support additional weather data providers.
    • Establish the essential meteo parameters that aren't yet included in plumber.BaseData that's pulled from various providers
    • Ensure the package is designed to be easily extensible for new provider implementations.
raamsri commented 2 months ago

This will need many more dedicated issues to address and meet the desired outcome in smaller steps.

yendelevium commented 1 month ago

Cool