Preserve engine type profile cohorts

This commit is contained in:
Jan Petykiewicz 2026-04-21 23:24:49 -07:00
commit f67629069c
3 changed files with 71 additions and 1 deletions

View file

@ -170,10 +170,15 @@ pub struct EngineTypesInspectionReport {
pub car_side_view_resource_pk4_missing_counts: BTreeMap<String, usize>,
pub car_auxiliary_stem_counts: BTreeMap<String, usize>,
pub car_auxiliary_stem_relation_counts: BTreeMap<String, usize>,
pub car_auxiliary_stem_distinct_pair_counts: BTreeMap<String, usize>,
pub internal_ne_profile_pk4_match_count: usize,
pub internal_ne_profile_pk4_missing_count: usize,
pub locomotive_pair_internal_ne_profile_pk4_match_count: usize,
pub locomotive_pair_internal_ne_profile_pk4_missing_count: usize,
pub matched_prefix_internal_ne_profile_pk4_match_count: usize,
pub matched_prefix_internal_ne_profile_pk4_missing_count: usize,
pub unmatched_display_internal_ne_profile_pk4_match_count: usize,
pub unmatched_display_internal_ne_profile_pk4_missing_count: usize,
pub internal_ne_profile_texture_size_counts: BTreeMap<String, usize>,
pub internal_ne_profile_horizontal_scale_modifier_counts: BTreeMap<String, usize>,
pub internal_ne_profile_max_percent_of_interface_vram_counts: BTreeMap<String, usize>,
@ -423,6 +428,11 @@ pub fn inspect_engine_types_dir(
.iter()
.filter_map(classify_car_auxiliary_stem_relation),
);
let car_auxiliary_stem_distinct_pair_counts = count_owned_values(
family_entries
.iter()
.filter_map(distinct_car_auxiliary_stem_pair_label),
);
let lco_companion_stem_counts = count_named_values(
family_entries
.iter()
@ -450,6 +460,42 @@ pub fn inspect_engine_types_dir(
&& family.internal_ne_profile_found_in_pk4 == Some(false)
})
.count();
let matched_prefix_internal_ne_profile_pk4_match_count = family_entries
.iter()
.filter(|family| {
family.has_matched_locomotive_pair
&& family.internal_ne_profile_found_in_pk4 == Some(true)
&& !UNMATCHED_LOCOMOTIVE_DISPLAY_NAMES
.contains(&family.primary_display_name.as_deref().unwrap_or(""))
})
.count();
let matched_prefix_internal_ne_profile_pk4_missing_count = family_entries
.iter()
.filter(|family| {
family.has_matched_locomotive_pair
&& family.internal_ne_profile_found_in_pk4 == Some(false)
&& !UNMATCHED_LOCOMOTIVE_DISPLAY_NAMES
.contains(&family.primary_display_name.as_deref().unwrap_or(""))
})
.count();
let unmatched_display_internal_ne_profile_pk4_match_count = family_entries
.iter()
.filter(|family| {
family.has_matched_locomotive_pair
&& family.internal_ne_profile_found_in_pk4 == Some(true)
&& UNMATCHED_LOCOMOTIVE_DISPLAY_NAMES
.contains(&family.primary_display_name.as_deref().unwrap_or(""))
})
.count();
let unmatched_display_internal_ne_profile_pk4_missing_count = family_entries
.iter()
.filter(|family| {
family.has_matched_locomotive_pair
&& family.internal_ne_profile_found_in_pk4 == Some(false)
&& UNMATCHED_LOCOMOTIVE_DISPLAY_NAMES
.contains(&family.primary_display_name.as_deref().unwrap_or(""))
})
.count();
let internal_ne_profile_texture_size_counts = side_view_imb_pk4_lookup
.as_ref()
.map(|lookup| lookup.internal_ne_profile_texture_size_counts.clone())
@ -549,10 +595,15 @@ pub fn inspect_engine_types_dir(
car_side_view_resource_pk4_missing_counts,
car_auxiliary_stem_counts,
car_auxiliary_stem_relation_counts,
car_auxiliary_stem_distinct_pair_counts,
internal_ne_profile_pk4_match_count,
internal_ne_profile_pk4_missing_count,
locomotive_pair_internal_ne_profile_pk4_match_count,
locomotive_pair_internal_ne_profile_pk4_missing_count,
matched_prefix_internal_ne_profile_pk4_match_count,
matched_prefix_internal_ne_profile_pk4_missing_count,
unmatched_display_internal_ne_profile_pk4_match_count,
unmatched_display_internal_ne_profile_pk4_missing_count,
internal_ne_profile_texture_size_counts,
internal_ne_profile_horizontal_scale_modifier_counts,
internal_ne_profile_max_percent_of_interface_vram_counts,
@ -933,6 +984,16 @@ fn classify_car_auxiliary_stem_relation(family: &EngineTypeFamilyEntry) -> Optio
Some("distinct_auxiliary_stem".to_string())
}
fn distinct_car_auxiliary_stem_pair_label(family: &EngineTypeFamilyEntry) -> Option<String> {
(classify_car_auxiliary_stem_relation(family)?.as_str() == "distinct_auxiliary_stem")
.then_some(())?;
Some(format!(
"{} -> {}",
family.internal_stem.as_deref()?,
family.auxiliary_stem.as_deref()?
))
}
fn strip_terminal_role_letter(value: &str) -> Option<&str> {
let last = value.chars().last()?;
matches!(last, 'L' | 'T' | 'l' | 't').then(|| {