├── jalan_rusak.csv ├── main.py └── LICENSE /jalan_rusak.csv: -------------------------------------------------------------------------------- 1 | id,lokasi,tingkat_kerusakan,waktu 2 | 1,"Jl. Arkham, Gotham",3,"2025-04-25 08:30" 3 | 2,"Jl. Rizzler, Baddie",2,"2025-04-25 09:10" 4 | 3,"Jl. Prof Dr Hamka, UNP",4,"2025-04-25 09:15" 5 | 4,"Jl. Hidup, Nasib",5,"2025-04-25 09:35" 6 | 5,"Jl. Amba, Ngawi",1,"2025-04-25 09:45" 7 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import time 3 | import matplotlib.pyplot as plt 4 | from datetime import datetime 5 | 6 | df = pd.read_csv("jalan_rusak.csv", parse_dates=["waktu"]) 7 | 8 | def analisis_kerusakan(data): 9 | print("\nANALISIS REAL-TIME") 10 | print(f"Total laporan: {len(data)}") 11 | 12 | rata = data["tingkat_kerusakan"].mean() 13 | print(f"Rata-rata tingkat kerusakan: {rata:.2f}") 14 | 15 | top_lokasi = data["lokasi"].value_counts().head(1) 16 | print("Lokasi paling sering dilaporkan:") 17 | print(top_lokasi) 18 | 19 | data.groupby("lokasi")["tingkat_kerusakan"].mean().sort_values().plot(kind="barh", title="Tingkat Kerusakan per Lokasi") 20 | plt.xlabel("Tingkat Kerusakan Rata-Rata") 21 | plt.tight_layout() 22 | plt.show() 23 | 24 | print("Memulai analisis...\n") 25 | current_data = pd.DataFrame(columns=df.columns) 26 | 27 | for i in range(len(df)): 28 | current_data = pd.concat([current_data, df.iloc[[i]]]) 29 | 30 | analisis_kerusakan(current_data) 31 | 32 | time.sleep(5) 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | --------------------------------------------------------------------------------