File size: 8,557 Bytes
763047f
1701e56
31f7bae
 
 
6f03cc8
12c332b
 
 
 
3ffb57b
 
12c332b
 
1701e56
 
94ab8f3
12c332b
 
1701e56
 
12c332b
 
1701e56
 
12c332b
 
1701e56
 
12c332b
 
3ffb57b
31f7bae
3ffb57b
2e33552
bd1f057
94ab8f3
 
e74edce
bd1f057
94ab8f3
 
 
 
2e33552
4d87af1
2e33552
4d87af1
12c332b
94ab8f3
1701e56
94ab8f3
 
 
1701e56
 
 
 
12c332b
1701e56
94ab8f3
1701e56
12c332b
6f03cc8
78ed8a7
31f7bae
c393524
6f03cc8
5f124eb
1701e56
 
 
 
d35ce58
 
 
 
 
 
 
 
 
 
 
94ab8f3
d35ce58
 
 
 
 
5f124eb
1701e56
d35ce58
 
94ab8f3
d35ce58
 
5f124eb
31f7bae
 
 
 
 
 
12c332b
31f7bae
 
 
 
 
1701e56
 
 
 
94ab8f3
31f7bae
1701e56
 
94ab8f3
 
 
 
 
 
31f7bae
 
1701e56
31f7bae
1701e56
31f7bae
 
1701e56
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import gradio as gr
from lesson_graph import LessonGraph

# Instantiate the LessonGraph class
lesson_graph = LessonGraph()

# Gradio interface
demo = gr.Blocks()

with demo:
    gr.Markdown("# EduScape: Design Your Educational Landscape")
    gr.Markdown("Welcome to EduScape, where lesson planning becomes an adventure in crafting educational journeys. Design, visualize, and perfect your learning landscapes with ease.")
    
    with gr.Row():
        teacher_name = gr.Textbox(label="Teacher Name (Required)", placeholder="Enter the teacher's full name", info="e.g., Sarah Johnson")
        school_board = gr.Textbox(label="School Board/Region (Optional)", placeholder="Enter the school board or region", info="e.g., Oakville District School Board")
        country_authority = gr.Textbox(label="Country Authority (Optional)", placeholder="Enter the country-level education authority", info="e.g., Ministry of National Education of Poland")
    
    with gr.Row():
        subject = gr.Textbox(label="Subject (Required)", placeholder="Enter the subject name", info="e.g., Earth Science")
        grade_level = gr.Textbox(label="Grade Level (Required)", placeholder="Enter the grade level", info="e.g., Grade 7")
    
    with gr.Row():
        learning_objective = gr.Textbox(label="Learning Objective (Optional)", placeholder="Enter the main learning goal", info="e.g., Understand the water cycle and its impact on Earth's climate")
        activity = gr.Textbox(label="Activity (Optional)", placeholder="Enter the main class activity", info="e.g., Create a terrarium to model the water cycle")
    
    with gr.Row():
        assessment = gr.Textbox(label="Assessment (Optional)", placeholder="Enter the assessment method", info="e.g., Group presentation on terrarium observations")
        resource = gr.Textbox(label="Resource/Material (Optional)", placeholder="Enter required resources", info="e.g., Terrarium kit, climate diagrams")
    
    with gr.Row():
        generate_btn = gr.Button("Map Your Lesson Plan")
        graph_btn = gr.Button("Display Graph (JSON)")
        clear_btn = gr.Button("Clear Landscape")

    examples = [
        ["Sarah Johnson", "Oakville District School Board", "Ministry of Education", "Earth Science", "Grade 7", "Understand the water cycle and its impact on Earth's climate", "Create a terrarium to model the water cycle", "Group presentation on terrarium observations", "Terrarium kit, climate diagrams"],
        ["Marek Nowak", "Warsaw School District", "Ministry of National Education of Poland", "Matematyka", "Klasa 2", "Zrozumienie podstawowych operacji matematycznych", "Rozwiązywanie prostych zadań tekstowych", "Praca grupowa nad rozwiązywaniem zadań", "Podręcznik, karty pracy, tablica interaktywna"]
    ]

    gr.Examples(
        examples=examples, 
        inputs=[teacher_name, school_board, country_authority, subject, grade_level, learning_objective, activity, assessment, resource]
    )
    
    search_output = gr.Textbox(label="Content Discovery Search String", show_copy_button=True)
    graph_output = gr.Image(label="Your Educational Landscape")
    message_output = gr.Textbox(label="Landscape Status", show_copy_button=True)
    
    def handle_generate(teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority):
        try:
            search_string, image = lesson_graph.process_inputs(
                teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority
            )
            return search_string, image, "Lesson plan mapped successfully!"
        except ValueError as e:
            return "", None, f"Error: {str(e)}. Please fill in all required fields."

    generate_btn.click(
        handle_generate, 
        inputs=[teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority],
        outputs=[search_output, graph_output, message_output]
    )
    
    graph_btn.click(
        lesson_graph.graph_to_json,
        outputs=[message_output]
    )

    def handle_reset():
        reset_state = lesson_graph.reset_state()
        return list(reset_state)

    def handle_reset():
        reset_state = lesson_graph.reset_state()
        return (
            reset_state.teacher_name,
            reset_state.subject,
            reset_state.grade_level,
            reset_state.learning_objective,
            reset_state.activity,
            reset_state.assessment,
            reset_state.resource,
            reset_state.school_board,
            reset_state.country_authority,  # Include the new field
            "",  # Reset search_output
            None,  # Reset graph_output
            reset_state.message
        )
    
    clear_btn.click(
        handle_reset,
        outputs=[
            teacher_name, subject, grade_level, learning_objective, 
            activity, assessment, resource, school_board, country_authority,  # Include the new field
            search_output, graph_output, message_output
        ]
    )

    # Add Markdown section explaining the purpose and use of the app
    gr.Markdown("""
    ## Purpose of EduScape: Understanding Lesson Plans as a Graph

    EduScape helps educators visualize lesson plans as a graph, where key lesson elements (teacher, subject, grade level, learning objectives, activities, assessments, and resources) are represented as nodes with logical relationships. This structure allows teachers to better understand the connections between different parts of their lessons, facilitating clearer planning and discovery of resources.

    ### Key Features:
    - **User Input-Driven Graph Construction**: Educators can input details like teacher name, subject, grade level, learning objective, activity, assessment, and resources to automatically construct a lesson plan graph.
    - **Graph Visualization**: Each element of the lesson plan is represented as a node, and the connections between these elements (like how an activity achieves the learning objective) are visualized through edges.
    - **Content Discovery**: The system generates a search string based on input, which can help the teacher discover content or resources to support their lesson plan.

    ### Required and Optional Fields:
    - **Required Fields**: Teacher Name, Subject, and Grade Level
    - **Optional Fields**: Learning Objective, Activity, Assessment, Resource/Material, and School Board/Region

    ### Logical Flow of the Knowledge Graph:    
    1. The **Teacher** node connects to the **Subject** node (representing what the teacher teaches).
    2. The **Subject** node connects to the **Grade Level** (defining what is taught and to whom).
    3. If provided, the **Learning Objective** node links to the **Subject** (showing what specific goal is covered).
    4. If provided, the **Country Authority** node connects to the **Learning Objective** (indicating that the national authority defines the learning objectives).
    5. If both are provided, the **Activity** node links to the **Learning Objective** (showing how the objective is achieved through student engagement).
    6. If provided, the **Assessment** node connects to the **Learning Objective** (indicating how learning is evaluated).
    7. If both are provided, the **Resource** node connects to the **Activity** (detailing what materials are needed for the activity).
    8. If provided, the **Teacher** also connects to the **School Board** (showing which governing body the teacher belongs to).
    9. If both are provided, the **Country Authority** node connects to the **School Board** (showing oversight from the national level).

    ### Example Use Case:
    A teacher, Sarah Johnson, inputs her lesson plan for Grade 7 Earth Science. She must provide her name, the subject, and the grade level. Optionally, she can add a learning objective about understanding the water cycle, an activity to create a terrarium, a group presentation for assessment, and specify resources like a terrarium kit. The system visualizes the relationships between these elements in the graph and generates a content discovery string to help her find additional resources.

    EduScape ensures that teachers can organize their lessons effectively while aligning with the curriculum and discovering resources to enhance their lesson delivery, with flexibility to include as much or as little detail as they prefer.
    """)

# Launch the EduScape app
demo.launch()