Skip to content

Instantly share code, notes, and snippets.

@wcamarao
Created March 3, 2025 21:38
Show Gist options
  • Save wcamarao/00e7e1e076b9e97d1c697ff167d7ff40 to your computer and use it in GitHub Desktop.
Save wcamarao/00e7e1e076b9e97d1c697ff167d7ff40 to your computer and use it in GitHub Desktop.

Given the following events

[
  {
    "event": "file_processing_started",
    "filename": "canopy_height.tiff",
    "organisation_id": "e39ff3f6",
    "organisation_name": "Foo"
  },
  {
    "event": "file_processing_failed",
    "filename": "canopy_height.tiff",
    "organisation_id": "e39ff3f6",
    "organisation_name": "Foo"
  },
  {
    "event": "file_processing_started",
    "filename": "canopy_cover.tiff",
    "organisation_id": "a33cb19f",
    "organisation_name": "Bar"
  },
  {
    "event": "file_processing_started",
    "filename": "canopy_cover.tiff",
    "organisation_id": "b45df18c",
    "organisation_name": "Zip"
  },
  {
    "event": "file_processing_completed",
    "filename": "canopy_cover.tiff",
    "organisation_id": "b45df18c",
    "organisation_name": "Zip"
  }
]

Generate a file status report per organisation

{
  "Foo": {
    "processing": 0,
    "completed": 0,
    "failed": 1
  },
  "Bar": {
    "processing": 1,
    "completed": 0,
    "failed": 0
  },
  "Zip": {
    "processing": 0,
    "completed": 1,
    "failed": 0
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment