-
Notifications
You must be signed in to change notification settings - Fork 0
feat: group ODP/PDP data and add provinces with latest case endpoint #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add ObservationData and SupervisionData structs - Group ODP fields under 'odp' key with active, finished, total - Group PDP fields under 'pdp' key with active, finished, total - Maintain backward compatibility with data calculation
- Add ProvinceWithLatestCase model - Add GetProvincesWithLatestCase service method - Update GetProvinces endpoint to support include_latest_case query param - Fetch and include latest case data for each province when requested
- Update test expectations to use ObservationData and SupervisionData structs - Fix all test cases to match new nested ODP/PDP structure - Ensure all tests pass with grouped ODP/PDP fields
- Add GetProvincesWithLatestCase to mock service - Update health check test to expect version 2.0.2 - Ensure all handler tests pass
- Create separate DailyObservationData and DailySupervisionData structs - Daily data only includes active and finished (no total) - Cumulative data includes active, finished, and total - Update all test cases to match corrected structure - All tests passing
- Add pagination models with metadata support - Add query parameter parsing utilities - Implement paginated repository methods - Add paginated service layer methods - Update handlers to support hybrid pagination: - ?all=true: Returns complete dataset (for charts/analytics) - Default: Returns paginated data (limit=50, max=1000) - ?limit=N&offset=M: Custom pagination - Works with date ranges and province filtering - Maintain backward compatibility with existing endpoints
- Add detailed API_DOCUMENTATION.md with endpoint specs - Update README with new pagination features and usage examples - Document enhanced ODP/PDP data structure - Add practical usage examples for different use cases - Include response format specifications and best practices
- Change default behavior to include COVID-19 case data for better UX - Add exclude_latest_case parameter for basic province list only - Update all tests to reflect new default behavior - Update API documentation and README with new usage patterns - Maintain backward compatibility with existing parameter This change makes the COVID-19 API more intuitive by showing current pandemic status by default, which is what users typically expect.
- Generate interactive Swagger UI accessible at /swagger/index.html - Add detailed Go annotations for all API endpoints with parameters, responses - Include comprehensive OpenAPI 3.0 specification (YAML/JSON) - Auto-document all models including enhanced ODP/PDP structure - Support for pagination metadata and hybrid response types - Add redirect from root to swagger docs for convenience - Include documentation regeneration instructions for developers Key improvements: - Complete API specification with examples - Type-safe client code generation support - Interactive testing interface - Automatic validation of API contracts - Professional API documentation presentation
- Update API title to 'Sulawesi Tengah COVID-19 Data API' - Clarify that national and other provincial data are for context - Emphasize primary focus on Central Sulawesi COVID-19 data - Update all documentation files (README, API docs, Swagger specs) - Regenerate OpenAPI documentation with correct regional focus This better reflects the actual purpose and scope of the API, making it clear to users that while national data is available, the main focus is on Sulawesi Tengah regional COVID-19 information.
- Add LICENSE file with MIT license terms - Update README to reference LICENSE file - Include copyright notice for Banua Coder - Ensures proper open source licensing for the project The MIT license allows free use, modification, and distribution while providing liability protection for the authors.
- Remove API_DOCUMENTATION.md (replaced by auto-generated Swagger docs) - Update README project structure to reflect current directories - Add descriptions for docs/, pkg/utils/, test/, and other directories - Highlight auto-generated documentation approach The OpenAPI/Swagger documentation provides comprehensive API docs that are always up-to-date with the code, making manual documentation files redundant.
- Add GetAPIIndex handler to return comprehensive endpoint information - Include API metadata, documentation links, and feature descriptions - Support both /api/v1 and /api/v1/ routes for better UX - Add comprehensive test coverage for the new endpoint - Update Swagger documentation with new endpoint specification - Enhance API discoverability with structured endpoint listing
75622b5
to
ea4308c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Changes Made
1. ODP/PDP Data Grouping
ObservationData
andSupervisionData
structs to group related fieldsProvinceDailyCases
to use grouped ODP/PDP structures with keys:daily.odp.active
,daily.odp.finished
,daily.odp.total
daily.pdp.active
,daily.pdp.finished
,daily.pdp.total
ProvinceCumulativeCases
with similar grouped structure for cumulative data2. Provinces with Latest Case Data
ProvinceWithLatestCase
model to combine province info with latest case dataGetProvincesWithLatestCase()
service method/api/v1/provinces
endpoint to support?include_latest_case=true
query parameter3. Testing
API Usage Examples
Get provinces with latest case data:
Province case response now has grouped ODP/PDP:
Test Results