From 430419348083daaf0b04c548d091dafbafeb93ae Mon Sep 17 00:00:00 2001 From: Joe Prosser Date: Tue, 3 Sep 2024 17:54:04 +0100 Subject: [PATCH] feat(cli): add extra dataset stats --- api/src/resources/dataset.rs | 3 +++ cli/src/commands/get/datasets.rs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/api/src/resources/dataset.rs b/api/src/resources/dataset.rs index c1f0430..9074a3f 100644 --- a/api/src/resources/dataset.rs +++ b/api/src/resources/dataset.rs @@ -55,6 +55,9 @@ pub struct Dataset { pub struct DatasetStats { pub total_verbatims: NotNan, pub validation: Option, + pub number_of_labels: usize, + pub number_of_fields: usize, + pub number_of_extraction_defs: usize, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] diff --git a/cli/src/commands/get/datasets.rs b/cli/src/commands/get/datasets.rs index 228f107..6a66cef 100644 --- a/cli/src/commands/get/datasets.rs +++ b/cli/src/commands/get/datasets.rs @@ -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(), }, }) };