Skip to content

Commit

Permalink
Draft version of pydantic file v2
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoabellagarcia committed Aug 28, 2024
1 parent 90bdbd2 commit 5802bb3
Showing 1 changed file with 319 additions and 0 deletions.
319 changes: 319 additions & 0 deletions QueueMeasurement/code/code_for_using_pydantic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,319 @@
from __future__ import annotations

from enum import Enum
from typing import Optional, Union

from pydantic import AnyUrl, BaseModel, Field, constr


class MeasurementDeviceLocation(BaseModel):
Name: Optional[str] = Field(
None, description='Unique name for the location of the Measurement Device.'
)


class MeasurementDevice(BaseModel):
MeasurementDeviceLocation: Optional[MeasurementDeviceLocation] = Field(
None,
description='The geospatial or geopolitical location of a Measurement Device.',
)
Name: Optional[str] = Field(
None, description='Unique name for the Measurement Device.'
)


class MeasurementTimePeriod(BaseModel):
EndTime: Optional[str] = Field(
None,
description='The date and time at the end of the time period over which a Measurement is taken. Date time should be UTC, compliant with ISO 8601 format (e.g. 2023-04-20T11:54:59Z)',
)


class AirportElevationUnitOfMeasurement(BaseModel):
Name: Optional[str] = Field(
None,
description='The name of the unit of measure for an Airport elevation above sea level.',
)


class AirportElevation(BaseModel):
AirportElevationUnitOfMeasurement: Optional[AirportElevationUnitOfMeasurement] = (
Field(
None,
description='The unit of measure of the height of an Airport above sea level (FT for foot or M for metre).',
)
)
Name: Optional[str] = Field(
None, description='The name of an Airport elevation above sea level.'
)
Value: Optional[float] = Field(
None, description='The value of an Airport elevation above sea level.'
)


class AirportLocation(BaseModel):
Latitude: Optional[float] = Field(
None, description='Coordinate for latitude of the Airport.'
)
Longitude: Optional[float] = Field(
None, description='Coordinate for longitude of the Airport.'
)
Name: Optional[str] = Field(
None, description='Unique name for the Airport Location.'
)
Srid: Optional[float] = Field(
None,
description='A Spatial Reference System Identifier (SRID), to identify the spatial coordinate system definitions.',
)


class TerminalAreaLocation(BaseModel):
AirportLocation: Optional[AirportLocation] = Field(
None, description='The geospatial or geopolitical location of an Airport.'
)
Name: Optional[str] = Field(
None, description='Unique name for the Terminal Area Location.'
)


class ZoneAreaLocation(BaseModel):
Name: Optional[str] = Field(
None, description='Unique name for the Zone Area Location.'
)
TerminalAreaLocation: Optional[TerminalAreaLocation] = Field(
None,
description='The geospatial or geopolitical location of an Airport Terminal building.',
)


class CheckpointAreaLocation(BaseModel):
AirportElevation: Optional[AirportElevation] = Field(
None, description='The height of an Airport, above sea level.'
)
Latitude: Optional[float] = Field(
None, description='Coordinate of the latitude of the checkpoint area location.'
)
Longitude: Optional[float] = Field(
None, description='Coordinate of the longitude of the checkpoint area location.'
)
Name: Optional[str] = Field(
None,
description='Unique name for geospatial or geopolitical location of a Checkpoint Area Location.',
)
Srid: Optional[int] = Field(
None,
description='A Spatial Reference System Identifier (SRID), to identify the spatial coordinate system definitions',
)
ZoneAreaLocation: Optional[ZoneAreaLocation] = Field(
None,
description='The geospatial or geopolitical location of a Queuing Zone in a Terminal.',
)


class CheckpointFacilityOperatorParty(BaseModel):
Name: Optional[str] = Field(
None,
description='Unique name of the Operator Party for the Checkpoint Facility.',
)


class CheckpointFacilityType(BaseModel):
Code: Optional[str] = Field(
None, description='Unique code for the Checkpoint Facility Type.'
)
Description: Optional[str] = Field(
None, description='Description of the Checkpoint Facility Type.'
)


class AirportFacility(BaseModel):
IataCode: Optional[str] = Field(
None, description='Three character IATA code for the Airport.'
)
IcaoCode: Optional[str] = Field(
None, description='Four character ICAO code for the Airport.'
)
Name: Optional[str] = Field(None, description='Common name of the Airport.')


class TerminalFacility(BaseModel):
AirportFacility: Optional[AirportFacility] = Field(
None,
description='Information about an Airport as buildings or infrastructure used to provide services.',
)
Identifier: Optional[str] = Field(
None, description='Unique identifier for the Terminal Facility.'
)
Name: Optional[str] = Field(
None, description='Unique name for the Terminal Facility.'
)


class ConcourseFacility(BaseModel):
Identifier: Optional[str] = Field(
None, description='Unique identifier for the Concourse Facility.'
)
Name: Optional[str] = Field(
None, description='Unique name for the Concourse Facility.'
)
TerminalFacility: Optional[TerminalFacility] = Field(
None,
description='Information about an Airport Terminal as buildings or infrastructure used to provide services.',
)


class OperationTimePeriod(BaseModel):
ClosingTime: Optional[str] = Field(
None,
description='The date and time from when the Checkpoint Facility is closed. Date time should be UTC, compliant with ISO 8601 format (e.g. 2023-04-20T11:54:59Z)',
)
OpeningTime: Optional[str] = Field(
None,
description='The date and time from when the Checkpoint Facility is open. Date time should be UTC, compliant with ISO 8601 format (e.g. 2023-04-20T11:54:59Z)',
)


class CheckpointFacility(BaseModel):
CheckpointAreaLocation: Optional[CheckpointAreaLocation] = Field(
None, description='The geospatial or geopolitical location of a Checkpoint.'
)
CheckpointFacilityOperatorParty: Optional[CheckpointFacilityOperatorParty] = Field(
None,
description='Information that describes the Party responsible for the operation of a Checkpoint in an Airport.',
)
CheckpointFacilityType: Optional[CheckpointFacilityType] = Field(
None,
description='Information that describes the classification for a Checkpoint in an Airport. Values are: Security Screening, Customs.',
)
ConcourseFacility: Optional[ConcourseFacility] = Field(
None,
description='Information about an Airport Concourse as buildings or infrastructure used to provide services.',
)
Description: Optional[str] = Field(
None, description='Description of the Checkpoint Facility.'
)
Identifier: Optional[str] = Field(
None,
description='Unique identifier for the Checkpoint Facility. The identifier should be unique within an Airport.',
)
Name: Optional[str] = Field(
None,
description='Unique name for the Checkpoint Facility. The name should be unique within an Airport.',
)
OperationTimePeriod: Optional[OperationTimePeriod] = Field(
None, description='The time period over which the Checkpoint is operating.'
)


class PassengerProcessType(BaseModel):
Code: Optional[str] = Field(
None, description='Unique code for the type of Passenger Party Process.'
)
Description: Optional[str] = Field(
None, description='Description of the type of Passenger Party Process.'
)


class PassengerProcess(BaseModel):
Name: Optional[str] = Field(
None, description='Unique name for the Passenger Process.'
)
PassengerProcessType: Optional[PassengerProcessType] = Field(
None, description='Information about the type of Passenger Party Process.'
)


class QueueLocation(BaseModel):
Name: Optional[str] = Field(None, description='Unique name for the Queue Location.')


class QueueStatus(BaseModel):
Name: Optional[str] = Field(
None, description='Unique name for the status of the Passenger Queue.'
)


class QueueType(BaseModel):
Code: Optional[str] = Field(
None, description='Unique code for the type of Passenger Queue.'
)
Description: Optional[str] = Field(
None, description='Description of the type of Passenger Queue.'
)


class PassengerQueue(BaseModel):
CheckpointFacility: Optional[CheckpointFacility] = Field(
None,
description='Information about a Checkpoint in an Airport used to provide services. A Checkpoint facility is any facility where customers and passengers turn up and need to be processed, serviced or screened before proceeding to the next stage of their journey. ',
)
Identifier: Optional[str] = Field(
None,
description='Unique identifier for the Passenger Queue. The identifier should be unique within an Airport.',
)
Name: Optional[str] = Field(
None,
description='Name of the Passenger Queue. The name should be unique within an Airport.',
)
PassengerProcess: Optional[PassengerProcess] = Field(
None, description='Information about the Passenger Party Process.'
)
QueueLocation: Optional[QueueLocation] = Field(
None,
description='The geospatial or geopolitical location of a Passenger Queue.',
)
QueueStatus: Optional[QueueStatus] = Field(
None,
description='Information about the status of a Passenger Queue. Values can be: Open, Closed.',
)
QueueType: Optional[QueueType] = Field(
None,
description='Information about the type of a Passenger Queue. Values can be: Pre-Check, Private, Economy, Priority, KnownCrewMember.',
)


class Type(Enum):
QueueMeasurement = 'QueueMeasurement'


class QueueMeasurement(BaseModel):
MeasurementDevice: Optional[MeasurementDevice] = Field(
None,
description='Information about the device (equipment) used to take measurements (observations).',
)
MeasurementTimePeriod: Optional[MeasurementTimePeriod] = Field(
None, description='The time period over which a Measurement is taken.'
)
Occupancy: Optional[float] = Field(
None,
description='The count of people in the queue. The unit of measure is number of people. This metric is updated every five minutes.',
)
PassengerQueue: Optional[PassengerQueue] = Field(
None,
description='Information about the Passenger Party Queue. A line of people waiting to pass through the security checkpoint process.',
)
ProjectedWaitTime: Optional[float] = Field(
None,
description='The estimated time that a person entering the queue can expect to wait. The unit of measure is seconds. Estimates are required to be updated every five minutes.',
)
Throughput: Optional[float] = Field(
None,
description='The average number of passengers processed over the past hour. The unit of measure is passengers per hour. This metric is updated every five minutes.',
)
WaitTime: Optional[float] = Field(
None,
description='The duration that a person exiting the queue has experienced. The unit of measure is seconds. The amount represents the average number of seconds experienced by people exiting the queue in the last five minutes. The amounts are required to be updated every five minutes.',
)
id: Optional[
Union[
constr(
pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!, :\\\\]+$',
min_length=1,
max_length=256,
),
AnyUrl,
]
] = Field(None, description='Unique identifier of the entity')
type: Optional[Type] = Field(
None, description='It must be equal to QueueMeasurement.'
)

0 comments on commit 5802bb3

Please sign in to comment.