{"id":48064611,"url":"https://github.com/hk-dev13/project-permit-api","last_synced_at":"2026-04-04T14:35:29.126Z","repository":{"id":310313927,"uuid":"1039184073","full_name":"hk-dev13/project-permit-api","owner":"hk-dev13","description":"Environmental Data Verification API","archived":false,"fork":false,"pushed_at":"2025-09-19T19:09:04.000Z","size":24536,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-19T20:55:29.219Z","etag":null,"topics":["ai","api","certifications","cevs","deploy","docker","emissions","environmental-data","global-verification-score","json","permits","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hk-dev13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.md","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-16T16:54:48.000Z","updated_at":"2025-09-19T19:09:07.000Z","dependencies_parsed_at":"2025-09-19T20:17:24.920Z","dependency_job_id":null,"html_url":"https://github.com/hk-dev13/project-permit-api","commit_stats":null,"previous_names":["hk-dev13/project-permit-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hk-dev13/project-permit-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hk-dev13%2Fproject-permit-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hk-dev13%2Fproject-permit-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hk-dev13%2Fproject-permit-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hk-dev13%2Fproject-permit-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hk-dev13","download_url":"https://codeload.github.com/hk-dev13/project-permit-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hk-dev13%2Fproject-permit-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31402959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","certifications","cevs","deploy","docker","emissions","environmental-data","global-verification-score","json","permits","python"],"created_at":"2026-04-04T14:35:28.405Z","updated_at":"2026-04-04T14:35:29.118Z","avatar_url":"https://github.com/hk-dev13.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Envoyou CEVS Aggregator API\n\n[![Python Version](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)\n[![Framework](https://img.shields.io/badge/framework-FastAPI-green.svg)](https://fastapi.tiangolo.com/)\n\u003c!-- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) --\u003e\n![Badge showing license type Business Source License 1.1 in blue color](https://img.shields.io/badge/License-BSL--1.1-blue.svg) \n![Badge showing usage status Non-Commercial in orange color](https://img.shields.io/badge/Use-Non--Commercial-orange.svg)\n![Badge showing re-license to Apache 2.0 scheduled for 2028 in green color](https://img.shields.io/badge/Re--License-Apache%202.0%20(2028)-green.svg)\n![Badge showing project status MVP Global in brightblue color](https://img.shields.io/badge/Status-MVP%20Global-brightblue.svg)\n![Badge showing build passing in success green color](https://img.shields.io/badge/Build-Passing-success.svg)\n\nThe official backend API for the [Envoyou](https://envoyou.com) platform. This service aggregates environmental data from multiple global sources to calculate a **Composite Environmental Verification Score (CEVS)**, providing a standardized metric for corporate environmental performance.\n\n## 📖 Overview\n\nThe CEVS Aggregator API acts as a robust data pipeline and scoring engine. It connects to various official data sources (e.g., EPA, EEA, ISO), normalizes the incoming data into a consistent schema, and applies a sophisticated scoring algorithm to generate the CEVS for a given company.\n\n## 🌍 Project Summary\n\nFor detailed information on all Project, please refer to the official **[Project Summary](PROJECT_SUMMARY.md)**.\n\n## ✨ Key Features\n\n## ✨ Key Features\n\n- **Multi-Source Data Aggregation**: Integrates with key environmental data providers:\n  - **EPA (USA)**: Facility and power plant emissions data (Envirofacts, CAMPD).\n  - **EEA (Europe)**: Industrial pollution and renewable energy statistics.\n  - **EDGAR**: Global urban emissions data.\n  - **ISO**: ISO 14001 certification status (40+ certificates integrated).\n  - **Amdalnet (Indonesia)**: Environmental permits and approvals from KLHK (integrated with dev API).\n- **Composite Environmental Verification Score (CEVS)**: A proprietary scoring model that provides a holistic view of a company's environmental impact and commitment.\n- **Secure API Access**: All critical endpoints are protected by API key authentication.\n- **Frontend Integration Ready**: Pre-configured CORS for React/Vite applications with demo API keys.\n- **Real-time CEVS Scoring**: Live calculation with comprehensive environmental data (score range: 0-100).\n- **Demo API Key System**: Built-in endpoint for generating demo keys for frontend development.\n- **Comprehensive Permit Management**: Full CRUD operations for environmental permits with search and filtering.\n- **Tier-Based Rate Limiting**: Different usage tiers (Basic, Premium) to manage API load.\n- **Robust Caching**: In-memory and file-based caching for improved performance and reduced external API calls.\n- **Standardized Data Schemas**: All data is normalized into a clean, predictable format.\n- **Asynchronous Framework**: Built with FastAPI for high performance and scalability.\n- **Dockerized**: Ready for containerized deployment in any environment.\n\n## 📚 API Documentation\n\nFor detailed information on all available endpoints, request/response formats, and usage examples, please refer to the official **[API Documentation](API_DOCUMENTATION.md)**.\n\n## 🚀 Getting Started\n\n### Prerequisites\n- Python 3.10+\n- Docker \u0026 Docker Compose (Recommended)\n- Node.js 18+ \u0026 npm (for frontend development)\n\n### 1. Environment Setup\n\nFirst, create a `.env` file from the example template:\n\n```bash\ncp .env.example .env\n```\n\n### 2. Installation\n\nInstall the required Python packages:\n\n```bash\npip install -r requirements.txt\n```\n\n### 3. Running the Server\n\n#### Local Development (with Uvicorn)\n\nThe server supports live reloading, which is ideal for development.\n\n```bash\nuvicorn app.api_server:app --reload --port 8000 --log-level debug\n```\n\nThe API will be available at `http://localhost:8000`.\n\n#### Production (with Docker)\n\nUsing Docker is the recommended way to run the application in production.\n\n```bash\n# Build and run the services in the background\ndocker-compose up --build -d\n\n# Check the logs\ndocker-compose logs -f\n\n# Stop the services\ndocker-compose down\n```\n\n## 🌐 Frontend Integration\n\n### React + Vite Setup\n\nThe API is designed to work seamlessly with modern frontend frameworks:\n\n1. **CORS Configuration**: Pre-configured for local development with Vite (port 5173)\n2. **Demo API Keys**: Built-in demo keys for frontend development\n3. **Real-time Data**: Live CEVS scoring with 40+ ISO certificates integration\n\n#### Example Frontend Integration\n\n```javascript\n// vite.config.js\nexport default defineConfig({\n  plugins: [react()],\n  server: {\n    proxy: {\n      '/api': {\n        target: 'http://localhost:8000',\n        changeOrigin: true,\n        rewrite: (path) =\u003e path.replace(/^\\/api/, '')\n      }\n    }\n  }\n})\n```\n\n#### Getting Demo API Key\n\n```javascript\n// Frontend code example\nconst getDemoKey = async () =\u003e {\n  const response = await fetch('/api/admin/request-demo-key', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ tier: 'premium' })\n  });\n  const data = await response.json();\n  return data.api_key;\n};\n```\n\n## 🌍 Amdalnet Integration\n\n### Indonesian Environmental Data\n\nThe API integrates with **Amdalnet** (KLHK - Kementerian Lingkungan Hidup dan Kehutanan) to provide real environmental permit data from Indonesia.\n\n#### Available Endpoints\n- **SK Final**: Environmental permits and approvals\n- **Pemrakarsa**: Business entities with environmental permits\n- **Rencana Usaha**: Business plans and activities\n- **Map Services**: Geographic project boundaries\n\n#### API Configuration\n```bash\n# Set your Amdalnet credentials in .env\nAMDALNET_API_URL=https://amdalnet-dev.kemenlh.go.id\nAMDALNET_API_KEY=your_token_here\nAMDALNET_SSO_USERNAME=your_username\nAMDALNET_SSO_PASSWORD=your_password\n```\n\n#### Getting API Access\n1. **Register** at [Amdalnet SSO](https://amdalnet-dev.kemenlh.go.id)\n2. **Login** to get authentication token\n3. **Configure** token in environment variables\n4. **Test** integration with `/permits` endpoint\n\n#### Example Usage\n```python\nfrom app.clients.amdalnet_client import AmdalnetClient\n\n# Initialize client\nclient = AmdalnetClient(api_key=\"your_token\")\n\n# Get environmental permits\npermits = client.get_sk_final(page=1, limit=50)\nprint(f\"Found {len(permits)} permits\")\n```\n\n## ⚙️ Configuration\n\nThe application is configured via environment variables, which are loaded by `pydantic-settings` from the `.env` file. Key configuration options are defined in `app/config.py`.\n\n- `PORT`: The port the server will run on.\n- `LOG_LEVEL`: The logging level (e.g., `DEBUG`, `INFO`, `WARNING`).\n- `API_KEYS`: A comma-separated list of valid API keys and their tiers.\n- `CAMPD_API_KEY`: Your API key for the EPA CAMPD service.\n- `*_XLSX_PATH`: Paths to local reference data files (EDGAR, ISO, Policy).\n\n## 🧪 Running Tests\n\nThe project uses `pytest` for testing.\n\n```bash\npytest\n```\n---\n## Contributing\nPull requests are welcome. For major changes, please open an [issue](https://github.com/hk-dev13/project-permit-api/issues) first to discuss what you would like to change.\n\n---\n## License\nThis project is released under the **Business Source License 1.1 (BSL-1.1)**.  \n- Non-commercial use only.  \n- Will be automatically re-licensed to **Apache 2.0** in 2028.  \n- See the [LICENSE](LICENSE) file for details.\n\n\u003c!-- ### Badges\n![License: BSL-1.1](https://img.shields.io/badge/License-BSL--1.1-blue.svg)\n![Use: Non-Commercial](https://img.shields.io/badge/Use-Non--Commercial-orange.svg)\n![Re-License: Apache 2.0 (2028)](https://img.shields.io/badge/Re--License-Apache%202.0%20(2028)-green.svg)\n![Status: MVP Global](https://img.shields.io/badge/Status-MVP%20Global-brightblue.svg)\n![Build: Passing](https://img.shields.io/badge/Build-Passing-success.svg) --\u003e\n\n## Acknowledgements\n- [FastAPI](https://fastapi.tiangolo.com/)  \n- [Uvicorn](https://www.uvicorn.org/)  \n- [Pydantic](https://docs.pydantic.dev/)  \n\n## Contact\nMaintained by [Husni Kusuma](https://github.com/hk-dev13)  \n🌐 Website: [envoyou.com](https://envoyou.com)  \n📧 More info: [info@envoyou.com](mailto:info@envoyou.com)  \n\n---\n\u003e \u003cp style=\"text-align: center;\"\u003e© 2025 \u003ca href=\"https://envoyou.com\"\u003eEnvoyou\u003c/a\u003e | All Rights Reserved\u003c/p\u003e\n\u003e \u003cp style=\"text-align: center;\"\u003eEmpowering Global Environmental Transparency\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhk-dev13%2Fproject-permit-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhk-dev13%2Fproject-permit-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhk-dev13%2Fproject-permit-api/lists"}