| title | description | version | last_updated | author | tags | audience | project | status | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
OSM-Notes-Common |
Shared functions and utilities for OSM Notes processing projects |
1.0.0 |
2026-01-25 |
AngocA |
|
|
OSM-Notes-Common |
active |
Shared functions and utilities for OSM Notes processing projects.
This repository contains common Bash functions and utilities shared between multiple OSM Notes projects via Git submodule. It provides reusable libraries for logging, validation, error handling, and common utilities.
This Common library is part of the OSM-Notes ecosystem, consisting of 8 interconnected projects. OSM-Notes-Ingestion is the base project - it was the first created and provides the foundation for all others. This Common library is used as a Git submodule by multiple projects in the ecosystem.
-
OSM-Notes-Ingestion - Base project
- Downloads and synchronizes OSM notes from Planet and API
- Populates base PostgreSQL tables
- First project created, foundation for all others
- Uses Common: ✅ Yes (as Git submodule at
lib/osm-common/)
-
- ETL processes and data warehouse
- Generates analytics and datamarts
- Requires: OSM-Notes-Ingestion (reads from base tables)
- Uses Common: ✅ Yes (as Git submodule at
lib/osm-common/)
-
- REST API for programmatic access
- Provides dynamic queries and advanced features
- Requires: OSM-Notes-Analytics (reads from data warehouse)
- Uses Common: ❌ No (Node.js/TypeScript project, doesn't use Bash libraries)
-
- Web application for interactive visualization
- Consumes JSON data from OSM-Notes-Data (GitHub Pages)
- Requires: OSM-Notes-Data (which is generated by OSM-Notes-Analytics)
- Uses Common: ❌ No (JavaScript project, doesn't use Bash libraries)
-
- Web Map Service for geographic visualization
- Publishes WMS layers for mapping applications
- Requires: OSM-Notes-Ingestion (uses same database)
- Uses Common: ✅ Yes (as Git submodule at
lib/osm-common/)
-
- Centralized monitoring and alerting
- Monitors all ecosystem components
- Requires: Access to all other projects' databases/services
- Uses Common: ✅ Yes (as Git submodule at
lib/osm-common/)
-
OSM-Notes-Common (this project)
- Shared Bash libraries and utilities
- Used as Git submodule by multiple projects
- Used by: Ingestion, Analytics, WMS, Monitoring
- Not used by: API (Node.js), Viewer (JavaScript), Data (no code)
-
- JSON data files exported from Analytics
- Served via GitHub Pages
- Requires: OSM-Notes-Analytics (generates and publishes the data)
- Consumed by: Viewer (primary consumer), API (optional)
- Uses Common: ❌ No (data repository, no code)
graph TB
subgraph External["External Sources"]
OSM[OSM Planet/API]
end
subgraph Base["Base Project"]
INGESTION[OSM-Notes-Ingestion<br/>Base project]
end
subgraph Processing["Processing Layer"]
ANALYTICS[OSM-Notes-Analytics<br/>ETL → Data Warehouse]
WMS[OSM-Notes-WMS<br/>WMS layers]
end
subgraph Delivery["Delivery Layer"]
DATA[OSM-Notes-Data<br/>JSON files<br/>GitHub Pages]
VIEWER[OSM-Notes-Viewer]
API[OSM-Notes-API<br/>REST API]
end
subgraph Support["Support Layer"]
MONITORING[OSM-Notes-Monitoring<br/>Monitors all projects]
COMMON[OSM-Notes-Common<br/>Shared libraries<br/>this project, used as submodule<br/>Used by: Ingestion ✅, Analytics ✅, WMS ✅, Monitoring ✅<br/>Not used by: API ❌, Viewer ❌, Data ❌]
end
OSM -->|Downloads| INGESTION
INGESTION -->|Base Tables| ANALYTICS
INGESTION -->|Same Database| WMS
ANALYTICS -->|JSON Export| DATA
ANALYTICS -->|Data Warehouse| API
DATA -->|JSON Files| VIEWER
MONITORING -.->|Monitors| INGESTION
MONITORING -.->|Monitors| ANALYTICS
MONITORING -.->|Monitors| API
COMMON -.->|Used by| INGESTION
COMMON -.->|Used by| ANALYTICS
COMMON -.->|Used by| WMS
COMMON -.->|Used by| MONITORING
style OSM fill:#ADD8E6
style INGESTION fill:#90EE90
style ANALYTICS fill:#FFFFE0
style WMS fill:#FFE4B5
style DATA fill:#E0F6FF
style API fill:#FFB6C1
style VIEWER fill:#DDA0DD
style MONITORING fill:#F0E68C
style COMMON fill:#D3D3D3
The following projects use OSM-Notes-Common as a Git submodule:
- ✅ OSM-Notes-Ingestion: Uses Common for logging, validation, error handling
- ✅ OSM-Notes-Analytics: Uses Common for logging, validation, error handling
- ✅ OSM-Notes-WMS: Uses Common for logging, validation, error handling
- ✅ OSM-Notes-Monitoring: Uses Common for logging, validation, error handling
The following projects do not use Common (different technology stack):
- ❌ OSM-Notes-API: Node.js/TypeScript project (uses npm packages instead)
- ❌ OSM-Notes-Viewer: JavaScript project (uses npm packages instead)
- ❌ OSM-Notes-Data: Data repository (no code, only JSON files)
-
commonFunctions.sh: Common utility functions used across all scripts- Directory and file management
- Process management
- Logging helpers
- Configuration loading
-
validationFunctions.sh: Validation functions for data integrity- XML validation
- CSV validation
- Database validation
- Coordinate validation
-
consolidatedValidationFunctions.sh: Consolidated validation utilities- Enhanced XML validation
- Schema validation
- Data quality checks
-
errorHandlingFunctions.sh: Error handling and recovery functions- Error trapping
- Cleanup on errors
- Recovery mechanisms
- Exit code management
bash_logger.sh: Logging library (log4j-style for Bash)- Multiple log levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Timestamp formatting
- Colored output
- File and console logging
New to this project? Follow this reading path (~30 minutes):
-
Start Here (10 min)
- Read this README.md (you're here!)
- Understand what Common provides
- Review Components section above
-
Using Common (15 min)
- Review "Usage as Git Submodule" section below
- Review "Using the Functions" examples
- Understand how to load functions in your scripts
-
Available Functions (5 min)
- Review Components section for available functions
- Check function documentation in source files
Total time: ~30 minutes for basic usage.
-
Development (20 min)
- Review Development section below
- Understand versioning strategy
- Review Testing requirements
-
Making Changes (10 min)
- Follow "Making Changes" workflow
- Ensure compatibility with dependent projects
- Submit pull request
Total time: ~30 minutes for contributor overview.
This repository is designed to be used as a Git submodule.
# In your project directory
git submodule add https://github.com/OSM-Notes/OSM-Notes-Common.git lib/osm-common
# Commit the submodule
git commit -m "Add OSM-Notes-Common as submodule"# Clone with submodules
git clone --recurse-submodules https://github.com/yourorg/yourproject.git
# Or initialize after cloning
git clone https://github.com/yourorg/yourproject.git
cd yourproject
git submodule init
git submodule update# Update to latest version
git submodule update --remote lib/osm-common
# Commit the update
git add lib/osm-common
git commit -m "Update osm-common submodule"#!/bin/bash
# Load common functions from submodule
source "lib/osm-common/commonFunctions.sh"
# Use the functions
__start_logger
logInfo "Processing started"#!/bin/bash
# Load validation functions
source "lib/osm-common/validationFunctions.sh"
# Validate XML file
if __validate_xml_file "data.xml" "schema.xsd"; then
echo "XML is valid"
fi#!/bin/bash
# Load bash logger
source "lib/osm-common/bash_logger.sh"
# Set log level
LOG_LEVEL="DEBUG"
# Use logger
logInfo "Application started"
logDebug "Debug information"
logError "Something went wrong"- Bash 4.0 or higher
- Linux operating system
- Standard UNIX utilities: grep, awk, sed, etc.
None - This is a shared library used as Git submodule by other projects.
Used by:
- OSM-Notes-Ingestion (as submodule)
- OSM-Notes-Analytics (as submodule)
- OSM-Notes-WMS (as submodule)
- OSM-Notes-Monitoring (as submodule)
Not used by:
- OSM-Notes-API (Node.js/TypeScript project)
- OSM-Notes-Viewer (JavaScript project)
- OSM-Notes-Data (data repository, no code)
This library requires:
- Bash 4.0 or higher
- Linux operating system
- Standard UNIX utilities (grep, awk, sed, etc.)
- Create a feature branch
- Make your changes
- Test with both dependent projects
- Submit a pull request
Before committing changes, ensure:
- All functions are documented
- No breaking changes to public APIs
- shellcheck passes:
shellcheck -x -o all *.sh - shfmt formatting:
shfmt -w -i 1 -sr -bn *.sh
This project follows Semantic Versioning:
- Major version: Breaking changes
- Minor version: New features (backward compatible)
- Patch version: Bug fixes
See CONTRIBUTING.md for contribution guidelines.
This repository also contains shared documentation for the entire OSM Notes ecosystem:
- Global Glossary - Complete glossary of terms used across the ecosystem
- Complete Installation Guide - Step-by-step installation guide for the complete ecosystem
- End-to-End Data Flow - Complete data flow from OSM Planet to Viewer
- Decision Guide - Help deciding which projects you need
See docs/README.md for complete documentation index.
- Schemas Documentation - JSON Schema definitions and validation
See LICENSE for license information.
For issues or questions:
- Create an issue in this repository
- Check documentation in dependent projects
- Contact: @angoca in Telegram and several social network
For complete information about the OSM-Notes ecosystem and all 8 projects, see the OSM-Notes Ecosystem section above.
Projects using Common as submodule:
- OSM-Notes-Ingestion - Notes ingestion ✅
- OSM-Notes-Analytics - DWH and analytics ✅
- OSM-Notes-WMS - WMS service ✅
- OSM-Notes-Monitoring - Monitoring ✅
Other ecosystem projects:
- OSM-Notes-API - REST API ❌ (doesn't use Common)
- OSM-Notes-Viewer - Web visualization ❌ (doesn't use Common)
- OSM-Notes-Data - JSON data files ❌ (no code)
- Andres Gomez (@AngocA): Main developer
- All contributors to the OSM Notes processing ecosystem