MUSA Graderv0.1.0

API reference · grader/inspection.py · 176 lines

grader.inspection

Host-side reasoning over the probe payload.

Students do not use the solution's variable names, so grading works by finding objects that look like the expected result and reporting how sure we are (design.md §21 and §25).

Summary

NameKindDescription
confidence_for_candidates()function
dataframes()function
scalars()function
collections()function
hidden_test()function
match_column()functionBest column in profile matching any of hints (substring, case-insensitive).
has_datelike_column()functionA date role can be satisfied by a column name hint or a datetime dtype.
numeric_columns()function
zips_in_profile()functionAll ZIP-looking values visible in a dataframe profile.
zips_in_collection()function
find_dataframe_candidates()functionReturn profiles satisfying predicate, best first.
find_scalar_close_to()functionScalars in the namespace within tolerance of the expected answer.
describe_dataframe()functionCompact, TA-readable description used as rubric evidence (design.md §12).

Constants

NameValueNotes
CONFIDENCE_UNIQUE0.98Confidence ladder from design.md §25.
CONFIDENCE_TWO0.75
CONFIDENCE_MANY0.4
CONFIDENCE_NONE0.0

Functions

confidence_for_candidates(count: int) -> float #[source]

No description.

dataframes(probe: dict[str, Any] | None) -> list[dict[str, Any]] #[source]

No description.

scalars(probe: dict[str, Any] | None) -> list[dict[str, Any]] #[source]

No description.

collections(probe: dict[str, Any] | None) -> list[dict[str, Any]] #[source]

No description.

hidden_test(probe: dict[str, Any] | None, test_id: str) -> dict[str, Any] | None #[source]

No description.

match_column(profile: dict[str, Any], hints: Iterable[str]) -> str | None #[source]

Best column in profile matching any of hints (substring, case-insensitive).

has_datelike_column(profile: dict[str, Any], hints: Iterable[str]) -> str | None #[source]

A date role can be satisfied by a column name hint or a datetime dtype.

numeric_columns(profile: dict[str, Any]) -> list[str] #[source]

No description.

zips_in_profile(profile: dict[str, Any], id_hints: Iterable[str] = ()) -> set[str] #[source]

All ZIP-looking values visible in a dataframe profile.

zips_in_collection(entry: dict[str, Any]) -> set[str] #[source]

No description.

find_dataframe_candidates(probe: dict[str, Any] | None, predicate: Callable[[dict[str, Any]], bool], score: Callable[[dict[str, Any]], float] | None = None) -> list[dict[str, Any]] #[source]

Return profiles satisfying predicate, best first.

This is the generic form of design.md §21's find_dataframe_with_columns: matching may use columns, row counts, value ranges or expected geography.

find_scalar_close_to(probe: dict[str, Any] | None, expected: float, tolerance: float) -> list[dict[str, Any]] #[source]

Scalars in the namespace within tolerance of the expected answer.

describe_dataframe(profile: dict[str, Any], max_columns: int = 12) -> dict[str, Any] #[source]

Compact, TA-readable description used as rubric evidence (design.md §12).