PreClass
PreClass: Main Service
- class service.preclass.main.PRECLASS_MAIN[source]
 Bases:
objectMain service class for handling the pre-class lecture processing pipeline.
This class manages a multi-stage workflow for processing lecture materials, including converting presentations to different formats and generating various educational materials.
- class STAGE[source]
 Bases:
objectEnumeration of processing stages for the pre-class pipeline.
- FINISHED = 100
 
- GEN_ASKQUESTION = 8
 
- GEN_DESCRIPTION = 4
 
- GEN_READSCRIPT = 7
 
- GEN_SHOWFILE = 6
 
- GEN_STRUCTURE = 5
 
- PDF2PNG = 2
 
- PPT2TEXT = 3
 
- PPTX2PDF = 1
 
- PUSH_AGENDA = 99
 
- START = 0
 
- static get_status(job_id)[source]
 
- static launch_worker()[source]
 Launches the worker process for handling pre-class processing jobs.
Establishes a connection to RabbitMQ and begins consuming messages from the queue. Each message triggers the appropriate stage of processing based on the job’s current stage. The worker can be terminated using CTRL+C.
- Raises:
 KeyboardInterrupt – When the worker is manually stopped
- static trigger(parent_service, source_file)[source]
 Initiates a new pre-class processing job.
- Parameters:
 parent_service (str) – Identifier of the parent service initiating this job
source_file (str) – Path to the source presentation file to be processed
- Returns:
 The ID of the created job
- Return type:
 str
Notes
Creates a new job in MongoDB and pushes it to RabbitMQ queue for processing. Moves the source file to a buffer location for processing.
- service.preclass.main.now(tz=None)
 Returns new datetime object representing current time local to tz.
- tz
 Timezone object.
If no tz is specified, uses local timezone.
PreClass: Data Structures
- class service.preclass.model.AgendaStruct(title, children=None, function=None)[source]
 Bases:
objectA tree structure representing an agenda or outline with hierarchical nodes.
- title
 The title/heading of this agenda item
- Type:
 str
- children
 List of child AgendaStruct or PPTPageStruct objects
- Type:
 list
- dfs_recursive_call(function)[source]
 Recursively call the given function on each node in the agenda structure.
- Parameters:
 function – The function to be called on each node
- flatten()[source]
 Return a flattened list of all nodes in the agenda structure.
- Returns:
 List of all nodes in the agenda structure
- Return type:
 list
- formalize()[source]
 Return a string representation of the title/heading of this agenda item
- classmethod from_dict(dict)[source]
 Create an agenda structure from a dictionary representation.
- Parameters:
 dict – Dictionary representation of the agenda structure
- Returns:
 The agenda structure object
- Return type:
 
- get_structure_trace()[source]
 Generate a formatted string representation of the structure’s hierarchy.
- Returns:
 Indented string showing the structure trace
- Return type:
 str
- insert_page(page, trace)[source]
 Insert a page into the agenda structure following the given trace path.
- Parameters:
 page – The page object to insert
trace (list) – List of section titles forming path to insertion point
- Returns:
 True if page was inserted successfully, False otherwise
- Return type:
 bool
- serialize()[source]
 
- to_dict()[source]
 Return a dictionary representation of the agenda structure.
- Returns:
 Dictionary representation of the agenda structure
- Return type:
 dict
- type = 'node'
 
- class service.preclass.model.AskQuestion(question, question_type, selects, answer, reference)[source]
 Bases:
FunctionBaseFunction to present a question to users.
- Parameters:
 question (str) – The question text
question_type – Type/category of question
selects – Available answer options
answer – Correct answer
reference – Reference material (commented out)
- class service.preclass.model.FunctionBase(call, label, value)[source]
 Bases:
objectBase class for defining interactive functions/actions within the agenda.
- call
 Function identifier/name
- Type:
 str
- label
 Display label for the function
- Type:
 str
- value
 Parameters/values for the function
- Type:
 dict
- classmethod from_dict(dict)[source]
 
- to_dict()[source]
 
- class service.preclass.model.PPTPageStruct(page, stringified, function=None)[source]
 Bases:
objectRepresents a PowerPoint page/slide in the agenda structure.
- content
 The actual page/slide content
- stringified
 String representation of the page
- Type:
 str
- dfs_recursive_call(function)[source]
 
- flatten(condition=None)[source]
 
- formalize()[source]
 
- classmethod from_dict(dict)[source]
 
- get_structure_trace()[source]
 
- serialize()[source]
 
- to_dict()[source]
 
- type = 'ppt'
 
- class service.preclass.model.ReadScript(script)[source]
 Bases:
FunctionBaseFunction to read a script/text.
- Parameters:
 script (str) – The script content to be read
- class service.preclass.model.ShowFile(file_id)[source]
 Bases:
FunctionBaseFunction to display a file.
- Parameters:
 file_id – Identifier for the file to be shown
PreClass: Sub-Services
- service.preclass.processors.pptx2pdf module
 - service.preclass.processors.pdf2png module
 - service.preclass.processors.ppt2text module
 - service.preclass.processors.gen_description module
 - service.preclass.processors.gen_structure module
SERVICEStructurelizorStructurelizor.input_scriptsStructurelizor.root_titleStructurelizor.promptStructurelizor.call_generation()Structurelizor.extract()Structurelizor.find_trace()Structurelizor.format_assistant()Structurelizor.format_prompt()Structurelizor.format_user()Structurelizor.parse_tab()Structurelizor.script2string()
now()
 - service.preclass.processors.gen_showfile module
 - service.preclass.processors.gen_readscript module
 - service.preclass.processors.gen_askquestion module
 - service.preclass.processors.qa_utils module