Types
Handles the custom types for the App backend.
Type Aliases
ScoreEvalLiteral = Literal["Lower", "About right", "Higher"]RunStateKey = Literal["paper", "domain", "generated_domain", "score", "score_version", "generated_file_path", "human_curated_domain", "param_set", "reference_nodes", "run_index", "total_runs", "already_evaluated", "logger", "eval_data"]AppStateKey = Literal["logger", "results_dir_path", "bco_results_file_name", "bco_results_data", "user_results_file_name", "user_results_data", "users_file_name", "users_data", "generated_directory_paths", "padding", "font", "user_hash"]
            ConfigData
    
              Bases: TypedDict
Defines the schema for the JSON config data.
Attributes:
| Name | Type | Description | 
|---|---|---|
logger_path | 
            
                  str
             | 
            
               The path to the logger.  | 
          
logger_name | 
            
                  str
             | 
            
               The name of the logger.  | 
          
generated_output_dir_path | 
            
                  str
             | 
            
               The filepath to the generated domains directory to evaluate.  | 
          
glob_pattern | 
            
                  str
             | 
            
               The glob patterns to traverse the generated output directory.  | 
          
results_dir_path | 
            
                  str
             | 
            
               The path to the directory to dump the evaluation results.  | 
          
ignore_files | 
            
                  list[str]
             | 
            
               Identifiers to ignore certain files (used like   | 
          
bco_results_file_name | 
            
                  str
             | 
            
               The file name for the BCO results file.  | 
          
user_results_file_name | 
            
                  str
             | 
            
               The file name for the user evaluations results file.  | 
          
users_file_name | 
            
                  str
             | 
            
               The file name for the users file.  | 
          
padding | 
            
                  int
             | 
            
               The default root padding used throughout the frontend components.  | 
          
font | 
            
                  str
             | 
            
               The default font used throughout the frontend components.  | 
          
Source code in evaluator/backend/custom_types.py
                
            ScoreEval
    
              Bases: TypedDict
Score evaluation results.
Attributes:
| Name | Type | Description | 
|---|---|---|
eval | 
            
                  ScoreEvalLiteral
             | 
            
               The score eval literal.  | 
          
eval_code | 
            
                  int
             | 
            
               The casted score eval literal.  | 
          
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the score evaluation.  | 
          
Source code in evaluator/backend/custom_types.py
                
            ErrorEval
    
              Bases: TypedDict
Error evaluation data.
Attributes:
| Name | Type | Description | 
|---|---|---|
inferred_knowledge_error | 
            
                  bool
             | 
            
               Whether there was an inferred knowledge error.  | 
          
external_knowledge_error | 
            
                  bool
             | 
            
               Whether there was an external knowledge error.  | 
          
json_format_error | 
            
                  bool
             | 
            
               Whether there was a JSON formatting error.  | 
          
other_error | 
            
                  bool
             | 
            
               Whether there was any other error.  | 
          
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the error evaluation.  | 
          
Source code in evaluator/backend/custom_types.py
                
            RefereceEval
    
              Bases: TypedDict
Reference evaluation data.
Attributes:
| Name | Type | Description | 
|---|---|---|
reference_relevancy | 
            
                  int
             | 
            
               Indicates how relevant the reference nodes were to the domain.  | 
          
top_reference_retrieval | 
            
                  bool
             | 
            
               Whether the top node retrieved was the most relevant.  | 
          
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the reference evaluation.  | 
          
Source code in evaluator/backend/custom_types.py
                
            GeneralEval
    
              Bases: TypedDict
General evaluation data.
Attributes:
| Name | Type | Description | 
|---|---|---|
relevancy | 
            
                  int
             | 
            
               Indicates how relevant the generated domain was.  | 
          
readability | 
            
                  int
             | 
            
               Indicates how readable the generated domain was.  | 
          
reproducibility | 
            
                  int
             | 
            
               Indicates how reproduceable the domain steps are.  | 
          
confidence_rating | 
            
                  int
             | 
            
               Indicates how confident the evaluator was in their evaluation.  | 
          
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the general evaluation.  | 
          
Source code in evaluator/backend/custom_types.py
                
            MiscEval
    
              Bases: TypedDict
Miscellaneous evaluation data.
Attributes:
| Name | Type | Description | 
|---|---|---|
human_domain_rating | 
            
                  int
             | 
            
               The high level human domain rating for the generated domain.  | 
          
evaluator_confidence_rating | 
            
                  int
             | 
            
               Indicates how confident the evaluator is in their evaluation.  | 
          
evaluator_familiarity_level | 
            
                  int
             | 
            
               Indicates how familiar the evaluator is with the paper content.  | 
          
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the miscellaneous evaluation.  | 
          
Source code in evaluator/backend/custom_types.py
                
            EvalData
    
              Bases: TypedDict
Full evaluation data.
Attributes:
| Name | Type | Description | 
|---|---|---|
score_eval | 
            
                  ScoreEval
             | 
            
               | 
          
error_eval | 
            
                  ErrorEval
             | 
            
               | 
          
reference_eval | 
            
                  RefereceEval
             | 
            
               | 
          
general_eval | 
            
                  GeneralEval
             | 
            
               | 
          
misc_eval | 
            
                  MiscEval
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
                
            RunState
    
              Bases: TypedDict
Holds the data for the current run being evaluated.
Attributes:
| Name | Type | Description | 
|---|---|---|
paper | 
            
                  str
             | 
            
               The paper for the current run state.  | 
          
domain | 
            
                  str
             | 
            
               The domain the current run is for.  | 
          
generated_domain | 
            
                  str
             | 
            
               The generated domain string for the current run.  | 
          
score | 
            
                  float
             | 
            
               The score for the current run (from the BCO score API).  | 
          
score_version | 
            
                  float
             | 
            
               The score version for the score (from the BCO score API).  | 
          
generated_file_path | 
            
                  str
             | 
            
               The generated domain file path (points to the JSON file if valid JSON, otherwise points to the raw text file).  | 
          
human_curated_domain | 
            
                  str
             | 
            
               The human curated domain string.  | 
          
param_set | 
            
                  str
             | 
            
               The parameter set string for the run.  | 
          
reference_nodes | 
            
                  str
             | 
            
               The retrieved reference node values.  | 
          
run_index | 
            
                  int
             | 
            
               The run index.  | 
          
total_runs | 
            
                  int
             | 
            
               The total number of runs to potentially evaluate.  | 
          
already_evaluated | 
            
                  bool
             | 
            
               Whether the user has already evaluated this run.  | 
          
logger | 
            
                  Logger
             | 
            
               The logger for the App.  | 
          
eval_data | 
            
                  EvalData
             | 
            
               The evaluation data for the run.  | 
          
Source code in evaluator/backend/custom_types.py
                
            AppAttributes
    
              Bases: TypedDict
Handles the app initialization attributes.
Attributes:
| Name | Type | Description | 
|---|---|---|
logger | 
            
                  Logger
             | 
            
               The App logger.  | 
          
results_dir_path | 
            
                  str
             | 
            
               The path to the directory to dump the evaluation results.  | 
          
bco_results_file_name | 
            
                  str
             | 
            
               The file name for the BCO results file.  | 
          
bco_results_data | 
            
                  dict
             | 
            
               The aggregates BCO results data.  | 
          
user_results_file_name | 
            
                  str
             | 
            
               The file name for the user evaluations results file.  | 
          
user_results_data | 
            
                  dict[str, dict[str, EvalData | None] | None]
             | 
            
               The user evaluation results.  | 
          
users_file_name | 
            
                  str
             | 
            
               The file name for the users file.  | 
          
users_data | 
            
                  dict
             | 
            
               The users data.  | 
          
generated_output_dir_root | 
            
                  str
             | 
            
               The root filepath to the generated domains directory to evaluate.  | 
          
generated_directory_paths | 
            
                  list[str]
             | 
            
               List of directory paths for all the papers.  | 
          
padding | 
            
                  int
             | 
            
               The default root padding to use for all the frontend components.  | 
          
font | 
            
                  str
             | 
            
               The default font to use for all the frontend components.  | 
          
Source code in evaluator/backend/custom_types.py
                
            AppState
    
              Bases: AppAttributes
Holds the application state information, essentially just the attributes plus the current user hash, new user flag and start from last session boolean.
Attributes:
| Name | Type | Description | 
|---|---|---|
user_hash | 
            
                  str
             | 
            
               The user hash.  | 
          
new_user | 
            
                  bool
             | 
            
               New user flag.  | 
          
resume_session | 
            
                  bool
             | 
            
               Resume session flag.  | 
          
Source code in evaluator/backend/custom_types.py
                
            cast_checkbox(val)
    Cast checkbox string to boolean (assuming checkbox values are on, off).
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
val | 
            
                  str
             | 
            
               The value to cast.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  bool
             | 
            
               The casted checkbox value.  | 
          
Source code in evaluator/backend/custom_types.py
              
            reverse_cast_checkbox(err)
    Reverse cast checkbox bool to string (assuming checkbox values are on, off).
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
err | 
            
                  bool
             | 
            
               The value to revserse cast.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  str
             | 
            
               The reverse casted value.  | 
          
Source code in evaluator/backend/custom_types.py
              
            create_score_eval(eval, notes)
    Constructor for the ScoreEval TypedDict. The score eval literal will be automatically casted to the eval code.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
eval | 
            
                  ScoreEvalLiteral
             | 
            
               The score eval literal.  | 
            required | 
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the score evaluation.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ScoreEval
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
              
            cast_score_eval(score_eval_str)
    Cast a string to ScoreEvalLiteral (if possible).
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
score_eval_str | 
            
                  str
             | 
            
               The string to cast.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ScoreEvalLiteral
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
              
            create_error_val(inf_err, ext_err, json_err, other_err, notes)
    Constructor for the ErrorEval TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
inf_err | 
            
                  bool | str
             | 
            
               The inferred knowledge error indicator.  | 
            required | 
ext_err | 
            
                  bool | str
             | 
            
               The external knowledge error indicator.  | 
            required | 
json_err | 
            
                  bool | str
             | 
            
               The JSON formattign error indicator.  | 
            required | 
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the error evaluation.  | 
            required | 
Source code in evaluator/backend/custom_types.py
              
            create_reference_eval(reference_relevancy, top_reference_retrieval, notes)
    Constructor for the RefereceEval TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
reference_relevancy | 
            
                  int
             | 
            
               Indicates how relevant the reference nodes were to the domain.  | 
            required | 
top_reference_retrieval | 
            
                  bool
             | 
            
               Whether the top node retrieved was the most relevant.  | 
            required | 
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the reference evaluation.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ReferenceEval
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
              
            create_general_eval(relevancy, readability, reproducibility, confidence_rating, notes)
    Constructor for the GeneralEval TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
relevancy | 
            
                  int
             | 
            
               Indicates how relevant the generated domain was.  | 
            required | 
readability | 
            
                  int
             | 
            
               Indicates how readable the generated domain was.  | 
            required | 
reproducibility | 
            
                  int
             | 
            
               Indicates how reproduceable the domain steps are.  | 
            required | 
confidence_rating | 
            
                  int
             | 
            
               Indicates how confident the evaluator is in the generated domain.  | 
            required | 
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the general evaluation.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  GeneralEval
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
              
            create_misc_eval(human_domain_rating, evaluator_confidence_rating, evaluator_familiarity_level, notes)
    Constructor for the MiscEval TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
human_domain_rating | 
            
                  int
             | 
            
               The high level human domain rating for the generated domain.  | 
            required | 
evaluator_confidence_rating | 
            
                  int
             | 
            
               Indicates how confident the evaluator is in their evaluation.  | 
            required | 
evaluator_familiarity_level | 
            
                  int
             | 
            
               Indicates how familiar the evaluator is with the paper content.  | 
            required | 
notes | 
            
                  str
             | 
            
               Any additional notes from the evaluator regarding the miscellaneous evaluation.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  MiscEval
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
              
            create_full_eval(score_eval, error_eval, reference_eval, general_eval, misc_eval)
    Constructor for the EvalData TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
score_eval | 
            
                  ScoreEval
             | 
            
               | 
            required | 
error_eval | 
            
                  ErrorEval
             | 
            
               | 
            required | 
reference_eval | 
            
                  RefereceEval
             | 
            
               | 
            required | 
general_eval | 
            
                  GeneralEval
             | 
            
               | 
            required | 
misc_eval | 
            
                  MiscEval
             | 
            
               | 
            required | 
Source code in evaluator/backend/custom_types.py
              
            load_score_defaults(filepath='./evaluator/backend/score_defaults.json')
    Loads the score defaults JSON file.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
filepath | 
            
                  str
             | 
            
               The filepath to the score defaults JSON file.  | 
            
                  './evaluator/backend/score_defaults.json'
             | 
          
Returns:
| Type | Description | 
|---|---|
                  EvalData | None
             | 
            
               The evaluation data with the default values or None on error.  | 
          
Source code in evaluator/backend/custom_types.py
              
            default_eval()
    Get a default EvalData.
Returns:
| Type | Description | 
|---|---|
                  EvalData
             | 
            
               | 
          
Source code in evaluator/backend/custom_types.py
              
            
            check_default_eval(val)
    Checks if the EvalData is still the default. This helps to prevent saving erroneous save data.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
val | 
            
                  dict | EvalData
             | 
            
               The evaluation data to check.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  bool
             | 
            
               True if still the default, False if different.  | 
          
Source code in evaluator/backend/custom_types.py
              
            create_run_state(paper, domain, generated_domain, generated_file_path, human_curated_domain, param_set, reference_nodes, run_index, total_runs, already_evaluated, logger, eval_data)
    Constructor for the RunState TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
paper | 
            
                  str
             | 
            
               The paper for the current run state.  | 
            required | 
domain | 
            
                  str
             | 
            
               The domain the current run is for.  | 
            required | 
generated_domain | 
            
                  str | dict
             | 
            
               The generated domain for the current run.  | 
            required | 
generated_file_path | 
            
                  str
             | 
            
               The generated domain file path (points to the JSON file if valid JSON, otherwise points to the raw text file).  | 
            required | 
human_curated_domain | 
            
                  str
             | 
            
               The human curated domain string.  | 
            required | 
param_set | 
            
                  str
             | 
            
               The parameter set string for the run.  | 
            required | 
reference_nodes | 
            
                  str
             | 
            
               The retrieved reference node values.  | 
            required | 
run_index | 
            
                  int
             | 
            
               The run index.  | 
            required | 
total_runs | 
            
                  int
             | 
            
               The total number of runs to potentially evaluate.  | 
            required | 
already_evaluated | 
            
                  bool
             | 
            
               Whether the user has already evaluated this run.  | 
            required | 
logger | 
            
                  Logger
             | 
            
               The logger for the App.  | 
            required | 
eval_data | 
            
                  EvalData
             | 
            
               The evaluation data for the run.  | 
            required | 
Source code in evaluator/backend/custom_types.py
              
            create_app_attributes(logger, results_dir_path, bco_results_file_name, bco_results_data, user_results_file_name, user_results_data, users_file_name, users_data, generated_output_dir_root, generated_directory_paths, padding, font)
    Constructor for the AppAttributes TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
logger | 
            
                  Logger
             | 
            
               The App logger.  | 
            required | 
results_dir_path | 
            
                  str
             | 
            
               The path to the directory to dump the evaluation results.  | 
            required | 
bco_results_file_name | 
            
                  str
             | 
            
               The file name for the BCO results file.  | 
            required | 
bco_results_data | 
            
                  dict
             | 
            
               The aggregates BCO results data.  | 
            required | 
user_results_file_name | 
            
                  str
             | 
            
               The file name for the user evaluations results file.  | 
            required | 
user_results_data | 
            
                  dict[str, dict[str, EvalData | None] | None]
             | 
            
               The user evaluation results.  | 
            required | 
users_file_name | 
            
                  str
             | 
            
               The file name for the users file.  | 
            required | 
users_data | 
            
                  dict
             | 
            
               The users data.  | 
            required | 
generated_output_dir_root | 
            
                  str
             | 
            
               The root filepath to the generated domains directory to evaluate.  | 
            required | 
generated_directory_paths | 
            
                  list[str]
             | 
            
               List of directory paths for all the papers.  | 
            required | 
padding | 
            
                  int
             | 
            
               The default root padding to use for all the frontend components.  | 
            required | 
font | 
            
                  str
             | 
            
               The default font to use for all the frontend components.  | 
            required | 
Source code in evaluator/backend/custom_types.py
              
            create_app_state(attributes, user_hash, new_user, resume_session=False)
    Constructor for the AppState TypedDict.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
attributes | 
            
                  AppAttributes
             | 
            
               The app attributes to base the state off of.  | 
            required | 
user_hash | 
            
                  str
             | 
            
               The user hash.  | 
            required | 
new_user | 
            
                  bool
             | 
            
               New user flag.  | 
            required | 
resume_session | 
            
                  bool
             | 
            
               Resume session flag.  | 
            
                  False
             | 
          
Returns:
| Type | Description | 
|---|---|
                  AppState
             | 
            
               |