Skip to content

Commit

Permalink
external events API example (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
joswig authored Dec 18, 2024
1 parent 59f0c68 commit 46fe8c8
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 21 deletions.
84 changes: 84 additions & 0 deletions docs/api/examples/planning/external-events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# External Events

External events can be created with JSON inputs.

## Creating an external source and associated event types

```graphql
mutation CreateExternalSource(
$derivation_group: derivation_group_insert_input!
$event_type: [external_event_type_insert_input!]!
$source: external_source_insert_input!
$source_type: external_source_type_insert_input!
) {
upsertExternalEventType: insert_external_event_type(
objects: $event_type
on_conflict: { constraint: external_event_type_pkey }
) {
returning {
name
}
}
upsertExternalSourceType: insert_external_source_type_one(
object: $source_type
on_conflict: { constraint: external_source_type_pkey }
) {
name
}
upsertDerivationGroup: insert_derivation_group_one(
object: $derivation_group
on_conflict: { constraint: derivation_group_pkey }
) {
name
}
createExternalSource: insert_external_source_one(object: $source) {
end_time
key
derivation_group_name
source_type_name
start_time
valid_at
}
}
```

```json
{
"derivation_group": {
"name": "Example",
"source_type_name": "docs"
},
"event_type": [
{
"name": "comm_pass"
}
],
"source": {
"derivation_group_name": "Example",
"end_time": "2025-03-09T16:40:00+00:00",
"external_events": {
"data": [
{
"duration": "2:55:00",
"event_type_name": "comm_pass",
"key": "DSS-43_6616_6616_0",
"start_time": "2024-10-23T04:45:00"
},
{
"duration": "9:50:00",
"event_type_name": "comm_pass",
"key": "DSS-43_6617_6617_1",
"start_time": "2024-10-24T06:00:00"
}
]
},
"key": "example20241217.json",
"source_type_name": "docs",
"start_time": "2024-10-23T04:15:00+00:00",
"valid_at": "2024-10-22T21:39:58+00:00"
},
"source_type": {
"name": "docs"
}
}
```
41 changes: 20 additions & 21 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const sidebars = {
'api/examples/planning/collaboration',
'api/examples/planning/anchors',
'api/examples/planning/snapshots',
'api/examples/planning/external-events',
],
},
'api/examples/simulation',
Expand Down Expand Up @@ -190,7 +191,7 @@ const sidebars = {
label: 'Scheduling & Constraints',
link: {
id: 'scheduling-and-constraints/introduction',
type: 'doc'
type: 'doc',
},
items: [
'scheduling-and-constraints/management',
Expand All @@ -199,7 +200,7 @@ const sidebars = {
label: 'Procedural',
link: {
id: 'scheduling-and-constraints/procedural/introduction',
type: 'doc'
type: 'doc',
},
items: [
'scheduling-and-constraints/procedural/getting-started',
Expand All @@ -208,39 +209,39 @@ const sidebars = {
label: 'Timelines',
link: {
id: 'scheduling-and-constraints/procedural/timelines/introduction',
type: 'doc'
type: 'doc',
},
items: [
{
type: 'category',
label: "Basics",
label: 'Basics',
link: {
id: 'scheduling-and-constraints/procedural/timelines/basics/introduction',
type: 'doc'
type: 'doc',
},
items: [
'scheduling-and-constraints/procedural/timelines/basics/profiles',
'scheduling-and-constraints/procedural/timelines/basics/sampling-and-caching',
'scheduling-and-constraints/procedural/timelines/basics/activities',
'scheduling-and-constraints/procedural/timelines/basics/external-events',
'scheduling-and-constraints/procedural/timelines/basics/windows',
'scheduling-and-constraints/procedural/timelines/basics/common-operations'
]
'scheduling-and-constraints/procedural/timelines/basics/common-operations',
],
},
{
type: 'category',
label: "Advanced",
label: 'Advanced',
link: {
id: 'scheduling-and-constraints/procedural/timelines/advanced/introduction',
type: 'doc'
type: 'doc',
},
items: [
// 'scheduling-and-constraints/procedural/timelines/advanced/parallel-profiles',
// 'scheduling-and-constraints/procedural/timelines/advanced/custom-operations',
// 'scheduling-and-constraints/procedural/timelines/advanced/custom-timelines'
]
}
]
],
},
],
},
'scheduling-and-constraints/procedural/plan-and-sim-results',
'scheduling-and-constraints/procedural/constraints',
Expand All @@ -249,22 +250,20 @@ const sidebars = {
label: 'Scheduling',
link: {
id: 'scheduling-and-constraints/procedural/scheduling/introduction',
type: 'doc'
type: 'doc',
},
items: [
'scheduling-and-constraints/procedural/scheduling/examples'
]
items: ['scheduling-and-constraints/procedural/scheduling/examples'],
},
'scheduling-and-constraints/procedural/parameters-and-invocations',
// 'scheduling-and-constraints/procedural/running-externally'
]
],
},
{
type: 'category',
label: 'Declarative',
link: {
id: 'scheduling-and-constraints/declarative/introduction',
type: 'doc'
type: 'doc',
},
items: [
{
Expand Down Expand Up @@ -303,10 +302,10 @@ const sidebars = {
},
],
},
]
],
},
'scheduling-and-constraints/execution'
]
'scheduling-and-constraints/execution',
],
},
{
type: 'category',
Expand Down

0 comments on commit 46fe8c8

Please sign in to comment.