GithubHelp home page GithubHelp logo

jnioche / carbonintensity-api Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 0.0 35 KB

A simple Rust library to retrieve data from https://api.carbonintensity.org.uk/

License: Apache License 2.0

Rust 100.00%
rust-lang carbon-intensity carbon-intensity-api national-grid

carbonintensity-api's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

carbonintensity-api's Issues

Shift date and / or time before calling the API

The API returns the 30min slot with the range inclusive of the start date

carbonintensity-api -s 2023-11-19 postcode bs7
2023-11-18 23:30:00, 223
2023-11-19 00:00:00, 241
...

We should rewrite the start date so that it is aligned with the closest 30 min boundary + 1min

Simplify CLI arguments

Since a postcode starts with a letter and a region is a numerical value, it would possible to remove the subcommand (postcode region) altogether and determine what the user wants from the input itself.
Additionally, passing nothing at all could return data for the country as a whole.

Handle date ranges of more than 13 days

The CI API limits the range between the start and end dates to 14 days. An error is returned if a user provides a greater range.
We could at least provide a utility function to return the list of maximum ranges for a given input so that the end users can call the methods themselves for each range.

Later on we could do these calls in parallel and return a unified output.

Improve outputs for date ranges

We currently return the whole RegionData

pub struct RegionData {
    regionid: i32,
    dnoregion: Option<String>,
    shortname: String,
    postcode: Option<String>,
    data: Vec<Data>,
}

including the GenerationMix which is pretty verbose. The dates are also returned as strings, which takes further processing.

If #3 gets implemented we would also need to merge the outputs from individual calls into a single output.

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.