infer_column_role
infer_column_role(col_name, series)Infer column_role from a column’s name and contents.
A node-for-node port of metasalmon’s infer_column_role(), including 0.1.7’s terminal-ID-qualifier fix: a name whose last ID/key token is followed by a qualifier token (quality, confidence, accuracy, grade, score) describes the quality of an identification, not an identifier, so id_quality is a qualifier rather than a key.
An enumerable string column is categorical, not attribute (metasalmon backlog #95, ruled Q29 on 2026-09-05; hub queue B-125). Three branches answered attribute for a column the code-row seeder would then write a codes.csv row for – the identifier-qualifier branch, the method-token branch and the final default – and the specification’s codes_required_for_categorical_columns rule rejects a code row whose column is anything else. All three now read :func:~metasalmonpy.metadata.values_form_code_list, which is the seeder’s own criterion, so the dictionary row and the code rows cannot disagree.
Year-shaped values do not outrank a measurement name (metasalmon backlog #53; hub queue B-240, the port of B-53). A column whose every value is a four-digit number from 1800 to 2500 is temporal unless its name’s words, split at punctuation as well as whitespace, include a measurement word or a sample or partition size and no date or time word. Such a column is then typed exactly as it would be with values off the year range, so a spawner_count of 1850, 2003 and 1999 is a measurement, while BY, count_year and Escapement (yr) stay temporal.