Skip to content

Conversation

@ADIMANV
Copy link
Contributor

@ADIMANV ADIMANV commented Apr 30, 2025

Description

The update will add the option to fetch generation data from one of the states of India (Uttar Pradesh). This data is publicly available and the current data being fetched is live solar generation data.

How Has This Been Tested?

Ran this programme locally

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@ADIMANV ADIMANV requested a review from peterdudfield April 30, 2025 14:00
country: str = "uk",
historic_or_forecast: str = "generation",
):
def app(db_url: str, save_method: str, csv_dir: str = None, country: str = "uk"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have you rolled back this change?

if historic_or_forecast != "generation":
raise NotImplementedError("Only 'generation' mode is supported for India UPSLDC.")

# Setup headless browser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you not use selenimum here

For example you can use requests, for example

import requests
from bs4 import BeautifulSoup

URL = "https://realpython.github.io/fake-jobs/"
page = requests.get(URL)

soup = BeautifulSoup(page.content, "html.parser")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, on it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solar data is is introduced after the initial HTML is loaded. i tried using BeautifulSoup here but it wont work as the UPSLDC page loads data using JavaScript, which requests and BeautifulSoup arent able to load.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page = requests.get(url)
text = page.json(), or something liek that

import pandas as pd
from datetime import datetime

def fetch_in_data(historic_or_forecast="generation"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test for this

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

Successfully merging this pull request may close these issues.

3 participants