Skip to main content

find_data_source

Function find_data_source 

Source
fn find_data_source(value: &Value) -> Option<&'static str>
Expand description

Names the first data source anywhere in the spec, or None when it carries none.

The model is not allowed to supply data at all – attach_data_file adds the teacher’s file afterwards – so any data source here is one the model produced. Enforced in code rather than left to the prompt, because a chart is read as fact in course material and numbers invented to satisfy the request would be misinformation. Recursive because Vega-Lite allows data on any view and inside transforms, so a layered or concatenated chart can carry it far from the top level.