Repository navigation
feat(engine): search areas, geocoding, profiles, routes, services, rasters, constructions and label conversion give loss codes (#2371) #3021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b67203d
8c7adbc
11caee4
bd4c26f
e59daf7
d61951d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5210,6 +5210,16 @@ pub enum Assumed { | |
| } | ||
|
|
||
| impl Assumed { | ||
| /// Its loss code: `assumed.crs` when the answer is read in a system it didn't name or named | ||
| /// otherwise. An answer that named none, read in the one asked for, and one read as it named, | ||
| /// assume nothing past the request. | ||
| pub fn loss(self) -> Option<crate::loss::LossCode> { | ||
| match self { | ||
| Assumed::Unnamed | Assumed::NotDegrees => None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Category: quality
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left for the release quality pass: the reading is as the doc comment gives it. A request's own system is what the answer is read in, and nothing past it is assumed, as the feature-service reader reads a page. |
||
| Assumed::Unread | Assumed::InDegrees | Assumed::InAsked | Assumed::DegreesUnnamed => Some(crate::loss::LossCode::AssumedCrs), | ||
| } | ||
| } | ||
|
|
||
| /// Its notice, `{n}` the number of answers. | ||
| pub fn template(self) -> &'static str { | ||
| match self { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1508,7 +1508,7 @@ fn inputs_of<'a>( | |||||
| } | ||||||
| } | ||||||
| let mut left_out_whole = std::collections::HashSet::new(); | ||||||
| let work = work_inputs(&snap.map, &snap.tables, spec, params, &mut full, &mut messages, &mut left_out_whole)?; | ||||||
| let work = work_inputs(&snap.map, &snap.tables, spec, params, &mut full, &mut messages, &mut losses, &mut left_out_whole)?; | ||||||
| let mut rows = env_inputs(&snap.map, &full, &snap.env, params)?; | ||||||
| narrow_to_queries(&snap.map, spec, params, &full, &mut rows, &mut messages)?; | ||||||
| let unread = if work == Crs::LonLat { std::collections::HashSet::new() } else { attributes_only(spec, params) }; | ||||||
|
|
@@ -2056,27 +2056,37 @@ fn work_inputs( | |||||
| params: &Value, | ||||||
| full: &mut std::collections::HashMap<String, Dataset>, | ||||||
| messages: &mut Vec<String>, | ||||||
| losses: &mut Vec<LossMessage>, | ||||||
| left_out_whole: &mut std::collections::HashSet<String>, | ||||||
| ) -> Result<Crs, String> { | ||||||
| // A loss with its code; the rest as messages. | ||||||
| let mut say = |said: Vec<rustgis_data::loss::Note>| { | ||||||
| for note in said { | ||||||
| match note.loss { | ||||||
| Some(code) => losses.push(LossMessage { code, text: note.text }), | ||||||
| None => messages.push(note.text), | ||||||
| } | ||||||
| } | ||||||
| }; | ||||||
| let work = work_system(map, spec, params, full); | ||||||
| if work != Crs::LonLat { | ||||||
| match inputs_in(map, tables, spec, params, full, work, left_out_whole) { | ||||||
| Ok((converted, said)) => { | ||||||
| full.extend(converted); | ||||||
| messages.extend(said); | ||||||
| say(said); | ||||||
| return Ok(work); | ||||||
| } | ||||||
| Err(e) => { | ||||||
| // A Cancel isn't a place that can't be held. | ||||||
| rustgis_data::progress::check().map_err(|e| e.to_string())?; | ||||||
| let name = spec.map_or("The tool", |t| t.name); | ||||||
| messages.push(format!("{name} worked in longitude/latitude, not {}: {e}", work.label())); | ||||||
| say(vec![rustgis_data::loss::Note::plain(format!("{name} worked in longitude/latitude, not {}: {e}", work.label()))]); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| let (converted, said) = inputs_in(map, tables, spec, params, full, Crs::LonLat, left_out_whole)?; | ||||||
| full.extend(converted); | ||||||
| messages.extend(said); | ||||||
| say(said); | ||||||
| Ok(Crs::LonLat) | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -2093,7 +2103,7 @@ fn inputs_in( | |||||
| full: &std::collections::HashMap<String, Dataset>, | ||||||
| work: Crs, | ||||||
| left_out_whole: &mut std::collections::HashSet<String>, | ||||||
| ) -> Result<(std::collections::HashMap<String, Dataset>, Vec<String>), String> { | ||||||
| ) -> Result<(std::collections::HashMap<String, Dataset>, Vec<rustgis_data::loss::Note>), String> { | ||||||
| let mut converted = std::collections::HashMap::new(); | ||||||
| // The converted inputs with edges that bend ([`bent_edges`]): name, how many, how far. | ||||||
| let mut bent: Vec<(String, usize, f64)> = Vec::new(); | ||||||
|
|
@@ -2212,19 +2222,21 @@ fn inputs_in( | |||||
| let name = spec.map_or("The tool", |t| t.name); | ||||||
| let n: usize = unplaced.iter().map(|(_, n)| n).sum(); | ||||||
| let layers = unplaced.iter().map(|(layer, n)| format!("'{layer}' ({n})")).collect::<Vec<_>>().join(", "); | ||||||
| said.push(format!( | ||||||
| // Counted over each whole layer, before the run's rows are narrowed to a selection: some may | ||||||
| // be rows the tool doesn't read, so it isn't a coded loss. | ||||||
| said.push(rustgis_data::loss::Note::plain(format!( | ||||||
| "{name}: {n} feature(s) of {layers} have a place that can't be given in longitude/latitude, so the tool reads them without their geometry" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-raising the wording point from the earlier thread, since the code it points at has changed and the problem remains. The notice is now plain, but its text still says the tool reads every counted feature. The count is of each whole layer, and the comment above says some of those rows aren't read. A plain notice that misstates what the run did is still a wrong notice. Suggested wording:
Suggested change
Category: quality
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left for the release quality pass: the wording, now on a plain notice. |
||||||
| )); | ||||||
| ))); | ||||||
| } | ||||||
| if !bent.is_empty() { | ||||||
| let name = spec.map_or("The tool", |t| t.name); | ||||||
| let n: usize = bent.iter().map(|(_, n, _)| n).sum(); | ||||||
| let far = bent.iter().map(|(.., far)| *far).fold(0.0, f64::max); | ||||||
| let layers = bent.iter().map(|(layer, n, _)| format!("'{layer}' ({n})")).collect::<Vec<_>>().join(", "); | ||||||
| said.push(format!( | ||||||
| said.push(rustgis_data::loss::Note::plain(format!( | ||||||
| "{name}: {n} edge(s) of {layers}, converted into {}, are taken straight there, up to {far:.0} m from where a run in longitude/latitude takes them (straight on a Web Mercator map); their vertices are where they were", | ||||||
| work.label() | ||||||
| )); | ||||||
| ))); | ||||||
| } | ||||||
| Ok((converted, said)) | ||||||
| } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The segments are now coded
dropped.geometry, and that's right. But the same tool's input notes further down (lines 166-175: no usable point, several points, too far from the network) also leave features out of the run, and they stay plain. The geocoder's "no usable position" in this PR is codeddropped.feature, and the PR body's "Kept plain on purpose" list doesn't name these three. Either code themDroppedFeaturethe way the geocoder does, or add them to the kept-plain list with the reason.Confidence: medium. Read from the PR body and the surrounding code; not run.
Category: quality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left for the release quality pass. A point with no usable point had none to lose, and one too far from the network is the snap distance asked for. Both are listed under Kept plain. A multipoint left out could be coded with it.