Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Ingestion Specification

  1. Define and Event Grammar

Code Block
languagejson
{
  "instrument_details": {
    "type": "COUNTER",
    "key": "count"
  },
  "name": "attendance_by_school_grade_for_a_day",
  "is_active": true,
  "event_schema": {
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "default": {},
    "title": "attendance_by_school_grade_for_a_day",
    "required": ["date", "grade", "school_id", "count"],
    "properties": {
      "date": {
        "type": "string",
        "default": "",
        "title": "The date Schema",
        "examples": ["2019-01-01"]
      },
      "grade": {
        "type": "integer",
        "default": 0,
        "title": "The grade Schema",
        "examples": [1]
      },
      "school_id": {
        "type": "integer",
        "default": 0,
        "title": "The school_id Schema",
        "examples": [901]
      }
    },
    "examples": [
      {
        "date": "2019-01-01",
        "grade": 1,
        "school_id": 901,
        "count": 23
      }
    ]
  }
}

2. Publish an event that satisfies the grammar

Code Block
languagejson
{
    "date": "2019-01-01",
    "grade": 1,
    "school_id": 901,
    "count": 23
}

Transformer Specification

How this event is processed is defined by a pipe.

Code Block
languagejs
const transformer = {
    name: "transformer_name",
    event_schema: "es11",
    dataset_schema: "ds23",
    config: {
        spawn((callback, receive) => {
            // send to parent
            callback('SOME_EVENT');

            // receive from parent
            receive((event) => {
            // handle event
            });

            // disposal
            return () => {
            /* do cleanup here */
            };
        }),
    }
}