Architecture Diagram

Architecture Diagram

Site Installation Architecture Overview

Your site installation system is a full-stack AWS serverless application that enables installers to submit IoT device installations with images, GPS data, and device metadata. Here's the complete architecture:


Frontend Layer

Location: InstallerDeviceFormPage.jsx

Key Components:

  • InstallerDeviceFormPage: Main form page for device installation

  • Installer Components:

    • SiteInfoSection: Site details (location ID, installer info, location type)

    • DeviceDetailsSection: Device configuration (category, model, asset name)

    • PulseCounterSection: Pulse counter configuration for utility meters

    • WeatherMonitoringSection: Weather station configuration

    • ImageUploadSection: Image upload with GPS extraction

Key Services:

  • installerDeviceService.js: Device CRUD operations

  • installerEntitiesService.js: Fetch location types, device categories, models

  • s3Service.js: S3 presigned URL generation for images

Data Flow:

  1. User fills form → collects site data, device data, pulse/weather data, images

  2. Calls submitInstallation() → creates FormData with multipart/form-data

  3. POSTs to /installations endpoint with JWT token


API Gateway Layer

Infrastructure: cdk-stack.ts

API: AtriaInstallerAPI (REST API Gateway)

Base URL: ${API_URL} (from VITE_INSTALLER_APP_API_URL)

Key Endpoints:

Endpoint

Method

Lambda

Purpose

Endpoint

Method

Lambda

Purpose

/installations

POST

InstallationSubmissionLambda

Submit new device installation

/devices/{deviceId}/{siteId}

GET

EntityResourceLambda

Get device details

/devices/{deviceId}/{siteId}

DELETE

EntityResourceLambda

Delete device

/devices/{deviceId}/{siteId}/images/{imageKey}

DELETE

EntityResourceLambda

Delete device image

/entities/devicecategories

GET

EntityResourceLambda

Get device categories

/entities/locationtypes

GET

EntityResourceLambda

Get location types

/entities/devicemodels

GET

EntityResourceLambda

Get device models

/entities/devicemodelunits

GET

EntityResourceLambda

Get device model units

/amazonlorawanresources/{category}/{devEui}

GET

EntityResourceLambda

Fetch LoRaWAN device data

/amazonlorawanresources/{category}/{devEui}

PUT

EntityResourceLambda

Update LoRaWAN metadata

/processimages/{installerName}/{siteId}

GET

ProcessImagesLambda

Get processed images

/geolocation/{siteId}

GET

ProcessImagesLambda

Get GPS coordinates

Authentication:

  • Cognito User Pool Authorizer (AtriaInstallerAuthorizer)

  • JWT token in Authorization: Bearer <token> header


Lambda Functions Layer

Location: installer

1. Installation Submission Lambda

File: installation_submission_lambda.py
Handler: installer.installation_submission_lambda.lambda_handler
Timeout: 5 minutes
Memory: 1024 MB

Responsibilities:

  • Parse multipart/form-data from API Gateway

  • Extract GPS coordinates from image EXIF data

  • Upload images to S3 ({locationId}/installation/{deviceId}/{deviceId}-image-{N}.jpg)

  • Save device record to DynamoDB (AtriaInstallerDeviceDetails)

  • Update LoRaWAN device tables with site info

  • Handle pulse counter and weather station configurations

  • Support both CREATE and UPDATE operations

Key Functions:

  • extract_gps_from_image()

  • upload_image_to_s3()

  • update_lorawan_device_site_info()

  • convert_device_type_to_taxonomy_code()


2. Entity Resource Lambda

File: entity_resource_lambda.py
Handler: installer.entity_resource_lambda.lambda_handler
Timeout: 5 minutes
Memory: 1024 MB

Responsibilities:

  • Fetch entity data (device categories, location types, models)

  • Query device details by deviceId/siteId

  • Generate S3 presigned URLs for device images

  • Manage LoRaWAN device interactions (AWS IoT Wireless)

  • Delete devices and images


3. Device Details Lambda

File: device_details_lambda.py
Handler: installer.device_details_lambda.lambda_handler
Timeout: 5 minutes
Runtime: Python 3.9

Responsibilities:

  • S3 trigger on .txt file uploads

  • Parse CSV device data from S3

  • Create/update device records in DynamoDB

  • Standardize pulse counter values


4. Process Images Lambda

File: process_images_lambda/process_images_lambda.py
Handler: lambda_handler
Timeout: 15 minutes
Memory: 1536 MB

Responsibilities:

  • Fetch processed images for PDF generation

  • Extract GPS data from images


Database Layer (DynamoDB)

1. AtriaInstallerDeviceDetails

Partition Key: EntityId (deviceId)
Sort Key: SecondaryId (locationId/siteId)

Attributes Example:

{ EntityId: "deviceId", SecondaryId: "locationId", DeviceCategory: "sensor", Model: "Device Model Name", InstallerName: "John Doe", InstallerCompany: "Install Co", ImageKeys: ["SITE123/installation/12abc/12abc-image-1.jpg"], CreatedAt: "2025-10-23T12:34:56Z", Status: "submitted" }