ClimateCompatibleGrowth / research_index

Deploys a Flask web app with a memgraph backend for exploring CCG research outputs
https://research-index.azurewebsites.net/
MIT License
0 stars 0 forks source link

Add FastAPI endpoints #43

Open willu47 opened 1 month ago

willu47 commented 1 month ago

Create API endpoints for the following:

GET
/api/authors # Filter on institution, topic, ccg_workstream
/api/authors/id
/api/outputs # Filter on result_type, topic, author
/api/outputs/id
/api/topics
/api/topics/id  # This could include countries
/api/countries. # Replaced by topics?
/api/countries/id
/api/result_types
/api/institutions # Could copy or use OpenAlex API structure
/api/ccg_workstream # At some point, it could be useful to identify where in the programme an author works

POST
/api/doi # Would add to a queue, spin up a worker and populate the database with the new output, adding authors, topics etc. as required
/api/update_citations # Would update citation counts in the output records
FrancisTembo commented 3 weeks ago

@willu47 This will require a complete migration from Flask to FastAPI. While it is theoretically possible to use both frameworks together, it is best practice to choose only one. FastAPI offers performance advantages and built-in features such as data validation with Pydantic and automatic OpenAPI documentation.

willu47 commented 2 weeks ago

Okay, that's fine. We want separate endpoints for serving templates html and json via the api/.

For example /author/<id> delivers what we currently see on the website where /api/author/<id> serves the underlying data for that author