Skip to content

Add gRPC service for the activity classifier postprocessor#40

Merged
joshhvulcan merged 2 commits into
mainfrom
josh/claude/activity-postprocessor-grpc
Jun 25, 2026
Merged

Add gRPC service for the activity classifier postprocessor#40
joshhvulcan merged 2 commits into
mainfrom
josh/claude/activity-postprocessor-grpc

Conversation

@joshhvulcan

@joshhvulcan joshhvulcan commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Motivation

The activity classifier's postprocessing rules (transiting, anchored/moored, stationary, confidence thresholding, geofencing, near-shore/marine-infra, etc.) currently only run in-process inside the atlas_activity model pipeline. We already expose the entity postprocessor as a standalone gRPC service (atlas_entity/grpc_serve) so it can be deployed and invoked independently of the model. This adds the equivalent for the activity postprocessor, so the same rule logic can be deployed and run separately from the model pipeline.

Changes

Adds a self-contained atlas_activity/grpc_serve package mirroring the entity one: a .proto + checked-in stubs, config.py (ACTIVITY_POSTPROCESSOR_GRPC_*, default port 5208), a serve_grpc.py server with a health check, an integration test, and a test_activity_postprocessor_grpc docker-compose service.

Unlike the flat entity input, the activity postprocessor needs the trajectory itself, so the request carries the AIS messages (sog, rel_cog, cog, lat, lon, send, optional nav/dist2coast) plus the predicted class, model confidence, and binned_ship_type. The servicer reconstructs the most_recent_data DataFrame and calls the existing AtlasActivityPostProcessor.postprocess — no rule logic is reimplemented, so behavior is identical to the in-process pipeline.

Architecture

flowchart LR
    client[gRPC client] -->|ActivityPostprocessorInput| svc
    subgraph atlas_activity
      svc[ActivityPostprocessorServicer]:::added -->|rebuild DataFrame| pp[AtlasActivityPostProcessor.postprocess]
      pp --> rules[postprocess rules]
    end
    svc -->|ActivityPostprocessorOutput| client
    classDef added fill:#6f6,stroke:#333
Loading

joshhvulcan and others added 2 commits June 24, 2026 19:05
Mirrors the existing entity postprocessor gRPC service (atlas_entity/grpc_serve)
so the activity postprocessing rules can be deployed and run independently of the
model inference pipeline. The server reconstructs the trajectory DataFrame from
the request and calls the existing AtlasActivityPostProcessor.postprocess, so every
rule behaves identically to the in-process pipeline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The grpc integration test needs the postprocessor server running, so it must
not run in the pipeline step (no server there); exclude it like the entity one
and run it against the test_activity_postprocessor_grpc compose service in the
service-tests step.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joshhvulcan joshhvulcan merged commit ba60bb1 into main Jun 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants