openclimatefix / pv-site-api

Site specific API for PV forecasting
5 stars 8 forks source link

Save API requests #154

Closed peterdudfield closed 2 months ago

peterdudfield commented 3 months ago

Detailed Description

It would be good to save the api request and the username when each API call is made, and save it to a database

Context

Possible Implementation

In the cache function, add made in this issue - https://github.com/openclimatefix/pv-site-datamodel/issues/112

mansidw commented 3 months ago

Hey @peterdudfield, was just some time back going through the openclimatefix repos via GSOC and found this particular repo interesting. I am interested in working on this feature. Could you assign this to me and I can start working on it? Would love to contribute!

mudrap17 commented 3 months ago

Hi @peterdudfield , I wanted to work on this issue and contribute to the GSoC projects! Would it possible to assign this issue to me?

suleman1412 commented 3 months ago

Hi @peterdudfield, I had worked on the referred issue pv-site-datamodel/issues/112 and I was confused whether to import the referred library or will this be from scratch?

suleman1412 commented 2 months ago

hi @peterdudfield can I take this up if there aren't any updates?

peterdudfield commented 2 months ago

Yes please @suleman1412, sorry ive been slow to reply

It would be good to import that function and use it here.

peterdudfield commented 2 months ago

@suleman1412 @mansidw @mudrap17 I would let you 3 decided who wants to do it.

peterdudfield commented 2 months ago

Merged in #161, but a test could be added to check that a api request is saved to the database when the api is called

suleman1412 commented 2 months ago

Will the test involve just the function used to save api request, like this

peterdudfield commented 2 months ago

Will the test involve just the function used to save api request, like this

yea, or could do something like this

peterdudfield commented 2 months ago

Just tested it locally, and the url seems to be blank.

Would be great to add this to the test, and check url is not None. Maybe there is a small fix somewhere

peterdudfield commented 2 months ago

Just tested it locally, and the url seems to be blank.

Would be great to add this to the test, and check url is not None. Maybe there is a small fix somewhere

We might need to add request to each api call, to make sure it goes through to the cache, https://github.com/openclimatefix/uk-pv-national-gsp-api/blob/main/src/gsp.py#L51C5-L51C22