-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
345218d
commit 7eeab32
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
backend/src/main/kotlin/org/loculus/backend/api/StatisticsResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.loculus.backend.api | ||
|
||
/** | ||
* Response model for pipeline statistics endpoint. | ||
* Shows the count of sequences by organism and pipeline version. | ||
*/ | ||
data class PipelineStatisticsResponse( | ||
// Map of organism name to statistics for that organism | ||
val statistics: Map<String, OrganismPipelineStatistics> | ||
) | ||
|
||
/** | ||
* Statistics for a specific organism | ||
*/ | ||
data class OrganismPipelineStatistics( | ||
// Total number of sequences for this organism | ||
val totalSequences: Int, | ||
// Count of sequences by pipeline version | ||
val sequencesByPipelineVersion: Map<Long, Int> | ||
) |
27 changes: 27 additions & 0 deletions
27
backend/src/main/kotlin/org/loculus/backend/controller/StatisticsController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.loculus.backend.controller | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement | ||
import org.loculus.backend.api.PipelineStatisticsResponse | ||
import org.loculus.backend.service.submission.SubmissionDatabaseService | ||
import org.springframework.http.MediaType | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/statistics") | ||
@SecurityRequirement(name = "bearerAuth") | ||
class StatisticsController( | ||
private val submissionDatabaseService: SubmissionDatabaseService, | ||
) { | ||
@Operation( | ||
description = "Get statistics on sequences processed by pipeline version for each organism", | ||
) | ||
@GetMapping("/pipeline-versions", produces = [MediaType.APPLICATION_JSON_VALUE]) | ||
fun getPipelineStatistics(): PipelineStatisticsResponse { | ||
return PipelineStatisticsResponse( | ||
statistics = submissionDatabaseService.getPipelineStatistics() | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters