quartz-frontend icon indicating copy to clipboard operation
quartz-frontend copied to clipboard

Data Fetching Module for Mock Data #505

Open Jacqueline-J opened this issue 1 year ago • 1 comments

Pull Request

This pull request addresses issue #505, "Mock data UI,". Specifically, the following files were added

Added the data fetching modules under /nowcasting-app/components/helpers/

  • fetchData: A module that includes two functions: fetchData and fetchDataFromAPI. fetchData accepts a file path and a boolean flag (useMockData). It fetches data either from a local mock file (loadMockData) or from an external API (fetchDataFromAPI) based on the value of the flag. Users need to update the file path to the mock data and set the useMockData flag accordingly.
  • fetchDataFromAPI : This function sends a POST request to obtain an access token for authentication, then uses this token to fetch data from the API. Users need to update the login requirements to generate a token.
  • loadMockData :This function parses JSON data from a file and returns it. Users need to provide the file path to the mock data.

Added mock data files under data/mockData

Added mock data for Delta and PV forecast views. Three random sites were chosen for each.

Checklist:

  • [x] My code follows OCF's coding style guidelines
  • [x] 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
  • [x] I have checked my code and corrected any misspellings

Jacqueline-J avatar May 14 '24 18:05 Jacqueline-J

@Jacqueline-J is attempting to deploy a commit to the Open Climate Fix Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 14 '24 18:05 vercel[bot]

Hey @Jacqueline-J,

Firstly, really sorry for the year(!) long delay in my intended circling back through and getting on top of all this Github housekeeping – even for me, that's a long time... apologies.

A lot of what you have in here is great, a logical approach for sure, and I particularly like the dynamic loading of files for the specific GSPs we have mock data for; the main this here is that this task wasn't particularly well defined as to what the requirements were and finding a suitable approach, which I can only assume would have made this a lot easier for you with less assumptions needed... overall, in order for this to be a drop-in replacement for the API using mock data, and indeed now as a replacement for the re-implemented local API running with dynamically generated mock data, this UI will also need to run using some kind of dynamic mock data functions to adequately mirror what we expect the data to look like.

I've left a comment on the original issue to that effect, but kept that open as we will almost certainly want to revisit in the future, and for now I'm going to close off this Pull Request if that's okay. Sorry if any time spent feels wasted, this is a definite downside of open source in this way and I particularly try to avoid this as much as humanly possible... thanks for your effort and interest here, and it would be great to see your tag on our contributors again in the future, so don't hesitate to ask questions on this or any other repos if you'd like to pick something else up!

braddf avatar May 12 '25 15:05 braddf

Hi @braddf,

No worries at all — I completely understand how things can get pushed down the list, and I really appreciate you circling back and taking the time to review it.

Thanks also for the thoughtful feedback and context — it’s all very helpful. I’m glad to have had the chance to dig into the structure of the project, and even if the work doesn’t get merged, I’m always happy to contribute where I can.

I'll definitely keep an eye out for other opportunities to help out, and I’d be glad to jump in again when something comes up. Thanks again for your time!

Jacqueline-J avatar May 21 '25 07:05 Jacqueline-J