Skip to main content

Creating an External Source

Prerequisite: Creating External Source & Event Types

Before creating an External Source, we must define the Source & Event types that our External Source will use. The files we create will define 1) the name of the type and 2) the schema for the type's attributes. These files make use of the JSON Schema format.

Create the following JSON file:

External_Types_Schema.json:

{
"event_types": {
"SampleTypeA": {
"properties": {
"EventExampleAttribute": {
"type": "number"
}
},
"required": ["EventExampleAttribute"],
"type": "object"
},
"SampleTypeB": {
"properties": {
"DifferentExampleAttribute": {
"type": "boolean"
}
},
"required": ["DifferentExampleAttribute"],
"type": "object"
}
},
"source_types": {
"DemoType": {
"properties": {
"SourceExampleAttribute": {
"type": "string"
}
},
"required": ["SourceExampleAttribute"],
"type": "object"
}
}
}

Creating an External Source

We are going to manually create two External Source json files, and in the next section we will upload them to Aerie. The Sources will be slightly staggered in the times they cover to help us later in illustrating how derivation works.

Diagram of the two source's overlapping time ranges
Diagram of the two source's overlapping time ranges

Create the following JSON files:

External_Events_Demo_00.json:

{
"source": {
"key": "External_Events_Demo_00.json",
"source_type_name": "DemoType",
"derivation_group_name": "DemoType Default",
"valid_at": "2026-001T00:00:00Z",
"period": {
"start_time": "2026-001T00:00:00Z",
"end_time": "2026-007T00:00:00Z"
},
"attributes": {
"SourceExampleAttribute": "this is an example attribute"
}
},
"events": [
{
"key": "DemoType/SampleTypeA/1",
"event_type_name": "SampleTypeA",
"start_time": "2026-001T12:00:00Z",
"duration": "02:00:00",
"attributes": {
"EventExampleAttribute": 1
}
},
{
"key": "DemoType/SampleTypeA/2",
"event_type_name": "SampleTypeA",
"start_time": "2026-002T00:00:00Z",
"duration": "01:00:00",
"attributes": {
"EventExampleAttribute": 2
}
},
{
"key": "DemoType/SampleTypeA/3",
"event_type_name": "SampleTypeA",
"start_time": "2026-003T12:00:00Z",
"duration": "03:00:00",
"attributes": {
"EventExampleAttribute": 1
}
}
]
}

External_Events_Demo_01.json:

{
"source": {
"key": "External_Events_Demo_01.json",
"source_type_name": "DemoType",
"derivation_group_name": "DemoType Default",
"valid_at": "2026-004T11:00:00Z",
"period": {
"start_time": "2026-004T11:00:00Z",
"end_time": "2026-010T00:00:00Z"
},
"attributes": {
"SourceExampleAttribute": "this is an example attribute"
}
},
"events": [
{
"key": "DemoType/SampleTypeB/1",
"event_type_name": "SampleTypeB",
"start_time": "2026-004T12:00:00Z",
"duration": "01:00:00",
"attributes": {
"DifferentExampleAttribute": true
}
},
{
"key": "DemoType/SampleTypeB/2",
"event_type_name": "SampleTypeB",
"start_time": "2026-009T20:00:00Z",
"duration": "03:00:00",
"attributes": {
"DifferentExampleAttribute": true
}
}
]
}
Note

The exact formatting of the key property is not important.

We are now ready to upload our test External Source files to Aerie!

More details can be found in the External Events section.