Closed davidpomerenke closed 2 weeks ago
My first thoughts on this.
Endpoints:
Great! Thx for starting that! Well structured too.
A few thoughts:
Overall I think this is a very good start of a structure and we should cover most needs with it! 💪
When querying events, It would be great to get the average impact directly, as well as a few metadata. I'm thinking event timeline here. It would be costly to have to request first all events and then request the impact for each individual event. For the metadata, another option would be to request on hover with an /event/event_id endpoint or something similar, so we can show the info on hover.
Probably won't implement individual impacts per event, because the data is too noisy.
In my new designs, I visualise the "reach" of an article. Is there a good way to implement something like this? Or should we avoid any weighting of the event at all? @davidpomerenke
Good point!
Maybe we could weight them by number of participants by default (not yet in the API, but PR is ready #75), and allow switching to reach? @vogelino
We could if the amount of participants is a factor of impact in your opinion. I would avoid adding yet another option between reach and amount of participants. The complexity of the UI and the implementation grows exponentially every time a decision isn't taken and left to the users instead. I think we should decide for what makes most sense and start with that, and add the option later only if there is a very good justification for that. Talking from experience here... ':D
The way date parameters are currently implemented is not very consistent or logical. Therefore, we should decide on:
end_date
default to current date on the highest possible level)
We should determine the current date within the FastAPI routes in api.py
, then it will always be the date of the request. Otherwise (if defined within global scope) it will be the date when the app has been started. Or we just set it in the frontend.
Having request_date
as a parameter internally totally makes sense from a functional programming perspective, and especially with respect to caching. I wonder whether we also want to have it in the API. On the one hand, the REST philosophy implies (as I understand it) that a request always gives the same response. On the other hand, users may expect that the API always delivers data that is up to date.
I tend toward making it explicit in the API as well, and not setting a default in the backend (due to the mentioned complication).
Maybe we can also call it end_date
again, rather than request_date
.
I tend to agree with the fact that sending start_date
and end_date
in the request body should only return data for this range. I would be fine if the API would either require both the start_date
and end_date
and to error if start_date
is provided and end_date
is not. If none of those parameters are provided, it should return everything or a paginated result with sensible defaults. These are just some thoughts and I trust you guys with API design more that myself. :) Just let me know if anything changes. :)
How do we structure the API, what parameters and outputs should it have?