156 lines
3.8 KiB
Python
156 lines
3.8 KiB
Python
"""
|
|
Services module for IRT Bank Soal.
|
|
|
|
Contains business logic services for:
|
|
- IRT calibration
|
|
- CAT selection
|
|
- WordPress authentication
|
|
- AI question generation
|
|
- Reporting
|
|
"""
|
|
|
|
from app.services.irt_calibration import (
|
|
IRTCalibrationError,
|
|
calculate_fisher_information,
|
|
calculate_item_information,
|
|
calculate_probability,
|
|
calculate_theta_se,
|
|
estimate_b_from_ctt_p,
|
|
estimate_theta_mle,
|
|
get_session_responses,
|
|
nn_to_theta,
|
|
theta_to_nn,
|
|
update_session_theta,
|
|
update_theta_after_response,
|
|
)
|
|
from app.services.cat_selection import (
|
|
CATSelectionError,
|
|
NextItemResult,
|
|
TerminationCheck,
|
|
check_user_level_reuse,
|
|
get_available_levels_for_slot,
|
|
get_next_item,
|
|
get_next_item_adaptive,
|
|
get_next_item_fixed,
|
|
get_next_item_hybrid,
|
|
should_terminate,
|
|
simulate_cat_selection,
|
|
update_theta,
|
|
)
|
|
from app.services.wordpress_auth import (
|
|
WordPressAPIError,
|
|
WordPressAuthError,
|
|
WordPressRateLimitError,
|
|
WordPressTokenInvalidError,
|
|
WordPressUserInfo,
|
|
WebsiteNotFoundError,
|
|
SyncStats,
|
|
fetch_wordpress_users,
|
|
get_or_create_user,
|
|
get_wordpress_user,
|
|
sync_wordpress_users,
|
|
verify_website_exists,
|
|
verify_wordpress_token,
|
|
)
|
|
from app.services.ai_generation import (
|
|
call_openrouter_api,
|
|
check_cache_reuse,
|
|
generate_question,
|
|
generate_with_cache_check,
|
|
get_ai_stats,
|
|
get_prompt_template,
|
|
parse_ai_response,
|
|
save_ai_question,
|
|
validate_ai_model,
|
|
SUPPORTED_MODELS,
|
|
)
|
|
from app.services.reporting import (
|
|
generate_student_performance_report,
|
|
generate_item_analysis_report,
|
|
generate_calibration_status_report,
|
|
generate_tryout_comparison_report,
|
|
export_report_to_csv,
|
|
export_report_to_excel,
|
|
export_report_to_pdf,
|
|
schedule_report,
|
|
get_scheduled_report,
|
|
list_scheduled_reports,
|
|
cancel_scheduled_report,
|
|
StudentPerformanceReport,
|
|
ItemAnalysisReport,
|
|
CalibrationStatusReport,
|
|
TryoutComparisonReport,
|
|
ReportSchedule,
|
|
)
|
|
|
|
__all__ = [
|
|
# IRT Calibration
|
|
"IRTCalibrationError",
|
|
"calculate_fisher_information",
|
|
"calculate_item_information",
|
|
"calculate_probability",
|
|
"calculate_theta_se",
|
|
"estimate_b_from_ctt_p",
|
|
"estimate_theta_mle",
|
|
"get_session_responses",
|
|
"nn_to_theta",
|
|
"theta_to_nn",
|
|
"update_session_theta",
|
|
"update_theta_after_response",
|
|
# CAT Selection
|
|
"CATSelectionError",
|
|
"NextItemResult",
|
|
"TerminationCheck",
|
|
"check_user_level_reuse",
|
|
"get_available_levels_for_slot",
|
|
"get_next_item",
|
|
"get_next_item_adaptive",
|
|
"get_next_item_fixed",
|
|
"get_next_item_hybrid",
|
|
"should_terminate",
|
|
"simulate_cat_selection",
|
|
"update_theta",
|
|
# WordPress Auth
|
|
"WordPressAPIError",
|
|
"WordPressAuthError",
|
|
"WordPressRateLimitError",
|
|
"WordPressTokenInvalidError",
|
|
"WordPressUserInfo",
|
|
"WebsiteNotFoundError",
|
|
"SyncStats",
|
|
"fetch_wordpress_users",
|
|
"get_or_create_user",
|
|
"get_wordpress_user",
|
|
"sync_wordpress_users",
|
|
"verify_website_exists",
|
|
"verify_wordpress_token",
|
|
# AI Generation
|
|
"call_openrouter_api",
|
|
"check_cache_reuse",
|
|
"generate_question",
|
|
"generate_with_cache_check",
|
|
"get_ai_stats",
|
|
"get_prompt_template",
|
|
"parse_ai_response",
|
|
"save_ai_question",
|
|
"validate_ai_model",
|
|
"SUPPORTED_MODELS",
|
|
# Reporting
|
|
"generate_student_performance_report",
|
|
"generate_item_analysis_report",
|
|
"generate_calibration_status_report",
|
|
"generate_tryout_comparison_report",
|
|
"export_report_to_csv",
|
|
"export_report_to_excel",
|
|
"export_report_to_pdf",
|
|
"schedule_report",
|
|
"get_scheduled_report",
|
|
"list_scheduled_reports",
|
|
"cancel_scheduled_report",
|
|
"StudentPerformanceReport",
|
|
"ItemAnalysisReport",
|
|
"CalibrationStatusReport",
|
|
"TryoutComparisonReport",
|
|
"ReportSchedule",
|
|
]
|