An AI-powered web application that automatically extracts comprehensive metadata from data sources using Groq's browser automation capabilities. It identifies license information, geographic coverage, temporal coverage, and links to relevant data pages by intelligently navigating through websites.
- Intelligent URL Detection - Automatically finds official data source URLs from source names
- Multi-Page Navigation - Browser automation explores linked pages for comprehensive extraction
- Structured Metadata Extraction - License, geographic, and temporal coverage
- Data Commons Integration - Statistical variable search and entity property lookup
- Country DCID Mapping - Automatic linking of countries to Data Commons identifiers
- Retry Mechanism - Exponential backoff for transient failures
- Progress Tracking - Visual progress bar and status updates
- Export Capability - Download results as structured JSON
- Python 3.10+ (Python 3.11 or 3.12 recommended)
- Groq API Key - Required for browser automation and metadata extraction
- Data Commons API Key (Optional) - For entity property lookup features
git clone https://github.com/dipankaratriya-cloud/data_commons.git
cd data_commons# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activatepip install -r requirements.txtThis will install the following packages:
groq>=0.4.0- Groq API client for browser automationpython-dotenv>=1.0.0- Environment variable managementstreamlit>=1.28.0- Web application frameworkrequests>=2.31.0- HTTP client for API callsbeautifulsoup4>=4.12.0- HTML parsinglxml>=4.9.0- XML/HTML processing
- Create a
.envfile in the project root directory:
# Copy the example (if available) or create a new file
touch .env- Add your API keys to the
.envfile:
# Required - Get your Groq API key from https://console.groq.com/keys
GROQ_API_KEY=your_groq_api_key_here
# Optional - Get your Data Commons API key from https://apikeys.datacommons.org
DC_API_KEY=your_data_commons_api_key_here- Visit https://console.groq.com/keys
- Sign up or log in to your account
- Create a new API key
- Copy the key and add it to your
.envfile
- Visit https://apikeys.datacommons.org
- Request an API key
- Once approved, add it to your
.envfile
# Make sure your virtual environment is activated
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # Windows
# Run the Streamlit application
streamlit run license_finder_app.pyThe application will start and open in your default web browser at http://localhost:8501.
streamlit run license_finder_app.py --server.port 8080streamlit run license_finder_app.py --server.headless truedocker build -t metadata-extractor .# Run with environment variables
docker run -p 8080:8080 \
-e GROQ_API_KEY=your_groq_api_key \
-e DC_API_KEY=your_dc_api_key \
metadata-extractorCreate a docker-compose.yml file:
version: '3.8'
services:
metadata-extractor:
build: .
ports:
- "8080:8080"
environment:
- GROQ_API_KEY=${GROQ_API_KEY}
- DC_API_KEY=${DC_API_KEY}Run with:
docker-compose up-
Enter a Source Name or URL
- Source name: e.g., "Statistics Canada", "French Open Data Portal"
- Direct URL: e.g., "https://data.gov.uk"
-
Add a Description (required for source names)
- Describe what information you're looking for
- Example: "Find license type, geographic coverage, and date range for this education dataset"
-
Click "Extract Metadata"
- The app will search for the URL (if source name given)
- Browser automation will navigate the website
- Metadata will be extracted and displayed
-
View Results
- Summary: Complete extracted information
- License: License type, URL, attribution requirements
- Place/Geographic: Countries, regions, place types
- Date Range/Temporal: Coverage period, update frequency
- Browser Sessions: Details of automation sessions
-
Download Results
- Click "Download Results as JSON" to save the extraction
-
Search Statistical Variables
- Enter a search term (e.g., "agriculture", "population", "income")
- Click "Search Statistical Variables"
-
View Results
- See matching statistical variables from Data Commons
- View constraint properties for each variable
- Click links to view in Data Commons browser
data_commons/
├── license_finder_app.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── .env # Environment variables (create this)
├── README.md # This file
├── ARCHITECTURE.md # Detailed architecture documentation
└── src/
├── __init__.py
├── orchestrator.py # Extraction orchestrator with validation
├── utils/
│ ├── __init__.py
│ ├── groq_browser_automation.py # Core browser automation client
│ ├── groq_browser_client.py # Alternative browser client
│ └── auth.py # Authentication utilities
└── extractors/
├── __init__.py
├── license_extractor.py # License extraction
├── place_extractor.py # Place/geographic extraction
└── temporal_extractor.py # Temporal extraction
- Model:
groq/compound - Features Used: Browser automation, web search
- Documentation: https://groq.com/docs
- Endpoints Used:
/v2/sparql- SPARQL queries for entity search/v2/node- Fetch entity properties/v2/resolve- Resolve entity names to DCIDs/v2/find- Search for entities by query
- Documentation: https://docs.datacommons.org/api
- Ensure you have created a
.envfile in the project root - Verify
GROQ_API_KEYis set correctly - Check there are no extra spaces or quotes around the key
- Wait for the specified time before retrying
- Consider upgrading your Groq plan for higher limits
- Try simpler URLs that require less processing
- Use the main website URL instead of specific data tables
- Try a simpler page with less content
- Increase the timeout in the sidebar (if available)
- Try the homepage instead of deep-linked pages
- Verify the website is accessible
- Try a more specific source name
- Enter the URL directly instead of a source name
- Check if the website is publicly accessible
To see detailed logs, run Streamlit with debug logging:
streamlit run license_finder_app.py --logger.level debug| Setting | Value |
|---|---|
| Model | groq/compound |
| Timeout | 240 seconds (4 minutes) |
| Max Retries | 3 |
| Temperature | 0.1 |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source. See the repository for license details.
For issues and feature requests, please open an issue on GitHub: https://github.com/dipankaratriya-cloud/data_commons/issues
Built with Streamlit and powered by Groq Browser Automation