{"id":25449741,"url":"https://github.com/devjefster/pmqc-api","last_synced_at":"2026-02-09T07:33:01.260Z","repository":{"id":278017649,"uuid":"934253280","full_name":"devjefster/pmqc-api","owner":"devjefster","description":"A Go-based REST API for fetching and storing PMQC (Programa de Monitoramento da Qualidade dos Combustíveis) data from the Brazilian government","archived":false,"fork":false,"pushed_at":"2025-02-17T14:27:51.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T12:56:14.970Z","etag":null,"topics":["gin","golang","pmqc","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devjefster.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}},"created_at":"2025-02-17T14:24:39.000Z","updated_at":"2025-02-17T14:44:33.000Z","dependencies_parsed_at":"2025-02-17T15:41:58.474Z","dependency_job_id":null,"html_url":"https://github.com/devjefster/pmqc-api","commit_stats":null,"previous_names":["devjefster/pmqc-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devjefster/pmqc-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2Fpmqc-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2Fpmqc-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2Fpmqc-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2Fpmqc-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devjefster","download_url":"https://codeload.github.com/devjefster/pmqc-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2Fpmqc-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29258758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["gin","golang","pmqc","rest-api"],"created_at":"2025-02-17T21:17:31.684Z","updated_at":"2026-02-09T07:33:01.243Z","avatar_url":"https://github.com/devjefster.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"`# 🚀 PMQC API\n\n### A Go-based REST API for fetching and storing **PMQC (Programa de Monitoramento da Qualidade dos Combustíveis)** data from the Brazilian government.\n\n## 📌 Features\na\n- ✅ Fetches PMQC JSON data from the **ANP API** (Agência Nacional do Petróleo)\n- ✅ Stores PMQC data in **PostgreSQL**\n- ✅ Uses **Gin** for REST API routing\n- ✅ Implements **Swagger (OpenAPI) documentation**\n- ✅ Supports **parallel fetching \u0026 batch inserts**\n- ✅ Includes **logging \u0026 retries for robustness**\n- ✅ Uses **Docker \u0026 Docker Compose** for easy deployment\n\n---\n## 🛠️ **Installation \u0026 Setup**\n\n### **1️⃣ Clone the Repository**\n```sh\ngit clone https://github.com/devjefster/pmqc-api.git\ncd pmqc-api` \n```\n### **2️⃣ Install Go Dependencies**\n```sh\ngo mod tidy\n```\n### **3️⃣ Setup Environment Variables**\n\nCreate a `.env` file with:\n`DATABASE_URL=postgres://user:password@db:5432/pmqc  LOG_LEVEL=info`\n\n----------\n\n## 🚀 **Running the API**\n\n### **1️⃣ Running Locally**\nEnsure **PostgreSQL** is running, then:\n`go run main.go`\n\n### **2️⃣ Running with Docker**\n\nBuild and start services:\n`docker-compose up --build -d`\n\nVerify that the API is running:\n`curl http://localhost:8080/ping`\n\n----------\n\n## 🔥 **API Endpoints**\n\n### **📌 Fetcher API**\n\n\nFetch PMQC data for a specific year/month\n`GET /fetch?year=2024\u0026month=10`\n\nFetch all available PMQC data\n`GET /fetch/all`\n### **📌 Storage API**\n\nGet all stored amostras (supports pagination \u0026 filters)\n`GET /amostras`\n\nGet a specific amostra by ID\n`GET /amostras/{id}`\n\n----------\n\n## 📖 **Swagger API Documentation**\n\nAPI documentation is available at:\n`http://localhost:8080/swagger/index.html`\n\nTo regenerate Swagger docs:\n`swag init --parseDependency --parseInternal`\n\n----------\n## 🏗 **Deployment**\n\n### **Deploying with Docker Compose**\n`docker-compose up -d --build`\n\n### **Deploying to Production**\n\n1.  Set up a **PostgreSQL database**\n2.  Use **Docker or Kubernetes**\n3.  Configure **environment variables** (`DATABASE_URL`, `LOG_LEVEL`)\n4.  Run:\n    `go build -o pmqc-api ./main.go ./pmqc-api`\n----------\n\n## 🤝 **Contributing**\n\n1.  **Fork** the project\n2.  **Create a feature branch** (`git checkout -b feature-xyz`)\n3.  **Commit changes** (`git commit -m \"Added new feature XYZ\"`)\n4.  **Push to GitHub** (`git push origin feature-xyz`)\n5.  **Create a Pull Request**\n\n----------\n\n## 📜 **License**\n\nThis project is licensed under the **MIT License**.\n\n----------","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjefster%2Fpmqc-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevjefster%2Fpmqc-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjefster%2Fpmqc-api/lists"}