swiss-seismological-service / REIA-ws

API for the data from the near real time event specific loss calculations.
GNU Affero General Public License v3.0
0 stars 0 forks source link

Implement Endpoint for RIA Version #18

Closed schmidni closed 8 months ago

schmidni commented 8 months ago

User Story

As a Person looking at a Risk Assessment, I would like to know which Version this is, based on the Event this Risk Assessment belongs to.

Acceptance Criteria

The structure is

event (1) <-------->  (0..*) originid (1) <--------> (0..*) riskassessment

Currently we are only counting published riskassessments per originid and basing our version number on that. Actually we should however count published riskassessments per event and base our version number on that.

The implementation is a lot more complex since the Event concept is not present in the RIA. Therefore we need to add a new endpoint, which returns the Version for a given RiskAssessment.

I would suggest adding a new riskassessment endpoint: /v1/riskassessment/{id}/version

To get the correct version, we need to find the event this riskassessment belongs to, then we need all the origins for this event, then all the published riskassessments for all those origins. Out of those we can find the version by ordering all those riskassessments by time.

kaestli commented 8 months ago

No requirement to implement this.