feat: add learning objective targets
Pipeline / check (pull_request) Failing after 3m25s
Pipeline / docs (pull_request) Skipped
Pipeline / nightly (pull_request) Skipped
Pipeline / release (pull_request) Skipped

This commit is contained in:
alexm committed 2026-09-21 14:02:34 -04:00
1 parent 9755417899
commit 8ec48fb185
32 files changed
+2396 -448

No files matched your search

+1 -1
View File
@@ -347,7 +347,7 @@ pub fn ingest(
score,
response_time_seconds: None,
level: None,
learning_objectives: Vec::new(),
learning_targets: Vec::new(),
topics: Vec::new(),
bonus: false,
dropped: false,
+1 -1
View File
@@ -705,7 +705,7 @@ mod tests {
score: 0.0,
response_time_seconds: None,
level: None,
learning_objectives: Vec::new(),
learning_targets: Vec::new(),
topics: Vec::new(),
bonus: false,
dropped: false,
+1 -1
View File
@@ -655,7 +655,7 @@ pub fn to_responses(questions: &[Question], ctx: &Context) -> Import {
score: row.score,
response_time_seconds: None,
level: None,
learning_objectives: Vec::new(),
learning_targets: Vec::new(),
topics: Vec::new(),
bonus,
dropped: false,
+15 -10
View File
@@ -101,7 +101,7 @@ pub struct Response {
/// The item's level, denormalized so analysis need not carry the catalog.
pub level: Option<Level>,
/// The item's learning objectives, denormalized for per-objective mastery.
pub learning_objectives: Vec<String>,
pub learning_targets: Vec<String>,
/// The item's topics, denormalized.
pub topics: Vec<String>,
/// Whether the item was bonus, and so excluded from the scored total.
@@ -435,10 +435,10 @@ impl ResponseSet {
if let Some(cat) = catalog {
if let Some(entry) = cat.get(&p.item) {
r.level = Some(entry.item.level);
r.learning_objectives = if p.learning_objectives.is_empty() {
entry.item.learning_objectives.clone()
r.learning_targets = if p.learning_targets.is_empty() {
entry.item.learning_targets.clone()
} else {
p.learning_objectives.clone()
p.learning_targets.clone()
};
r.topics = entry.item.topics.clone();
if r.points_possible == 0.0 && !p.bonus {
@@ -447,7 +447,7 @@ impl ResponseSet {
}
} else {
r.level = p.level;
r.learning_objectives = p.learning_objectives.clone();
r.learning_targets = p.learning_targets.clone();
}
// Apply the record's credit overrides, which is how a decision to
@@ -652,8 +652,13 @@ pub struct FlatResponse {
pub response_time_seconds: String,
/// The level code 1..5, 0 when unknown.
pub level: u8,
/// Comma-joined objective ids.
pub learning_objectives: String,
/// Comma-joined target ids.
///
/// The column keeps its original name. Renaming a column in a store that
/// already holds collected administrations would make last term's responses
/// unreadable, and no vocabulary improvement is worth that.
#[serde(rename = "learning_objectives")]
pub learning_targets: String,
/// Comma-joined topics.
pub topics: String,
/// Whether the item was bonus.
@@ -722,7 +727,7 @@ impl FlatResponse {
.map(|s| format!("{s:.1}"))
.unwrap_or_default(),
level: r.level.map(|l| l.code()).unwrap_or(0),
learning_objectives: r.learning_objectives.join(","),
learning_targets: r.learning_targets.join(","),
topics: r.topics.join(","),
bonus: r.bonus,
dropped: r.dropped,
@@ -782,7 +787,7 @@ impl FlatResponse {
score: self.score,
response_time_seconds: self.response_time_seconds.parse().ok(),
level: Level::from_code(self.level),
learning_objectives: split(&self.learning_objectives),
learning_targets: split(&self.learning_targets),
topics: split(&self.topics),
bonus: self.bonus,
dropped: self.dropped,
@@ -830,7 +835,7 @@ mod tests {
score: credit * 2.0,
response_time_seconds: None,
level: None,
learning_objectives: vec![],
learning_targets: vec![],
topics: vec![],
bonus: false,
dropped: false,
+2 -2
View File
@@ -560,7 +560,7 @@ mod tests {
score: 1.5,
response_time_seconds: None,
level: None,
learning_objectives: vec!["lo-a".into()],
learning_targets: vec!["lo-a".into()],
topics: vec![],
bonus: false,
dropped: false,
@@ -593,7 +593,7 @@ mod tests {
assert_eq!(back.rows.len(), 2);
assert_eq!(back.rows[0].item_ref.as_deref(), Some("bank::q-x-001"));
assert_eq!(back.rows[0].selected, vec!["C".to_string()]);
assert_eq!(back.rows[0].learning_objectives, vec!["lo-a".to_string()]);
assert_eq!(back.rows[0].learning_targets, vec!["lo-a".to_string()]);
let all = store.read_all().unwrap();
assert_eq!(all.rows.len(), 2);
+7 -5
View File
@@ -57,6 +57,8 @@ pub fn schema() -> Schema {
Field::new("score", DataType::Float64, false),
Field::new("response_time_seconds", DataType::Utf8, false),
Field::new("level", DataType::UInt32, false),
// The stored column name predates the objective/target rename and is left
// alone: an existing parquet file has to keep loading.
Field::new("learning_objectives", DataType::Utf8, false),
Field::new("topics", DataType::Utf8, false),
Field::new("bonus", DataType::Boolean, false),
@@ -120,7 +122,7 @@ fn to_batch(rows: &[FlatResponse]) -> Result<RecordBatch> {
f64c(|r| r.score),
s(|r| &r.response_time_seconds),
u32c(|r| r.level as u32),
s(|r| &r.learning_objectives),
s(|r| &r.learning_targets),
s(|r| &r.topics),
boolc(|r| r.bonus),
boolc(|r| r.dropped),
@@ -285,7 +287,7 @@ fn from_batch(batch: &RecordBatch, path: &Path) -> Result<Vec<FlatResponse>> {
let score = floats("score")?;
let response_time_seconds = strings("response_time_seconds")?;
let level = uints("level")?;
let learning_objectives = strings("learning_objectives")?;
let learning_targets = strings("learning_objectives")?;
let topics = strings("topics")?;
let bonus = bools("bonus")?;
let dropped = bools("dropped")?;
@@ -326,7 +328,7 @@ fn from_batch(batch: &RecordBatch, path: &Path) -> Result<Vec<FlatResponse>> {
score: score.value(i),
response_time_seconds: response_time_seconds.value(i).to_string(),
level: level.value(i) as u8,
learning_objectives: learning_objectives.value(i).to_string(),
learning_targets: learning_targets.value(i).to_string(),
topics: topics.value(i).to_string(),
bonus: bonus.value(i),
dropped: dropped.value(i),
@@ -372,7 +374,7 @@ mod tests {
score: 1.5,
response_time_seconds: "42.0".into(),
level: 3,
learning_objectives: "lo-a,lo-b".into(),
learning_targets: "lo-a,lo-b".into(),
topics: "kinetics".into(),
bonus: false,
dropped: false,
@@ -404,7 +406,7 @@ mod tests {
assert_eq!(back.len(), 2);
assert_eq!(back[0].student_key, "s1");
assert_eq!(back[1].item_number, 2);
assert_eq!(back[0].learning_objectives, "lo-a,lo-b");
assert_eq!(back[0].learning_targets, "lo-a,lo-b");
assert_eq!(back[0].credit, 1.0);
assert_eq!(back[0].level, 3);
assert!(!back[0].bonus);