Separate notes metadata and ignored columns

This commit is contained in:
Dandaedre 2026-11-03 16:53:24 +01:00
parent b7dcb576c0
commit 72c8d511d2
9 changed files with 400 additions and 95 deletions

View File

@ -53,6 +53,64 @@ fn err(code: &str, table: &Table, row: usize, col: usize, msg: impl Into<String>
fn placeholder(s: &str) -> bool {
matches!(s.trim(), "" | "-" | "—")
}
fn automatic_usage(header: &str) -> &'static str {
let normalized = normalize(header);
let words: Vec<_> = normalized
.split(|c: char| !c.is_alphanumeric())
.filter(|word| !word.is_empty())
.collect();
if words.iter().any(|word| {
matches!(
*word,
"note"
| "notes"
| "comment"
| "comments"
| "remark"
| "remarks"
| "remarque"
| "remarques"
| "instruction"
| "instructions"
| "consigne"
| "consignes"
| "observation"
| "observations"
)
}) {
"notes"
} else if words.iter().any(|word| {
matches!(
*word,
"video"
| "light"
| "lights"
| "lighting"
| "lumiere"
| "eclairage"
| "son"
| "sound"
| "audio"
| "sonorisation"
| "powerpoint"
| "ppt"
| "slide"
| "slides"
| "projection"
| "media"
| "camera"
| "cameras"
| "microphone"
| "microphones"
)
}) || normalized.contains("power point")
{
"metadata"
} else {
"ignore"
}
}
/// Only an isolated, full-width merged text band is automatically structural.
pub fn structural_row(table: &Table, row: usize, header: usize) -> bool {
let width = table.rows[header]
@ -210,11 +268,14 @@ fn infer_inner(
let mut column_usage = std::collections::BTreeMap::new();
for (letter, usage) in &profile.column_usage {
match column_index(letter).filter(|c| *c < width) {
Some(c) if ["metadata", "ignore"].contains(&usage.as_str()) && excluded.insert(c) => {
Some(c)
if ["notes", "metadata", "ignore"].contains(&usage.as_str())
&& excluded.insert(c) =>
{
column_usage.insert(column_name(c), usage.clone());
evidence.push(format!("Explicit {usage} column {}", column_name(c)));
}
_ => profile_errors.push(err("INVALID_COLUMN_USAGE", table, header, 0, format!("Invalid or duplicate column usage {letter}: {usage}; use an existing column with metadata or ignore"))),
_ => profile_errors.push(err("INVALID_COLUMN_USAGE", table, header, 0, format!("Invalid or duplicate column usage {letter}: {usage}; use an existing column with notes, metadata or ignore"))),
}
}
if !profile_errors.is_empty() {
@ -350,6 +411,28 @@ fn infer_inner(
));
}
}
for c in 0..width {
if !used.contains(&c) && !column_usage.contains_key(&column_name(c)) {
let usage = automatic_usage(&table.cell(header, c).text);
column_usage.insert(column_name(c), usage.into());
evidence.push(format!("Column {} defaults to {usage}", column_name(c)));
}
}
let column_labels = column_usage
.keys()
.map(|letter| {
let c = column_index(letter).expect("validated column");
let header_text = table.cell(header, c).text.trim().to_owned();
(
letter.clone(),
if header_text.is_empty() {
letter.clone()
} else {
header_text
},
)
})
.collect();
let start = selected["start"];
let end = selected.get("end").copied();
let dur = selected.get("duration").copied();
@ -478,5 +561,6 @@ fn infer_inner(
duration_unit: unit,
evidence: evidence.clone(),
column_usage,
column_labels,
})
}

View File

@ -4,6 +4,7 @@ use crate::{
};
use anyhow::{Result, bail, ensure};
use serde_json::{Value, json};
use std::collections::{BTreeMap, BTreeSet};
use std::{
io::Write,
path::Path,
@ -17,31 +18,80 @@ pub fn ontime(r: &Rundown) -> Result<Value> {
);
let mut entries = serde_json::Map::new();
let mut order = vec![];
let mut custom_fields = serde_json::Map::new();
let mut metadata_keys = BTreeMap::new();
let mut used_keys = BTreeSet::new();
for (column, usage) in &r.mapping.column_usage {
if usage != "metadata" {
continue;
}
let label = r
.mapping
.column_labels
.get(column)
.map(String::as_str)
.unwrap_or(column);
let base = crate::time::normalize(label)
.chars()
.map(|c| if c.is_ascii_alphanumeric() { c } else { '_' })
.collect::<String>()
.split('_')
.filter(|part| !part.is_empty())
.collect::<Vec<_>>()
.join("_");
let base = if base.is_empty() {
format!("column_{}", column.to_lowercase())
} else {
base
};
let mut key = base.clone();
if !used_keys.insert(key.clone()) {
key = format!("{base}_{}", column.to_lowercase());
used_keys.insert(key.clone());
}
custom_fields.insert(
key.clone(),
json!({"type":"text","colour":"#64748b","label":label}),
);
metadata_keys.insert(column.clone(), key);
}
for e in r.entries.iter().filter(|e| e.kind == "event") {
let mut note = e.decisions.join("\n");
let mut notes = vec![];
let mut custom: BTreeMap<String, Vec<String>> = BTreeMap::new();
for row in &e.source_rows {
for (col, cell) in &row.cells {
if !cell.text.is_empty()
&& r.mapping
.column_usage
.get(col)
.is_none_or(|usage| usage != "ignore")
{
note.push_str(&format!("\n{col}{}: {}", row.row, cell.text));
if cell.text.trim().is_empty() {
continue;
}
match r.mapping.column_usage.get(col).map(String::as_str) {
Some("notes") => notes.push(cell.text.clone()),
Some("metadata") => {
if let Some(key) = metadata_keys.get(col) {
custom
.entry(key.clone())
.or_default()
.push(cell.text.clone());
}
}
_ => {}
}
}
}
entries.insert(e.id.clone(),json!({"id":e.id,"type":"event","cue":e.source_rows[0].row.to_string(),"title":e.title,"note":note,
let custom: BTreeMap<_, _> = custom
.into_iter()
.map(|(key, values)| (key, values.join("\n")))
.collect();
entries.insert(e.id.clone(),json!({"id":e.id,"type":"event","cue":e.source_rows[0].row.to_string(),"title":e.title,"note":notes.join("\n"),
"timeStart":e.start_ms,"timeEnd":e.end_ms,"duration":e.duration_ms,"linkStart":false,
"timeStrategy":"lock-duration","timerType":"count-down","endAction":"none","skip":false,
"colour":"#5744b5","timeWarning":120000.min(e.duration_ms/5),"timeDanger":60000.min(e.duration_ms/10),
"countToEnd":false,"flag":false,"custom":{},"triggers":[]}));
"countToEnd":false,"flag":false,"custom":custom,"triggers":[]}));
order.push(e.id.clone());
}
Ok(
json!({"settings":{"version":"4.0.0"},"project":{"title":r.title,"description":"Imported schedule. Explicit starts and untimed gaps preserved; manual playback. Review inferred values before the show."},
"rundowns":{"default":{"id":"default","title":r.title,"entries":entries,"order":order,"flatOrder":order,"revision":0}},
"customFields":{},"urlPresets":[],"viewSettings":{},"automation":{"enabledAutomations":false,"enabledOscIn":false,"triggers":[],"automations":{}}}),
"customFields":custom_fields,"urlPresets":[],"viewSettings":{},"automation":{"enabledAutomations":false,"enabledOscIn":false,"triggers":[],"automations":{}}}),
)
}
/// Validate before publication, preserve existing output unless explicitly allowed.

View File

@ -417,7 +417,7 @@ impl App {
self.decisions_changed();
}
}
ui.label("Optional JSON profile: columns (start/end/duration/title), column_usage (metadata/ignore), duration_unit, row_kinds, titles, starts, ends, durations, untimed_as_notes, ignore_warnings. Column letters and source rows are shown in diagnostics.");
ui.label("Optional JSON profile: columns (start/end/duration/title), column_usage (notes/metadata/ignore), duration_unit, row_kinds, titles, starts, ends, durations, untimed_as_notes, ignore_warnings. Column letters and source rows are shown in diagnostics.");
if ui
.add(
egui::TextEdit::multiline(&mut self.profile)

View File

@ -1,5 +1,5 @@
use super::*;
use crate::model::Diagnostic;
use crate::model::{Diagnostic, Mapping};
use std::collections::BTreeSet;
#[derive(Default, PartialEq)]
@ -440,10 +440,31 @@ fn preview_rows(a: &Analysis, table: Option<&Table>) -> Vec<PreviewRow> {
rows
}
fn ignored_row(row: usize, table: Option<&Table>, profile: &Profile) -> bool {
fn ignored_row(
row: usize,
table: Option<&Table>,
profile: &Profile,
mapping: Option<&Mapping>,
) -> bool {
profile.row_kinds.get(&row).is_some_and(|k| k == "ignore")
|| table.is_some_and(|t| {
row > 0 && row <= t.rows.len() && !detect::has_content(t, row - 1, profile)
row > 0
&& row <= t.rows.len()
&& !t.rows[row - 1].iter().enumerate().any(|(column, cell)| {
let retained = mapping.is_none_or(|map| {
column == map.start
|| column == map.title
|| map.end == Some(column)
|| map.duration == Some(column)
|| map
.column_usage
.get(&column_name(column))
.is_some_and(|usage| matches!(usage.as_str(), "notes" | "metadata"))
});
retained
&& profile.usage(column) != Some("ignore")
&& !matches!(cell.text.trim(), "" | "-" | "—")
})
})
}
@ -462,10 +483,18 @@ fn modified_row(row: &PreviewRow, profile: &Profile) -> bool {
.is_some_and(|key| profile.gap_resolutions.contains_key(key))
}
fn show_row(row: &PreviewRow, filter: RowFilter, table: Option<&Table>, profile: &Profile) -> bool {
fn show_row(
row: &PreviewRow,
filter: RowFilter,
table: Option<&Table>,
profile: &Profile,
mapping: Option<&Mapping>,
) -> bool {
match filter {
RowFilter::All => true,
RowFilter::Included => !row.automatically_ignored && !ignored_row(row.row, table, profile),
RowFilter::Included => {
!row.automatically_ignored && !ignored_row(row.row, table, profile, mapping)
}
RowFilter::Attention => !row.gap && !row.issues.is_empty(),
RowFilter::Gaps => row.gap,
}
@ -484,7 +513,7 @@ fn ignorable_rows(a: &Analysis, table: Option<&Table>, profile: &Profile) -> Vec
&& r.issues
.iter()
.all(|i| needs_information(&a.diagnostics[*i]))
&& !ignored_row(r.row, table, profile)
&& !ignored_row(r.row, table, profile, a.mapping.as_ref())
&& !profile.row_kinds.contains_key(&r.row)
&& !profile.titles.contains_key(&r.row)
&& !profile.starts.contains_key(&r.row)
@ -563,7 +592,14 @@ impl App {
if let Some(row) = row {
let profile: Profile = serde_json::from_str(&self.profile).unwrap_or_default();
let table = self.tables.iter().find(|t| t.name == self.sheet);
if self.row_filter == RowFilter::Included && ignored_row(row, table, &profile) {
if self.row_filter == RowFilter::Included
&& ignored_row(
row,
table,
&profile,
self.analysis.as_ref().and_then(|a| a.mapping.as_ref()),
)
{
self.row_filter = RowFilter::All;
}
}
@ -605,7 +641,7 @@ impl App {
self.review_view = ReviewView::Rows;
}
if navigation_tab(ui, "Columns", self.review_view == ReviewView::Columns)
.on_hover_text("Auto keeps inference enabled. Metadata adds the column to Ontime notes. Ignore excludes it from inference and Ontime output. Every timing cell is validated.")
.on_hover_text("Auto infers timing and titles, sends recognised production columns to Ontime custom fields, sends note-like columns to Notes, and ignores other columns. Manual choices override this. Every timing cell is validated.")
.clicked()
{
self.review_view = ReviewView::Columns;
@ -1273,16 +1309,57 @@ impl App {
.or_else(|| profile.usage(c).map(str::to_string))
.unwrap_or_default();
let old = chosen.clone();
let detected_role = mapping.as_ref().ok().map(|m| {
if m.start == c {
"Start"
} else if m.title == c {
"Title"
} else if m.end == Some(c) {
"End"
} else if m.duration == Some(c) {
"Duration"
} else {
match m.column_usage.get(&col).map(String::as_str) {
Some("notes") => "Notes",
Some("metadata") => "Metadata",
_ => "Ignore",
}
}
});
let selected = if chosen.is_empty() {
detected_role
.map_or_else(|| "Auto".into(), |role| format!("Auto ({role})"))
} else {
match chosen.as_str() {
"start" => "Start",
"end" => "End",
"duration" => "Duration",
"title" => "Title",
"notes" => "Notes",
"metadata" => "Metadata",
"ignore" => "Ignore",
_ => &chosen,
}
.into()
};
egui::ComboBox::from_id_salt(("column", c))
.selected_text(if chosen.is_empty() { "Auto" } else { &chosen })
.selected_text(selected)
.show_ui(ui, |ui| {
ui.selectable_value(&mut chosen, String::new(), "Auto");
for role in
["start", "end", "duration", "title", "metadata", "ignore"]
{
ui.selectable_value(&mut chosen, role.into(), role);
for (role, label) in [
("ignore", "Ignore"),
("notes", "Notes"),
("metadata", "Metadata"),
("start", "Start"),
("end", "End"),
("duration", "Duration"),
("title", "Title"),
] {
ui.selectable_value(&mut chosen, role.into(), label);
}
});
})
.response
.on_hover_text("Ignore excludes this column. Notes appends its values to Ontime notes. Metadata creates an Ontime custom field.");
if chosen != old {
profile
.columns
@ -1290,26 +1367,14 @@ impl App {
profile
.column_usage
.retain(|letter, _| crate::model::column_index(letter) != Some(c));
if matches!(chosen.as_str(), "metadata" | "ignore") {
if matches!(chosen.as_str(), "notes" | "metadata" | "ignore") {
profile.column_usage.insert(col, chosen);
} else if !chosen.is_empty() {
profile.columns.insert(chosen, col);
}
}
if let Ok(m) = &mapping {
let role = if profile.usage(c) == Some("ignore") {
"ignore"
} else if m.start == c {
"start"
} else if m.title == c {
"title"
} else if m.end == Some(c) {
"end"
} else if m.duration == Some(c) {
"duration"
} else {
"metadata"
};
if mapping.is_ok() {
let role = detected_role.unwrap_or("Ignore");
ui.colored_label(PREVIEW_SUCCESS, format!("OK: {role}"));
}
});
@ -1412,7 +1477,7 @@ impl App {
let all_rows = preview_rows(a, table);
let rows: Vec<_> = all_rows
.iter()
.filter(|r| show_row(r, self.row_filter, table, &profile))
.filter(|r| show_row(r, self.row_filter, table, &profile, a.mapping.as_ref()))
.collect();
if rows.is_empty() {
ui.label(match self.row_filter {
@ -1446,7 +1511,9 @@ impl App {
.collect();
let backgrounds: Vec<_> = std::iter::once(None)
.chain(rows.iter().map(|row| {
if row.automatically_ignored || ignored_row(row.row, table, &profile) {
if row.automatically_ignored
|| ignored_row(row.row, table, &profile, a.mapping.as_ref())
{
Some(Color32::from_rgb(34, 35, 39))
} else if row
.issues
@ -1496,7 +1563,8 @@ impl App {
ui.end_row();
for row in &rows {
let row_top = ui.cursor().min;
let ignored = row.automatically_ignored || ignored_row(row.row, table, &profile);
let ignored = row.automatically_ignored
|| ignored_row(row.row, table, &profile, a.mapping.as_ref());
let error = row
.issues
.iter()
@ -1860,13 +1928,15 @@ mod tests {
&rows[gap],
RowFilter::Attention,
Some(&app.tables[0]),
&Profile::default()
&Profile::default(),
analysis.mapping.as_ref(),
));
assert!(show_row(
&rows[gap],
RowFilter::Gaps,
Some(&app.tables[0]),
&Profile::default()
&Profile::default(),
analysis.mapping.as_ref(),
));
assert_eq!(analysis.rundown.as_ref().unwrap().entries.len(), 2);
let profile = Profile {
@ -2155,13 +2225,15 @@ mod tests {
row,
RowFilter::All,
Some(&app.tables[0]),
&profile
&profile,
a.mapping.as_ref(),
));
assert!(!show_row(
row,
RowFilter::Included,
Some(&app.tables[0]),
&profile
&profile,
a.mapping.as_ref(),
));
let labels = render(&mut app, &ctx, size, vec![]);
let notes = labels
@ -2422,13 +2494,15 @@ mod tests {
ignored,
RowFilter::All,
Some(&app.tables[0]),
&profile
&profile,
a.mapping.as_ref(),
));
assert!(!show_row(
ignored,
RowFilter::Included,
Some(&app.tables[0]),
&profile
&profile,
a.mapping.as_ref(),
));
assert_eq!(app.tables[0].rows[2][2].text, "Stage direction 0");
}
@ -2701,17 +2775,18 @@ mod tests {
assert!(labels.iter().any(|(s, _)| s == "Review columns"));
}
#[test]
fn column_menu_selects_metadata_ignore_and_restores_auto() {
fn column_menu_selects_notes_metadata_ignore_and_restores_auto() {
let mut app = sample();
app.review_view = ReviewView::Columns;
app.profile = r#"{"columns":{"start":"A"}}"#.into();
let ctx = egui::Context::default();
configure_style(&ctx);
let size = [860.0, 900.0];
for (current, choice) in [
("start", "metadata"),
("metadata", "ignore"),
("ignore", "Auto"),
for (current, choice, expected) in [
("Start", "Notes", Some("notes")),
("Notes", "Metadata", Some("metadata")),
("Metadata", "Ignore", Some("ignore")),
("Ignore", "Auto", None),
] {
render(&mut app, &ctx, size, vec![]);
let labels = render(&mut app, &ctx, size, vec![]);
@ -2727,7 +2802,7 @@ mod tests {
.iter()
.rev()
.find(|(s, _)| s == choice)
.unwrap()
.unwrap_or_else(|| panic!("{current} -> {choice}: {menu:?}"))
.1
.center();
click_size(&mut app, &ctx, option, size);
@ -2737,10 +2812,7 @@ mod tests {
"{current} -> {choice}: {}",
app.profile
);
assert_eq!(
profile.usage(0),
if choice == "Auto" { None } else { Some(choice) }
);
assert_eq!(profile.usage(0), expected);
assert!(app.dirty);
}
}
@ -2767,7 +2839,7 @@ mod tests {
assert!(
!labels
.iter()
.any(|(text, _)| text.contains("Metadata adds the column"))
.any(|(text, _)| text.contains("recognised production columns"))
);
let columns = labels
.iter()
@ -2785,7 +2857,7 @@ mod tests {
assert!(
labels
.iter()
.any(|(text, _)| text.contains("Metadata adds the column"))
.any(|(text, _)| text.contains("recognised production columns"))
);
}
@ -2946,7 +3018,15 @@ mod tests {
let rows = preview_rows(&a, Some(&app.tables[0]));
let numbers = |filter| {
rows.iter()
.filter(|r| show_row(r, filter, Some(&app.tables[0]), &profile))
.filter(|r| {
show_row(
r,
filter,
Some(&app.tables[0]),
&profile,
a.mapping.as_ref(),
)
})
.map(|r| r.row)
.collect::<Vec<_>>()
};
@ -2986,13 +3066,18 @@ mod tests {
click_size(&mut app, &ctx, auto, [860.0, 900.0]);
let restored: Profile = serde_json::from_str(&app.profile).unwrap();
assert!(!restored.row_kinds.contains_key(&3));
assert!(!ignored_row(3, Some(&app.tables[0]), &restored));
assert!(!ignored_row(3, Some(&app.tables[0]), &restored, None));
assert!(app.dirty);
let mut columns_ignored = Profile::default();
columns_ignored
.column_usage
.insert("C".into(), "ignore".into());
assert!(ignored_row(3, Some(&app.tables[0]), &columns_ignored));
assert!(!ignored_row(2, Some(&app.tables[0]), &columns_ignored));
assert!(ignored_row(3, Some(&app.tables[0]), &columns_ignored, None));
assert!(!ignored_row(
2,
Some(&app.tables[0]),
&columns_ignored,
None
));
}
}

View File

@ -64,7 +64,7 @@ pub struct Profile {
/// One-based header row. Column letters are Excel-style, e.g. A or AB.
pub header_row: Option<usize>,
pub columns: BTreeMap<String, String>,
/// Column letter -> metadata (notes only) or ignore (excluded from export).
/// Column letter -> notes, metadata (Ontime custom field), or ignore.
pub column_usage: BTreeMap<String, String>,
pub expected_headers: BTreeMap<String, String>,
/// minutes, seconds, hh:mm, mm:ss, or excel.
@ -105,6 +105,9 @@ pub struct Mapping {
pub evidence: Vec<String>,
#[serde(default)]
pub column_usage: BTreeMap<String, String>,
/// Source header labels for notes and metadata columns.
#[serde(default)]
pub column_labels: BTreeMap<String, String>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SourceRow {

View File

@ -65,6 +65,19 @@ fn override_clock(values: &std::collections::BTreeMap<usize, String>, row: usize
})
})
}
fn mapped_has_content(table: &Table, row: usize, map: &Mapping) -> bool {
table.rows[row].iter().enumerate().any(|(col, cell)| {
let role = col == map.start
|| col == map.title
|| map.end == Some(col)
|| map.duration == Some(col);
let retained = map
.column_usage
.get(&column_name(col))
.is_some_and(|usage| matches!(usage.as_str(), "notes" | "metadata"));
(role || retained) && !matches!(cell.text.trim(), "" | "-" | "—")
})
}
fn times(
table: &Table,
row: usize,
@ -84,7 +97,7 @@ fn times(
pub fn identify_gaps(table: &Table, map: &Mapping, profile: &Profile) -> Vec<Gap> {
let mut rows = detect::active_rows(table, map.header_row - 1, profile);
for r in map.header_row..table.rows.len() {
if detect::has_content(table, r, profile)
if mapped_has_content(table, r, map)
&& detect::structural_row(table, r, map.header_row - 1)
&& table.rows[r].iter().any(|c| is_gap(&c.text))
&& !profile
@ -220,7 +233,7 @@ pub fn construct(
while row < table.rows.len() {
let r = row;
row += 1;
if !detect::has_content(table, r, profile) {
if !mapped_has_content(table, r, &map) {
continue;
}
if detect::structural_row(table, r, map.header_row - 1)

View File

@ -687,7 +687,7 @@ fn explicit_duration_can_replace_a_missing_formula_result() {
}
#[test]
fn metadata_and_ignored_columns_control_inference_and_ontime_notes() {
fn notes_metadata_and_ignored_columns_have_distinct_ontime_destinations() {
let t = table(&[
&[
"Start", "Timer", "Timer", "Title", "Speaker", "Private", "Notes",
@ -726,7 +726,7 @@ fn metadata_and_ignored_columns_control_inference_and_ontime_notes() {
("C".into(), "metadata".into()),
("E".into(), "metadata".into()),
("f".into(), "ignore".into()),
("G".into(), "metadata".into()),
("G".into(), "notes".into()),
]),
row_kinds: BTreeMap::from([(3, "note".into())]),
..Profile::default()
@ -743,15 +743,18 @@ fn metadata_and_ignored_columns_control_inference_and_ontime_notes() {
let note = json["rundowns"]["default"]["entries"][&r.entries[0].id]["note"]
.as_str()
.unwrap();
for text in [
"Operator reference",
"Alice",
"Bob",
"Microphone 1",
"Move lectern",
] {
assert!(note.contains(text), "Missing metadata {text}");
for text in ["Microphone 1", "Move lectern"] {
assert!(note.contains(text), "Missing note {text}");
}
for text in ["Operator reference", "Alice", "Bob"] {
assert!(!note.contains(text), "Metadata leaked into notes: {text}");
}
assert!(!note.contains("derived from"));
let custom = &json["rundowns"]["default"]["entries"][&r.entries[0].id]["custom"];
assert_eq!(custom["timer"], "Operator reference");
assert_eq!(custom["speaker"], "Alice\nBob");
assert_eq!(json["customFields"]["timer"]["label"], "Timer");
assert_eq!(json["customFields"]["speaker"]["type"], "text");
assert!(!json.to_string().contains("SECRET"));
let restored: Rundown = serde_json::from_str(&serde_json::to_string(&r).unwrap()).unwrap();
assert!(
@ -765,6 +768,63 @@ fn metadata_and_ignored_columns_control_inference_and_ontime_notes() {
assert_eq!(restored_profile.usage(5), Some("ignore"));
}
#[test]
fn unknown_columns_default_to_ignore_and_production_headers_become_custom_fields() {
let t = table(&[
&[
"Start",
"Duration",
"Title",
"Vidéo",
"Light",
"Lumière",
"Lumiere",
"Son",
"Sound",
"PowerPoint",
"Slides",
"Notes",
"Speaker",
],
&[
"09:00", "5 min", "Opening", "Roll VT", "Preset A", "Blue", "Wash", "Mic 1", "Walk-in",
"Deck A", "1–3", "Stand by", "Alice",
],
&["", "", "", "", "", "", "", "", "", "", "", "", "Ghost"],
&[
"09:05",
"5 min",
"Closing",
"Logo",
"Preset B",
"Blackout",
"Spot",
"Mic 2",
"Sting",
"Deck B",
"4–6",
"Clear stage",
"Bob",
],
]);
let a = analyze(&t, &Profile::default());
assert!(a.diagnostics.is_empty(), "{:?}", a.diagnostics);
let r = a.rundown.unwrap();
for column in ["D", "E", "F", "G", "H", "I", "J", "K"] {
assert_eq!(r.mapping.column_usage[column], "metadata", "{column}");
}
assert_eq!(r.mapping.column_usage["L"], "notes");
assert_eq!(r.mapping.column_usage["M"], "ignore");
let json = export::ontime(&r).unwrap();
let event = &json["rundowns"]["default"]["entries"][&r.entries[0].id];
assert_eq!(event["note"], "Stand by");
assert_eq!(event["custom"]["video"], "Roll VT");
assert_eq!(json["customFields"]["video"]["label"], "Vidéo");
assert!(!json.to_string().contains("Alice"));
assert!(!json.to_string().contains("Ghost"));
assert!(!event["note"].as_str().unwrap().contains("derived from"));
}
#[test]
fn column_usage_excludes_data_candidates_and_rejects_conflicting_profiles() {
let t = table(&[
@ -772,7 +832,7 @@ fn column_usage_excludes_data_candidates_and_rejects_conflicting_profiles() {
&["09:00", "09:05", "1 min", "Opening"],
&["09:05", "09:10", "2 min", "Closing"],
]);
for usage in ["metadata", "ignore"] {
for usage in ["notes", "metadata", "ignore"] {
let p = Profile {
column_usage: BTreeMap::from([("C".into(), usage.into())]),
..Default::default()

View File

@ -57,7 +57,7 @@ only when required decisions are resolved.
| Document | Source identity, reader, sheet/table choices, model version, interpretation settings |
| Source reference | File, sheet/page, row/cell or bounding region, original text |
| Rundown/session | Ordered entries, label, date/day context, stage/track where established |
| Entry | Stable identity, cue, title, speaker, notes, additional original columns, event/break/marker kind |
| Entry | Stable identity, cue, title, notes, custom-field metadata, additional original columns, event/break/marker kind |
| Timing | Optional explicit start/end, duration, day offset, fixed/relative intent, inferred/resolved values |
| Gap | Untimed break, boundary references/constraints, resolved interval when known, provenance, no timer display |
| Decision | Selected mapping/rule, evidence, alternatives, user overrides |

View File

@ -116,10 +116,13 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
per-column role dropdowns, and sample values. Expand **Detection evidence** for
full inference and validation details; hover the **Columns** tab for a compact
explanation of the role choices. Selecting one duration column explicitly resolves duplicate TIMER
headers. **Metadata** keeps a column as Ontime notes without treating its values
as timing or titles; **Ignore** excludes it from inference and Ontime output.
Several columns can be metadata or ignored. **Auto** restores inference; other
columns remain included as metadata by default. **Manual header mapping** remains
headers. **Notes** appends a column's values to Ontime event notes. **Metadata**
creates an Ontime custom field named from the source header. **Ignore** excludes
the column from inference and Ontime output. Several columns can use any of these
destinations. **Auto** restores inference: production headers such as video,
light/lumière, sound/son, PowerPoint and slides become metadata; note, comment,
remark and instruction headers become notes; other unused columns are ignored.
**Manual header mapping** remains
available in Setup for the header row and column choices. The separate
**Advanced settings** section contains duration units and profile JSON.
@ -242,7 +245,7 @@ Pass `--profile mapping.json`, or load/edit the same JSON in the desktop app:
{
"header_row": 1,
"columns": {"start": "A", "duration": "B", "title": "G"},
"column_usage": {"C": "metadata", "F": "ignore"},
"column_usage": {"C": "notes", "D": "metadata", "F": "ignore"},
"expected_headers": {"A": "Heure", "B": "Durée"},
"untimed_as_notes": true,
"row_kinds": {"20": "marker"},
@ -263,15 +266,22 @@ are errors. `titles`, `starts`, `ends` and `durations` are keyed by one-based so
corrected cells are excluded from whole-column validation while all remaining
explicit mappings still undergo it.
`column_usage` maps column letters to `metadata` or `ignore`. Both choices prevent
that column from being inferred as a start, end, duration or title, even when its
header suggests one of those roles. A column cannot also have an explicit timing
or title mapping. Metadata appears in Ontime event notes, including metadata from
rows attached as notes or merged continuations. Ignore removes those cell values
from Ontime notes; rows containing only ignored values need no clarification.
`column_usage` maps column letters to `notes`, `metadata` or `ignore`. Every choice
prevents that column from being inferred as a start, end, duration or title, and a
column cannot also have an explicit timing or title mapping. Notes values are joined
into the Ontime event note, including values from attached note rows and merged
continuations. Metadata creates a project-level Ontime text custom field and stores
each event's value in its `custom` object. Ignore removes the values from Ontime;
rows containing only ignored values need no clarification. Inferred timing and
correction provenance remain visible in the neutral IR and review UI but are not
added to Ontime notes.
With no manual choice, timing and title inference runs first. Remaining columns use
conservative header rules: recognised production departments and media become
metadata, recognised note-like headers become notes, and everything else is ignored.
Original cells remain available in the review and neutral IR for retained rows.
These choices are saved in profiles and remembered resolutions; use **Apply &
recheck** before export. The default inclusion of other source columns is unchanged.
recheck** before export.
`row_kinds` accepts `event`, `gap`, `marker`, `note` and `ignore`. Notes attach to
the preceding event. Untimed markers remain in the IR but are not exported as