Skip to content

Commit

Permalink
Fixing more names/usages of Rubric to be ScoringData
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremywiebe committed Dec 19, 2024
1 parent da93805 commit 7ce25ce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 51 deletions.
12 changes: 6 additions & 6 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ base Markdown syntax:

1. Widgets - Perseus can render custom widgets (in the form of React
components) which conform to a special API that enables the user to
interact with the widget and for the widget to check taht input for
correctness against a rubric. Widgets are denoted using the following
Markdown syntax: `[[☃️ widget-id ]]` (where `widget-id` represents a
generated ID that is unique within the Perseus instance.
interact with the widget and for the widget to check that input for
correctness against a set of scoring data. Widgets are denoted using the
following Markdown syntax: `[[☃️ widget-id ]]` (where `widget-id`
represents a generated ID that is unique within the Perseus instance.
1. Math - Perseus can also render beautiful math using MathJax. Math is
denoted using an opening and close dollar sign (eg. `$y = mx + b$`).

Expand Down Expand Up @@ -181,15 +181,15 @@ the widgets options type (ie. the type `T` wrapped in `WidgetOptions<T>` from
In a few rare cases, this type is defined as the sum of RenderProps wrapped in
`WidgetOptions`.

### `Rubric`
### `Scoring Data`

This type defines the data that the scoring function needs in order to score
the learner's guess (aka user input).

### `Props`

Finally, `Props` form the entire set of props that widget's component supports.
Typically it is defined as `type Props = WidgetProps<RenderProps, Rubric>`. In
Typically it is defined as `type Props = WidgetProps<RenderProps, ScoringData>`. In
cases where there are `RenderProps` that are optional that are provided via
`DefaultProps`, this `Props` type "redefines" these props as `myProp:
NonNullable<ExternalProps["myProps"]>;`.
Expand Down
6 changes: 3 additions & 3 deletions packages/perseus/src/__tests__/validation.typetest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* scoring or validation.
*/
import type {PerseusRenderer} from "../perseus-types";
import type {RubricMap, ValidationDataMap} from "../validation.types";
import type {ScoringDataMap, ValidationDataMap} from "../validation.types";

// We can use a 'widgets' map from a PerseusRenderer as a ValidationDataMap
0 as any as PerseusRenderer["widgets"] satisfies ValidationDataMap;

// We can use a RubricMap as a ValidationDataMap
0 as any as RubricMap satisfies ValidationDataMap;
// We can use a ScoringDataMap as a ValidationDataMap
0 as any as ScoringDataMap satisfies ValidationDataMap;
47 changes: 5 additions & 42 deletions packages/perseus/src/validation.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,64 +235,27 @@ export type PerseusTableScoringData = {

export type PerseusTableUserInput = ReadonlyArray<ReadonlyArray<string>>;

export type ScoringData =
| PerseusCategorizerScoringData
| PerseusDropdownScoringData
| PerseusExpressionScoringData
| PerseusGroupScoringData
| PerseusGradedGroupScoringData
| PerseusGradedGroupSetScoringData
| PerseusGrapherScoringData
| PerseusInputNumberScoringData
| PerseusInteractiveGraphScoringData
| PerseusLabelImageScoringData
| PerseusMatcherScoringData
| PerseusMatrixScoringData
| PerseusNumberLineScoringData
| PerseusNumericInputScoringData
| PerseusOrdererScoringData
| PerseusPlotterScoringData
| PerseusRadioScoringData
| PerseusSorterScoringData
| PerseusTableScoringData;

export interface RubricRegistry {
export interface ScoringDataRegistry {
categorizer: PerseusCategorizerScoringData;
// "cs-program": PerseusCSProgramScoringData;
// definition: PerseusDefinitionScoringData;
dropdown: PerseusDropdownScoringData;
// explanation: PerseusExplanationScoringData;
expression: PerseusExpressionScoringData;
grapher: PerseusGrapherScoringData;
"graded-group-set": PerseusGradedGroupSetScoringData;
"graded-group": PerseusGradedGroupScoringData;
group: PerseusGroupScoringData;
// iframe: PerseusIFrameScoringData;
image: PerseusLabelImageScoringData;
"input-number": PerseusInputNumberScoringData;
// interaction: PerseusInteractionScoringData;
"interactive-graph": PerseusInteractiveGraphScoringData;
"label-image": PerseusLabelImageScoringData;
matcher: PerseusMatcherScoringData;
matrix: PerseusMatrixScoringData;
// measurer: PerseusMeasurerScoringData;
// "molecule-renderer": PerseusMoleculeRendererScoringData;
"number-line": PerseusNumberLineScoringData;
"numeric-input": PerseusNumericInputScoringData;
orderer: PerseusOrdererScoringData;
// "passage-ref-target": PerseusRefTargetScoringData;
// "passage-ref": PerseusPassageRefScoringData;
// passage: PerseusPassageScoringData;
// "phet-simulation": PerseusPhetSimulationScoringData;
// "python-program": PerseusPythonProgramScoringData;
plotter: PerseusPlotterScoringData;
radio: PerseusRadioScoringData;
sorter: PerseusSorterScoringData;
table: PerseusTableScoringData;
// video: PerseusVideoScoringData;

// Deprecated widgets
// sequence: PerseusAutoCorrectScoringData;
}

/**
Expand All @@ -304,15 +267,15 @@ export interface RubricRegistry {
* share functionality that understands how to traverse maps of `widget id` to
* `options`.
*/
export type RubricMap = {
[Property in keyof RubricRegistry as `${Property} ${number}`]: {
export type ScoringDataMap = {
[Property in keyof ScoringDataRegistry as `${Property} ${number}`]: {
type: Property;
static?: boolean;
options: RubricRegistry[Property];
options: ScoringDataRegistry[Property];
};
};

export type Rubric = RubricRegistry[keyof RubricRegistry];
export type ScoringData = ScoringDataRegistry[keyof ScoringDataRegistry];

// This is an interface so that it can be extended if a widget is created
// outside of this Perseus package. See `PerseusWidgetTypes` for a full
Expand Down

0 comments on commit 7ce25ce

Please sign in to comment.