Skip to content

Commit

Permalink
feat(cli): add extra dataset stats
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-prosser committed Sep 3, 2024
1 parent fa87853 commit 4304193
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/resources/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ pub struct Dataset {
pub struct DatasetStats {
pub total_verbatims: NotNan<f64>,
pub validation: Option<ValidationResponse>,
pub number_of_labels: usize,
pub number_of_fields: usize,
pub number_of_extraction_defs: usize,
}

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
Expand Down
7 changes: 7 additions & 0 deletions cli/src/commands/get/datasets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ pub fn get(
stats: DatasetStats {
total_verbatims: unfiltered_stats.num_comments,
validation: validation_response.ok(),
number_of_labels: dataset.label_defs.len(),
number_of_fields: dataset.entity_defs.len(),
number_of_extraction_defs: dataset
.label_defs
.iter()
.map(|l| if l.moon_form.is_some() { 1 } else { 0 })
.sum(),
},
})
};
Expand Down

0 comments on commit 4304193

Please sign in to comment.