How yao-mxu/discrimination_reporting works
Project Type & Purpose
• This is a full-stack R Shiny application for interactive descriptive analytics of employment discrimination data in California. Users point their browsers to a Shiny server, explore time-series charts, correlation matrices, and access static resources (PDFs).
File Structure
Top-level files:
• app.R, ui.R, server.R – Core Shiny entry points and logic
• Interactive_Descriptives_*.R – Archived scripts for data prep/visual exploration
• reporting_test_*.RData – Pre-processed datasets loaded by server.R
• www/ – Static assets (flowchart.pdf) served by Shiny
• Law/ – Static reference documents (PDFs/RTF)
• README.md – High-level description, flowcharts, feature list
Extract Architectural Insights from README
• Reactive UI inputs trigger server computations
• Plots and tables generated on the fly (ggplot2, dplyr, plotly?)
• Links to external DFEH resources
• Single-page, tabbed UI
Main Components & Their Relationships
A. Client (Web Browser)
• Sends HTTP/WebSocket requests to Shiny
• Renders HTML/CSS/JS returned by Shiny
B. Shiny Server (R Process)
• UI Layer (ui.R/app.R) – defines input controls & layout
• Server Layer (server.R/app.R) – reactive expressions, data loading, plotting functions
• Static Asset Handler – serves www/ folder contents
C. Data Store
• reporting_test_*.RData files loaded at startup
• Optional: raw data pipelines (Interactive_Descriptives_*.R scripts) run offline
D. External Services
• DFEH official website (links in UI)
• GitHub repository (for code updates, flowchart.png)
Interactions:
1. Browser → Shiny Server (user input events)
2. Server → Data Store (load RData, query in-memory data frames)
3. Server → UI (push updated plots/tables via reactive outputs)
4. UI → External Links (DFEH website in new tabs)
Architectural Patterns & Technologies
• MVC-like pattern: ui.R (view), server.R (controller), RData (model)
• Reactive programming (Shiny’s reactive, observeEvent)
• ggplot2/dplyr for data transformation & visualization
• Static asset hosting via www/
Detailed Component Breakdown (to include
1. Client
• Browser (HTML/CSS/JS)
• Shiny’s websocket connection
2. Shiny Server Process
• UI Definition (ui.R / app.R)
• Server Logic (server.R / app.R)
• Reactive Engine (reactive(), observeEvent())
• Static File Handler (serves www/)
3. Data Layer
• reporting_test_*.RData (pre-loaded data frames)
• Interactive_Descriptives_*.R (offline scripts—annotate as “data prep pipeline”)
• Law folder (static PDF references)
4. External Services
• DFEH Official Website
• GitHub asset links
Final Checklist
• Call out major R packages & frameworks
• No “black hole”: every input has a corresponding output or data source