AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
A Go-based REST API for geocoding location lookup using US ZIP codes and Ohio address data, built with Echo framework and PostgreSQL with PostGIS. • 🏃 Fast geocoding lookup by ZIP code • 🔍 Search ZIP codes by city name and state • 🏠 Ohio address data from official state sources • 🗺️ Shapefile to GeoJSON conversion using GDAL • 🗄️ PostgreSQL database with PostGIS for geospatial queries • 🚀 Built with Echo web framework • 🐳 Docker support with Docker Compose • 📊 Comprehensive location data including population, density, coordinates, and county informationREADME 전문 보기 ↗
A Go-based REST API for geocoding location lookup using US ZIP codes and Ohio address data, built with Echo framework and PostgreSQL with PostGIS.
timezone_source, and GET /api/v1/admin/boundaries
reports which release is loaded.brew install gdalsudo apt-get install gdal-bin# Run the setup script
./scripts/setup_dev.sh
This will:
Install GDAL (optional but recommended)
# macOS
brew install gdal
# Ubuntu/Debian
sudo apt-get install gdal-bin
Start Docker services
docker compose up -d db pgadmin
Install Go dependencies
go mod download
Run the application
go run main.go
# or with hot reloading
air
# Start API with docs
make dev
# Visit documentation
open http://localhost:8080/docs
# Or serve docs only
make docs
GET /api/v1/geocode/{zipcode}
Returns detailed information for a specific ZIP code.
Example:
curl http://localhost:8080/api/v1/geocode/10001
Response:
{
"success": true,
"data": {
"zip_code": "10001",
"city_name": "New York",
"state_code": "NY",
"state_name": "New York",
"zcta": true,
"population": 21102.0,
"density": 35400.5,
"primary_county_code": "36061",
"primary_county_name": "New York",
"county_weights": {"36061": "100"},
"county_names": ["New York"],
"county_codes": ["36061"],
"imprecise": false,
"military": false,
"timezone": "America/New_York",
"latitude": 40.75066,
"longitude": -73.99670
},
"count": 1
}
GET /api/v1/search?city={city_name}&state={state_code}&limit={limit}
Search for ZIP codes by city name, optionally filtered by state.
Parameters:
city (required): City name to search forstate (optional): Two-letter state code (e.g., "NY", "CA")limit (optional): Maximum number of results (default: 50, max: 100)Example:
curl "http://localhost:8080/api/v1/search?city=Springfield&state=IL&limit=10"
GET /api/v1/distance/{from}/{to}
Calculate the precise distance between two ZIP codes using the Haversine formula.
Example:
curl http://localhost:8080/api/v1/distance/10001/90210
Response:
{
"success": true,
"data": {
"from_zip_code": "10001",
"to_zip_code": "90210",
"distance_miles": 2445.5,
"distance_km": 3936.2
},
"count": 1
}
GET /api/v1/nearby/{zipcode}?radius={miles}&limit={limit}
Find all ZIP codes within a specified radius of a center ZIP code.
Parameters:
radius (optional): Search radius in miles (default: 1, max: 100)limit (optional): Maximum results (default: 50, max: 200)Example:
curl "http://localhost:8080/api/v1/nearby/10001?radius=5&limit=10"
GET /api/v1/proximity/{center}/{target}?radius={miles}
Check if a target ZIP code is within a specified radius of a center ZIP code.
Example:
curl "http://localhost:8080/api/v1/proximity/10001/10002?radius=1"
Response:
{
"success": true,
"data": {
"center_zip_code": "10001",
"target_zip_code": "10002",
"radius_miles": 1,
"is_within_radius": true,
"actual_distance_miles": 0.5,
"actual_distance_km": 0.8
},
"count": 1
}
GET /api/v1/health
Returns the API health status.
POST /api/v1/admin/load-data?file={csv_file_path}
Loads ZIP code data from CSV file into the database.
Clone or set up the project:
git clone <your-repo-url>
cd geocoding-api
Ensure the CSV file is present:
Make sure georef-united-states-of-america-zc-point.csv is in the project root.
Start the services:
docker-compose up -d
Load the ZIP code data:
curl -X POST http://localhost:8080/api/v1/admin/load-data
Test the API:
curl http://localhost:8080/api/v1/geocode/10001
Install dependencies:
go mod download
Set up PostgreSQL database:
CREATE DATABASE geocoding_db;
Configure environment variables:
cp .env.example .env
# Edit .env with your database configuration
Run the application:
go run main.go
Load the ZIP code data:
curl -X POST http://localhost:8080/api/v1/admin/load-data
| Variable | Description | Default |
|---|---|---|
DB_HOST | PostgreSQL host | localhost |
DB_PORT | PostgreSQL port | 5432 |
DB_USER | PostgreSQL username | postgres |
DB_PASSWORD | PostgreSQL password | postgres |
DB_NAME | PostgreSQL database name | geocoding_db |
DB_SSLMODE | PostgreSQL SSL mode | disable |
PORT | API server port | 8080 |
The ZIP code data includes the following fields:
CREATE TABLE zip_codes (
zip_code VARCHAR(10) PRIMARY KEY,
city_name VARCHAR(255) NOT NULL,
state_code VARCHAR(2) NOT NULL,
state_name VARCHAR(255) NOT NULL,
zcta BOOLEAN NOT NULL DEFAULT FALSE,
zcta_parent VARCHAR(10),
population DECIMAL(12,2),
density DECIMAL(10,2),
primary_county_code VARCHAR(10) NOT NULL,
primary_county_name VARCHAR(255) NOT NULL,
county_weights JSONB,
county_names TEXT,
county_codes TEXT,
imprecise BOOLEAN NOT NULL DEFAULT FALSE,
military BOOLEAN NOT NULL DEFAULT FALSE,
timezone VARCHAR(100) NOT NULL,
latitude DECIMAL(10,7) NOT NULL,
longitude DECIMAL(10,7) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
This project uses a custom migration system with version tracking. Migrations run automatically when the application starts.
The application automatically:
schema_migrations table to track applied migrationsMigration files are located in:
database/migrations.go - Migration definitionsservices/zipcode_service.go - Data loading logicThe application automatically downloads address data from the Ohio LBRS site for all 88 Ohio counties.
Data Flow:
ADA_ADDS.zip)Requirements:
Testing:
# Test GDAL installation and conversion
./scripts/test_gdal.sh
# This will download and convert a sample county
Manual trigger:
# Force re-download and conversion
# Delete cached files and restart the application
rm -rf oh/* cache/*
go run main.go
For more advanced migration needs, you can use golang-migrate:
# Install migrate tool
make install-tools
# Create a new migration
make migrate-create
# Apply migrations
make migrate-up
# Rollback migrations
make migrate-down
# Check migration status
make migrate-version
Migration files: migrations/*.sql
The application automatically loads ZIP code data on first run:
curl -X POST http://localhost:8080/api/v1/admin/load-datamake load-dataThe production Docker image automatically optimizes its size by:
ENV=production) or when explicitly enabled (CLEANUP_GEOJSON=true)For optimal production deployment, set these environment variables:
ENV=production # Enables production optimizations
CLEANUP_GEOJSON=true # Forces GeoJSON cleanup regardless of ENV
In development, GeoJSON files are preserved by default. To test cleanup locally:
CLEANUP_GEOJSON=true docker-compose up
The database includes several indexes for optimal query performance:
zip_codestate_code for state-based filteringcity_name for city searcheslatitude, longitude for geographical queriesThe API returns standardized error responses:
{
"success": false,
"error": "Error description"
}
Common HTTP status codes:
200: Success400: Bad Request (invalid parameters)404: Not Found (ZIP code not found)500: Internal Server ErrorThis project is licensed under the MIT License - see the LICENSE file for details.
This API uses ZIP code data from the GeoNames geographical database. The data includes comprehensive information about US ZIP codes including geographical coordinates, administrative boundaries, and demographic information.