import re # table css = """ .scrollable-table { max-height: 300px; overflow-y: auto; border: 1px solid #ccc; padding: 10px; } .scrollable-table table { width: 100%; border-collapse: collapse; background-color: #FFFFFF; } .scrollable-table th, .scrollable-table td { border: 1px solid #ddd; padding: 8px; text-align: left; color: #000000 } .scrollable-table th { background-color: #EAF2FF; color: #3366CC; } """ def parse_transcript(transcript): # Regex to match the timestamps and the text pattern = re.compile(r'(\d{2}:\d{2})\s+(.+?)(?=\d{2}:\d{2}|$)', re.DOTALL) matches = pattern.findall(transcript) timestamps = [] texts = [] for match in matches: timestamps.append(match[0]) texts.append(match[1].strip()) return timestamps, texts def create_transcript_table(timestamps, transcript_text): table_html = '
\n' table_html += '\n' table_html += ' \n' table_html += ' \n' table_html += ' \n' table_html += ' \n' table_html += ' \n' table_html += ' \n' table_html += ' \n' for ts, text in zip(timestamps, transcript_text): table_html += ' \n' table_html += f' \n' table_html += f' \n' table_html += ' \n' table_html += ' \n' table_html += '
TimestampTranscript
{ts}{text}
\n' return table_html def filter_transcript(): timestamps = [ "15.0 - 17.0", "38.08 - 39.50" ] transcript_text = [ "Sad (prompt; 1st)", "Because he fell (no prompt; 2nd)" ] return timestamps, transcript_text # Guidance Generation Function def generate_guidance(): guidance_text = """ Engagement: Student may display behaviors such as rocking when showing engagement. Impact factors: Weather (e.g., raining) can impact student’s performance.""" return guidance_text