File size: 2,816 Bytes
6cf2b7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

# Mermaid diagram in Markdown
mermaid_diagram = '''
graph TD;
    A[Resting Potential] --> B[Depolarization];
    B --> C[Repolarization];
    
    subgraph Neuron_Axon
        direction_of_impulse[Direction of Nerve Impulse]
        positive_ions[Positive Ions Rush In] --> depolarization_membrane[Membrane Channels Open];
        depolarization_membrane --> positive_outside[Excess Positive Ions Outside];
        repolarization_membrane[Membrane Pumps Positive Ions Out] --> excess_positive_inside[Excess Positive Ions Inside];
    end
    
    neurotransmitters[Neurotransmitters Role] --> excitatory[Excitatory Effect]
    neurotransmitters --> inhibitory[Inhibitory Effect]
    
    classDef process fill:#f9f,stroke:#333,stroke-width:2px;
    class A,B,C process;
'''

# JSON representation of the diagram
diagram_json = {
    "diagram": {
        "nodes": [
            { "id": "A", "label": "Resting Potential", "class": "process" },
            { "id": "B", "label": "Depolarization", "class": "process" },
            { "id": "C", "label": "Repolarization", "class": "process" },
            { "id": "direction_of_impulse", "label": "Direction of Nerve Impulse" },
            { "id": "positive_ions", "label": "Positive Ions Rush In" },
            { "id": "depolarization_membrane", "label": "Membrane Channels Open" },
            { "id": "positive_outside", "label": "Excess Positive Ions Outside" },
            { "id": "repolarization_membrane", "label": "Membrane Pumps Positive Ions Out" },
            { "id": "excess_positive_inside", "label": "Excess Positive Ions Inside" },
            { "id": "neurotransmitters", "label": "Neurotransmitters Role" },
            { "id": "excitatory", "label": "Excitatory Effect" },
            { "id": "inhibitory", "label": "Inhibitory Effect" }
        ],
        "edges": [
            { "source": "A", "target": "B" },
            { "source": "B", "target": "C" },
            { "source": "positive_ions", "target": "depolarization_membrane" },
            { "source": "depolarization_membrane", "target": "positive_outside" },
            { "source": "repolarization_membrane", "target": "excess_positive_inside" },
            { "source": "neurotransmitters", "target": "excitatory" },
            { "source": "neurotransmitters", "target": "inhibitory" }
        ],
        "styles": {
            "process": {
                "fill": "#f9f",
                "stroke": "#333",
                "stroke-width": "2px"
            }
        }
    }
}

# Streamlit rendering of Mermaid diagram and JSON
st.title("Neuron Action Potential Diagram")

# Mermaid Diagram
st.subheader("Mermaid Diagram")
st.markdown(f"```mermaid\n{mermaid_diagram}\n```")

# JSON Representation
st.subheader("JSON Representation")
st.json(diagram_json)