Comments (4)
hmmm, im not quite sure how to do that.
I have a 'geoDataFrame' and i use to_json to put it to a json object.
Admittedly, all respsonse need response.json() to get the object.
Is json normally a string, but just the string is ~ like a dictionary - https://www.w3schools.com/python/python_json.asp
from uk-pv-national-gsp-api.
I just had another look.
So currently the endpoint for the GSP shapes returns this:
"{\"key\": \"value\"}"
But typically, with REST APIs, it would be good to return the JSON directly, instead of the string escaped version, ie
{"key": "value"}
geopandas.GeoDataFrame.to_json seems to return the JSON as string, as per the docs. I'd suggest that instead we try to return the dict directly, ie
to_json()
-> to_dict()
According to FastAPIs docs, they would convert that dict into JSON automatically.
I wasn't able to get the API running locally, so I couldn't try it myself yet.
from uk-pv-national-gsp-api.
Cool ill do this - thanks for looking into this @flowirtz.
Im interested what error you got when you ran it locally?
from uk-pv-national-gsp-api.
Fantastic, thanks so much, Peter! I don't remember anymore tbh, but I'll try running it again later this week and debug together with you :)
from uk-pv-national-gsp-api.
Related Issues (20)
- Update gsp/forecast/{gsp_id} route HOT 1
- Upgrade API to produce plevels
- Move `save_api_call_to_db` to within caching HOT 3
- national value seems to change HOT 4
- Weird plevels HOT 2
- 4 hour view not showing up
- Cache concurrency bug
- Documentation link not working HOT 7
- Speed up get all pvlive data HOT 1
- Speed up get all forecasts HOT 3
- Add forecast creation time and other metadata to national
- GSP map is mucked up HOT 4
- Spike: Refactor GSP/All requests (forecast/truth) to be more DRY HOT 7
- Reduce variable names HOT 2
- Meta: speed ups
- Pivot return object
- Add time filters on forecast and pvlive routes
- add filter on gsp
- active caching
- Add metadata to forecast/national HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uk-pv-national-gsp-api.