diff --git a/scripts/data_viz.py b/scripts/data_viz.py new file mode 100644 index 0000000..b0b75a7 --- /dev/null +++ b/scripts/data_viz.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +import dash +import dash_core_components as dcc +import dash_html_components as html +import pandas as pd + +external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] + +app = dash.Dash(__name__, external_stylesheets=external_stylesheets) + +students = pd.read_csv('../data/students.csv') + +nb2015 = len(students[students.promotion.isin([2015])]) +nb2016 = len(students[students.promotion.isin([2016])]) +nb2017 = len(students[students.promotion.isin([2017])]) +nb2018 = len(students[students.promotion.isin([2018])]) +nb2019 = len(students[students.promotion.isin([2019])]) +nb2020 = len(students[students.promotion.isin([2020])]) +nb2021 = len(students[students.promotion.isin([2021])]) + +app.layout = html.Div(children=[ + html.H1(children='Hetic console'), + + html.Div(children=''' + Agrégateur d'OSINT pour l'intranet d'HETIC, OGP et OGI compris. + '''), + + dcc.Graph( + id='graph1', + figure={ + 'data': [ + {'x': ['P2015', 'P2016', 'P2017', 'P2018', 'P2019', 'P2020', 'P2021'], 'y': [nb2015, nb2016, nb2017, nb2018, nb2019, nb2020, nb2021], 'type': 'bar', 'name': 'Étudiants'}, + ], + 'layout': { + 'title': 'Évolution du nombre d\'étudiants dans chaque promotions' + } + } + ), + + dcc.Graph( + id='graph2', + figure={ + 'data': [ + {'x': ['P2019', 'P2020', 'P2021'], 'y': [120, 110, 98], 'type': 'bar', 'name': 'WEB1'}, + {'x': ['P2019', 'P2020', 'P2021'], 'y': [80, 90, 88], 'type': 'bar', 'name': 'WEB2'}, + {'x': ['P2019', 'P2020', 'P2021'], 'y': [74, 86, 81], 'type': 'bar', 'name': 'WEB3'}, + ], + 'layout': { + 'title': 'Évolution du nombre d\'étudiants dans chaque promotions par cursus' + } + } + ) +]) + +if __name__ == '__main__': + app.run_server(debug=False) diff --git a/scripts/investigate_emails.py b/scripts/investigate_emails.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/requirements.txt b/scripts/requirements.txt new file mode 100644 index 0000000..77ca085 --- /dev/null +++ b/scripts/requirements.txt @@ -0,0 +1,2 @@ +dash +pandas \ No newline at end of file diff --git a/scripts/table.py b/scripts/table.py new file mode 100644 index 0000000..3d90df2 --- /dev/null +++ b/scripts/table.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +import dash +import dash_core_components as dcc +import dash_html_components as html +import pandas as pd + +external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] + +app = dash.Dash(__name__, external_stylesheets=external_stylesheets) + +students = pd.read_csv('../data/students.csv') + +def generate_table(dataframe, max_rows=300): + return html.Table( + # Header + [html.Tr([html.Th(col) for col in dataframe.columns])] + + + # Body + [html.Tr([ + html.Td(dataframe.iloc[i][col]) for col in dataframe.columns + ]) for i in range(min(len(dataframe), max_rows))] + ) + +app.layout = html.Div(children=[ + html.H1(children='Hetic console'), + + html.Div(children=''' + Agrégateur d'OSINT pour l'intranet d'HETIC, OGP et OGI compris. + '''), + + generate_table(students) +]) + +if __name__ == '__main__': + app.run_server(debug=False)