About the Project
Inspired by the growing complexity of regulatory landscapes and their direct impact on financial markets, RegAI Portfolio Analyzer was born during the 2025 Datathon. Our goal: empower investors and analysts to transform dense, multilingual regulatory texts—whether EU directives, US laws, or Chinese energy policies—into actionable portfolio insights in minutes.
We started with a simple question: How can AI help investors anticipate regulatory risk before it hits the market? The answer became a full-stack Streamlit application that:
- Loads S&P 500 composition and performance data via secure file upload,
- Parses real-world regulatory documents (HTML, XML, TXT) from any jurisdiction,
- Extracts key entities, dates, measures, and regulatory type using robust pattern matching,
- Maps regulatory exposure to sectors (tech, energy, pharma, AI, consumer),
- Quantifies risk scores and estimated financial impact at the stock and portfolio level,
- Delivers interactive visualizations and strategic reallocation recommendations.
What We Learned
- Multilingual parsing is hard — HTML/XML noise, non-Latin scripts, and legal jargon required aggressive cleaning and adaptive regex.
- Regulatory impact is contextual — a single keyword like "AI" means promotion in Japan but risk classification in the EU.
- Explainability matters in finance — every risk score is traceable to a specific entity and document.
- Streamlit + session state = powerful prototyping — we built a multi-step, persistent workflow in under 48 hours.
How We Built It
- Frontend: Streamlit with sidebar navigation and
session_statefor seamless multi-step UX. - Data Layer: Modular
data_loader.pyfor S&P 500 ingestion and derived metrics (Op. Margin, Net Margin). - NLP Engine:
reg_analysis.pywith HTML/XML-aware text cleaning, expanded regex for entities/measures, and dynamic sector mapping. - Risk Model: Exposure × similarity × severity, applied to top-weighted stocks.
- Visualization: Plotly bar charts and scenario simulations (+/-20% impact).
Challenges We Faced
- Over-extraction: Page numbers and section IDs were misread as dates → fixed with stricter date patterns.
- False positives: "AI" appeared in unrelated contexts → improved with context-aware type inference.
- Multilingual gaps: Japanese/Chinese terms initially missed → added key phrases and fallback cleaning.
- File persistence: Users lost data between steps → solved with sidebar uploaders and
session_state.
In the end, RegAI isn’t just a tool — it’s a blueprint for regulatory intelligence at scale, ready to integrate with AWS Bedrock, SEC 10-K filings, or real-time news feeds. From the Inflation Reduction Act to the EU AI Act, we proved that any regulation can be quantified, visualized, and acted upon.
Built With
- and-financial-metric-calculations.-**plotly-express**-?-dynamic-bar-charts-for-risk-visualization-across-s&p-500-stocks.-**regular-expressions-(re)**-?-custom-nlp-for-extracting-entities
- and-measures-from-unstructured-regulatory-texts-(html/xml/txt).-**xml-elementtree**-?-lightweight-parsing-of-xml-structured-laws-(e.g.
- and-modeling.-**streamlit**-?-interactive-web-app-with-multi-step-ux
- and-real-time-visualizations.-**pandas**-?-data-loading
- cleaning
- comprehend-(ner)
- dates
- file-uploads
- inflation-reduction-act).-**streamlit-`session-state`**-?-persistent-data-flow-across-app-steps-without-re-uploading-files.-**github**-?-version-control-and-collaborative-development.-**local-development-environment**-?-vs-code
- merging
- natural-language-processing
- pandas
- plotly-express
- python
- python-3.9+
- regular-expressions
- s3-(storage)
- streamlit
- virtualenv.-*future-ready-for-aws-integration:-bedrock-(llm-reasoning)
- xml-elementtree
Log in or sign up for Devpost to join the conversation.