Skip to main content

Setup Environment for Timestamp Normalization

Before building the timestamp normalization pipeline, you'll set up your Expanso Edge environment and prepare sample data.

Prerequisites

This example requires the following services to be running:

Before you begin, please ensure these services are set up and running according to their respective guides. Additionally, ensure you have completed the Local Development Setup guide for general environment configuration.

Step 1: Create Sample Timestamp Data

Generate diverse timestamp formats for testing:

# Create sample data directory
mkdir -p ~/timestamp-samples

# Create mixed timestamp formats file
cat > ~/timestamp-samples/mixed-timestamps.jsonl << 'EOF'
{"event_id": "evt_001", "event_type": "user_login", "timestamp": "2025-10-20T19:23:45.123+01:00", "user_id": "user_12345"}
{"event_id": "evt_002", "event_type": "user_login", "timestamp": 1729450425, "user_id": "user_67890"}
{"event_id": "evt_003", "event_type": "purchase", "timestamp": "2025-10-20 14:23:45", "timezone": "America/New_York", "user_id": "user_24680", "amount": 99.99}
{"event_id": "evt_004", "event_type": "page_view", "timestamp": "2025-10-20T18:23:45.000Z", "user_id": "user_13579", "page": "/home"}
{"event_id": "evt_005", "event_type": "user_logout", "timestamp": 1729450425123, "user_id": "user_97531"}
{"event_id": "evt_006", "event_type": "api_call", "timestamp": "20/Oct/2025:14:23:45 +0000", "user_id": "user_86420", "endpoint": "/api/users"}
{"event_id": "evt_007", "event_type": "error", "timestamp": "20251020142345", "user_id": "user_75319", "error_code": 500}
EOF

# Verify sample data
echo "Sample data created with $(wc -l < ~/timestamp-samples/mixed-timestamps.jsonl) events"

Step 2: Configure Environment Variables

Set up configuration for the timestamp normalization pipeline:

# Set environment variables
export EXPANSO_PROJECT="timestamp-normalization"
export EXPANSO_ENVIRONMENT="dev"
export TIMESTAMP_SECRET_SALT="your-secret-salt-here-$(openssl rand -hex 16)"

# Create .env file for persistence
cat > ~/.expanso-timestamps.env << EOF
EXPANSO_PROJECT=${EXPANSO_PROJECT}
EXPANSO_ENVIRONMENT=${EXPANSO_ENVIRONMENT}
TIMESTAMP_SECRET_SALT=${TIMESTAMP_SECRET_SALT}
EOF

# Source environment
source ~/.expanso-timestamps.env

echo "Environment configured for project: ${EXPANSO_PROJECT}"

Step 3: Verify Timezone Database

Confirm your system has up-to-date timezone information:

# Check timezone database version
zdump -v America/New_York | head -1

# Verify common timezones work
zdump -v Europe/London | head -1
zdump -v Asia/Tokyo | head -1

Next Steps

Environment setup complete! Now you can start building the timestamp normalization pipeline: