Skip to content

Commit

Permalink
Aplicando as mudanças da branch Google-sheets:
Browse files Browse the repository at this point in the history
* Mudando as datas da página 4 de datetime para objects, consertando os bugs relacionados
* Adicionando os dropdowns para escolher as disciplinas e professores.
  • Loading branch information
Oesterd committed Mar 6, 2024
1 parent 65ba54f commit e14eaef
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/Reusables/Dist_notas.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

{'field': 'Resultado'},

{'field': 'Professor'}
{'field': 'Professor', 'filter': False},


]
Expand Down
172 changes: 86 additions & 86 deletions src/Reusables/Sidebars.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,93 +15,91 @@
def pg1():
content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),
html.Div([
dmc.MultiSelect(id='Mdropdown11', label='Escolha o(s) professor(es):', value=[],
data=Prof_Notas, searchable=True, clearable=True),
]
),

html.Div([
dmc.Select(id='dropdown11', label='Escolha o eixo x:', value='Média aluno',
data=list(Ops2.keys()), clearable=False),
]
),
html.Div([
dmc.Select(id='dropdown11', label='Escolha o eixo x:', value='Média aluno',
data=list(Ops2.keys()), clearable=False),
]
),

html.Div([
html.Div([

dmc.Select(id='dropdown12', label='Divisão por cores:', value=None,
data=[
{'label': 'Nenhuma', 'value': None},
{'label': 'Professor', 'value': 'Professor'}
], clearable=False),
]
),
dmc.Select(id='dropdown12', label='Divisão por cores:', value=None,
data=[
{'label': 'Nenhuma', 'value': None},
{'label': 'Professor', 'value': 'Professor'}
], clearable=False),
]
),

html.Div([
dmc.Select(data=list(Ops.keys()), label='Divisão por colunas:', value='Nenhuma',
id='dropdown13', clearable=False),
]
),
html.Div([
dmc.Select(data=list(Ops.keys()), label='Divisão por colunas:', value='Nenhuma',
id='dropdown13', clearable=False),
]
),

html.Div([
dmc.Select(id='dropdown14', label='Divisão por linhas:', value='Nenhuma',
data=['Nenhuma', 'Gênero', 'Etnia', 'Escola'],
clearable=False),
]
),
html.Div([
dmc.Select(id='dropdown14', label='Divisão por linhas:', value='Nenhuma',
data=['Nenhuma', 'Gênero', 'Etnia', 'Escola'],
clearable=False),
]
),

html.Div([
dmc.Select(id='dropdown15', label='Tipo de gráfico:', value='Histograma',
data=['Histograma', 'Cumulativo'],
clearable=False),
]
),
html.Div([
dmc.Select(id='dropdown15', label='Tipo de gráfico:', value='Histograma',
data=['Histograma', 'Cumulativo'],
clearable=False),
]
),

html.Div([
dmc.Select(
id='dropdown16', label='Tipo de normalização:', value=None,
data=[
{'label': 'Contagem', 'value': None},
{'label': 'Porcentagem', 'value': 'percent'},
],
clearable=False
)
]),
html.Div([
dmc.Select(
id='dropdown16', label='Tipo de normalização:', value=None,
data=[
{'label': 'Contagem', 'value': None},
{'label': 'Porcentagem', 'value': 'percent'},
],
clearable=False
)
]),
],
style={'display': 'flex', 'flexDirection': 'column', 'gap': 20, 'flex': 1},
)

return content




def pg2():
content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
html.Div([
dmc.MultiSelect(id='Mdropdown21', label='Escolha o(s) professor(es):', value=[],
data=Prof_Notas, searchable=True, clearable=True),
]
),

html.Div([
html.Div([
dmc.Select(id='dropdown20', label='Escolha o eixo x:', value='Renda (R$)',
data=['Renda (R$)', 'Frequência'], clearable=False)
]),
dmc.Select(id='dropdown21', label='Escolha o eixo x:', value='Renda (R$)',
data=['Renda (R$)', 'Frequência'], clearable=False)
]),

html.Div([
dmc.Select(data=list(Ops.keys()), label='Divisão por colunas:', value='Nenhuma', id='dropdown21', clearable=False),
dmc.Select(data=list(Ops.keys()), label='Divisão por colunas:', value='Nenhuma', id='dropdown22', clearable=False),
]),

html.Div([
dmc.Select(id='dropdown22', label='Divisão por linhas:', value='Nenhuma', data=['Nenhuma', 'Gênero', 'Escola'], clearable=False),
dmc.Select(id='dropdown23', label='Divisão por linhas:', value='Nenhuma', data=['Nenhuma', 'Gênero', 'Escola'], clearable=False),
]),

html.Div([
dmc.Select(id='dropdown23', label='Regressão linear:', value=None,
dmc.Select(id='dropdown24', label='Regressão linear:', value=None,
data=[
{'label': 'Nenhuma', 'value': None},
{'label': 'Linear', 'value': 'ols'},
Expand All @@ -113,7 +111,7 @@ def pg2():

html.Div([
dmc.Select(
id='dropdown24', label='Escopo da regressão linear:', value='overall',
id='dropdown25', label='Escopo da regressão linear:', value='overall',
data=[
{'label': 'Geral', 'value': 'overall'},
{'label': 'Legenda', 'value': 'trace'},
Expand All @@ -128,16 +126,11 @@ def pg2():
return content




def pg3():
content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),

html.Div([
dmc.Select(
id='dropdown31', label='Tipo de gráfico:', value='stpf',
Expand All @@ -154,47 +147,55 @@ def pg3():




def pg4():

content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),
html.Div([
dmc.MultiSelect(id='Mdropdown41', label='Escolha a(s) disciplina(s)', value=[],
data=Disc, searchable=True, clearable=True)
]),

html.Div([
dmc.MultiSelect(id='Mdropdown42', label='Escolha o(s) professor(es)', value=[],
data=Prof_turmas, searchable=True, clearable=True)
]),


html.Div([
dmc.Select(id='dropdown41', label='Escolha o eixo y:', value='Média turma',
data=['Média turma', 'AP', 'RM', 'RF', 'RMF'], clearable=False),
]),
]
],
style={'display': 'flex', 'flexDirection': 'column', 'gap': 20, 'flex': 1}
)

return content




def pg5():
content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),

html.Div([
dmc.MultiSelect(id='Mdropdown51', label='Escolha a(s) disciplina(s)', value=[],
data=Disc, searchable=True, clearable=True)
]),


html.Div([
html.Div([
dmc.Select(id='dropdown51', label='Escolha o eixo y:', value='Média turma',
data=['Média turma', 'AP', 'RM', 'RF', 'RMF'], clearable=False),
]),
dmc.MultiSelect(id='Mdropdown52', label='Escolha o(s) professor(es)', value=[],
data=Prof_turmas, searchable=True, clearable=True)
]),


html.Div([
dmc.Select(id='dropdown51', label='Escolha o eixo y:', value='Média turma',
data=['Média turma', 'AP', 'RM', 'RF', 'RMF'], clearable=False),
]),


html.Div([
dmc.Select(id='dropdown52', label='Regressão linear:', value=None,
Expand All @@ -219,8 +220,7 @@ def pg5():

],
style={'display': 'flex', 'flexDirection': 'column', 'gap': 20, 'flex': 1}
),
)

return content


14 changes: 4 additions & 10 deletions src/Reusables/Turmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@

{'field': 'Código', "sortable": True},

{'field': 'Disciplina', "sortable": True},
{'field': 'Disciplina', "sortable": True, 'filter': False},

{'field': 'Professor', "sortable": True, 'filter': False},

{'field': 'Turma', "sortable": True, 'sort': 'asc',
# "valueGetter": {"function": date_obj},
# "valueFormatter": {"function": f"d3.timeFormat('%Y/%m/%d')({date_obj})"},
# "filter": "agDateColumnFilter"
'filterParams': {'buttons': ['reset']}
},

{'field': 'Professor', "sortable": True},

{'field': 'Av Professor',
'valueFormatter': gradeformat,
'filter': 'agNumberColumnFilter'},
Expand Down Expand Up @@ -59,10 +57,6 @@
'cellClass': 'center-aligned-cell',
'resizable': True,
'filter': True,
'filterParams': {
"alwaysShowBothConditions": True,
},
'floatingFilter': True,
'suppressMenu': True,
}

28 changes: 26 additions & 2 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,23 @@
server = app.server



Dados_notas = pd.read_excel('https://github.com/Oesterd/Dash-learning-analytics/raw/master/dados_teste.xlsx')
Prof_Notas = Dados_notas['Professor'].unique()
Notas_df = Dados_notas.iloc[:, 0:10]

Notas_df = Notas_df.to_dict('records')


Turmas_df = pd.read_excel('https://github.com/Oesterd/Dash-learning-analytics/raw/master/Dados_turma.xlsx')

Disc = Turmas_df['Disciplina'].unique()
Prof_turmas = Turmas_df['Professor'].unique()
Disc.sort(), Prof_turmas.sort()

Turmas_df['Turma'] = pd.to_datetime(Turmas_df['Turma'], format='%Y/%m')
Turmas_df['Turma'] = Turmas_df['Turma'].dt.date

Turmas_df = Turmas_df.to_dict('records')


Expand Down Expand Up @@ -149,8 +160,21 @@
id='sidebar',
fixed=False,
hidden=True,
height=800,
width={"base": navwidth},
position='right',
children=[
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),

html.Br(),

html.Div(id='sidebar-div', children=[])
],
style={
"overflow": "hidden",
"transition": "width 0.3s ease-in-out",
Expand Down Expand Up @@ -216,7 +240,7 @@ def drawer_demo(opened, width):


@callback(
Output('sidebar', 'children'),
Output('sidebar-div', 'children'),
Output('Intervalo', 'n_intervals'),
State('Intervalo', 'n_intervals'),
Input('url', 'pathname'),
Expand All @@ -243,4 +267,4 @@ def nav_content(n, url):


if __name__ == "__main__":
app.run(debug=True, host="localhost")
app.run(debug=False, host="0.0.0.0")
15 changes: 11 additions & 4 deletions src/pages/pg1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Importando as bibliotecas
import time

import dash
from dash import html, dcc, Input, Output, State, callback, clientside_callback, ctx
import dash_ag_grid as dag
Expand Down Expand Up @@ -90,11 +88,20 @@ def drop4init(options14, options15):
# -------------------------------------------------------------------------------------
@callback(
Output('grid', 'rowData'),
Input(component_id='Intervalo', component_property='n_intervals'),
Input('Dados_notas', 'data'),
Input(component_id='Mdropdown11', component_property='value'),
)


def Grid_maker(data):
def Grid_maker(n, data, mdrop):
dff = pd.DataFrame(data)

if mdrop:
dff = dff[dff['Professor'].isin(mdrop)]

data = dff.to_dict('records')

return data


Expand Down Expand Up @@ -152,4 +159,4 @@ def matplot_html(n, rows, drop1, drop2, drop3, drop4, drop5, drop6):
)


return fig
return fig
Loading

0 comments on commit e14eaef

Please sign in to comment.