schemas.py
The schemas.py file defines the message contents and data types that the random global events application produces. It is necessary to keep the schema up-to-date if you add further information to the message as it will ensure that the messages are formatted properly.
EventStarted
- pydantic settings EventStarted
Standardized message indicating location, start-time, and isDay boolean for an event
Show JSON schema
{ "title": "EventStarted", "description": "*Standardized message indicating location, start-time, and isDay boolean for an event*", "type": "object", "properties": { "eventId": { "description": "Unique event identifier.", "title": "Eventid", "type": "integer" }, "eventStart": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "description": "Time event started.", "title": "Eventstart" }, "latitude": { "description": "Random event latitude (degrees)", "maximum": 90, "minimum": -90, "title": "Latitude", "type": "number" }, "longitude": { "description": "Random event longitude (degrees)", "maximum": 180, "minimum": -180, "title": "Longitude", "type": "number" }, "isDay": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Isday" } }, "required": [ "eventId", "eventStart", "latitude", "longitude", "isDay" ] }
- Fields:
eventId (int)eventStart (datetime.datetime | None)isDay (int | None)latitude (float)longitude (float)
- field eventId: int [Required]
Unique event identifier.
- field latitude: float [Required]
Random event latitude (degrees)
- Constraints:
ge = -90
le = 90
- field longitude: float [Required]
Random event longitude (degrees)
- Constraints:
ge = -180
le = 180
EventDayChange
- pydantic settings EventDayChange
Standardized message indicating an inversion of the isDay boolean switch
Show JSON schema
{ "title": "EventDayChange", "description": "*Standardized message indicating an inversion of the isDay boolean switch*", "type": "object", "properties": { "eventId": { "description": "Unique event identifier.", "title": "Eventid", "type": "integer" }, "isDay": { "description": "True if sunrise, false if sunset.", "title": "Isday", "type": "integer" } }, "required": [ "eventId", "isDay" ] }
- Fields:
eventId (int)isDay (int)
- field eventId: int [Required]
Unique event identifier.
- field isDay: int [Required]
True if sunrise, false if sunset.
EventFinished
- pydantic settings EventFinished
Standardized message indicating only the eventId which indicates the event has terminated and is no longer observable
Show JSON schema
{ "title": "EventFinished", "description": "*Standardized message indicating only the eventId which indicates the event has terminated and is no longer observable*", "type": "object", "properties": { "eventId": { "description": "Unique event identifier.", "title": "Eventid", "type": "integer" } }, "required": [ "eventId" ] }
- Fields:
eventId (int)
- field eventId: int [Required]
Unique event identifier.