|
import streamlit as st |
|
from data_cleaning import DataCleaner |
|
from visualization import VisualizationSelector |
|
from data_analysis import DataAnalyzer |
|
from report_generator import ReportGenerator |
|
from api_integration import APIConnector |
|
from natural_language_query import NLQueryEngine |
|
from predictive_analytics import PredictiveAnalytics |
|
from anomaly_detection import AnomalyDetector |
|
from time_series_forecasting import TimeSeriesForecaster |
|
from geospatial_visualization import GeospatialVisualizer |
|
from sentiment_analysis import SentimentAnalyzer |
|
from data_storytelling import DataStoryteller |
|
from data_privacy import DataPrivacyTool |
|
import pandas as pd |
|
|
|
class DataAutomationApp: |
|
def __init__(self): |
|
self.data = None |
|
self.cleaner = DataCleaner() |
|
self.visualizer = VisualizationSelector() |
|
self.analyzer = DataAnalyzer() |
|
self.report_generator = ReportGenerator() |
|
self.api_connector = APIConnector() |
|
self.nl_query_engine = NLQueryEngine() |
|
self.predictive_analytics = PredictiveAnalytics() |
|
self.anomaly_detector = AnomalyDetector() |
|
self.time_series_forecaster = TimeSeriesForecaster() |
|
self.geospatial_visualizer = GeospatialVisualizer() |
|
self.sentiment_analyzer = SentimentAnalyzer() |
|
self.data_storyteller = DataStoryteller() |
|
self.data_privacy_tool = DataPrivacyTool() |
|
|
|
def load_data(self, file): |
|
if file.name.endswith('.csv'): |
|
self.data = pd.read_csv(file) |
|
elif file.name.endswith(('.xls', '.xlsx')): |
|
self.data = pd.read_excel(file) |
|
else: |
|
st.error("Unsupported file format. Please upload a CSV or Excel file.") |
|
|
|
def run(self): |
|
st.title("Data Automation and Visualization App") |
|
|
|
|
|
uploaded_file = st.file_uploader("Choose a CSV or Excel file", type=["csv", "xlsx"]) |
|
if uploaded_file is not None: |
|
self.load_data(uploaded_file) |
|
if self.data is not None: |
|
st.success("Data loaded successfully!") |
|
|
|
|
|
if st.button("Clean Data"): |
|
self.data = self.cleaner.clean(self.data) |
|
st.write(self.data.head()) |
|
|
|
|
|
if st.button("Generate Visualizations"): |
|
visualizations = self.visualizer.select_visualizations(self.data) |
|
for viz in visualizations: |
|
st.pyplot(viz) |
|
|
|
|
|
if st.button("Analyze Data"): |
|
insights = self.analyzer.analyze(self.data) |
|
st.write(insights) |
|
|
|
|
|
query = st.text_input("Ask a question about your data:") |
|
if query: |
|
result = self.nl_query_engine.process_query(query, self.data) |
|
st.write(result) |
|
|
|
|
|
if st.button("Run Predictive Analytics"): |
|
prediction = self.predictive_analytics.predict(self.data) |
|
st.write(prediction) |
|
|
|
|
|
if st.button("Detect Anomalies"): |
|
anomalies = self.anomaly_detector.detect(self.data) |
|
st.write(anomalies) |
|
|
|
|
|
if st.button("Forecast Time Series"): |
|
forecast = self.time_series_forecaster.forecast(self.data) |
|
st.write(forecast) |
|
|
|
|
|
if st.button("Geospatial Visualization"): |
|
geo_viz = self.geospatial_visualizer.visualize(self.data) |
|
st.pyplot(geo_viz) |
|
|
|
|
|
if st.button("Analyze Sentiment"): |
|
sentiment = self.sentiment_analyzer.analyze(self.data) |
|
st.write(sentiment) |
|
|
|
|
|
if st.button("Generate Data Story"): |
|
story = self.data_storyteller.generate_story(self.data) |
|
st.write(story) |
|
|
|
|
|
if st.button("Check Data Privacy"): |
|
privacy_report = self.data_privacy_tool.check_privacy(self.data) |
|
st.write(privacy_report) |
|
|
|
|
|
if st.button("Generate Report"): |
|
report = self.report_generator.generate(self.data) |
|
st.download_button( |
|
label="Download Report", |
|
data=report, |
|
file_name="data_report.txt", |
|
mime="text/plain" |
|
) |
|
|
|
if __name__ == "__main__": |
|
app = DataAutomationApp() |
|
app.run() |