示例#1
0
tire_input_parameters = api.model(
    'TireInputParameters', {
        "bike_id":
        fields.String(description="corresponding bike ID",
                      required=True,
                      example="UUID4"),
        "active":
        fields.Boolean(description="mounted on the bike or not",
                       required=False,
                       example="false"),
        "rim":
        fields.String(description="rim on which the tire is mounted",
                      required=False,
                      example="Alpina black"),
        "category":
        fields.String(
            description="slick or rain tire", required=True, example="slick"),
        "manufacturer":
        fields.String(description="manufacturer of the tire",
                      required=True,
                      example="Metzeler"),
        "name":
        fields.String(description="name of the tire",
                      required=False,
                      example="Metzeler"),
        "compound":
        fields.String(
            description="compound of the tire", required=False, example="K1"),
        "axis":
        fields.String(
            description="front or rear", required=True, example="front"),
        "dimension":
        fields.String(description="dimension of the tire",
                      required=False,
                      example="125/75R420"),
        "dot":
        fields.String(description="production week and year of the tire",
                      required=True,
                      example="1521"),
        "condition":
        fields.Raw(description="condition of the tire",
                   required=True,
                   example={
                       "left_outer": 1.0,
                       "left_middle": 1.0,
                       "center": 1.0,
                       "right_middle": 1.0,
                       "right_outer": 1.0
                   }),
        "operating_hours":
        fields.Float(description="operating hours of the tires",
                     required=True,
                     example=0.0),
        "comment":
        fields.String(description="comment on the tire",
                      required=False,
                      example="comment on the tire")
    })
示例#2
0
training_input_parameters = api.model(
    'TrainingInputParameters', {
        "location":
        fields.String(description="location of the training",
                      required=True,
                      example="track name"),
        "weather_hourly":
        fields.Raw(description="hourly track weather data",
                   required=False,
                   example=[{
                       "lat": 47.4325306,
                       "lon": 6.7046713,
                       "temp": {
                           "value": 17.5,
                           "units": "C"
                       },
                       "observation_time": {
                           "value": "2020-08-22T07:00:00.000Z"
                       },
                       "type": "measurement"
                   }, {
                       "lat": 47.4325306,
                       "lon": 6.7046713,
                       "temp": {
                           "value": 23.49,
                           "units": "C"
                       },
                       "observation_time": {
                           "value": "2020-08-22T16:00:00.000Z"
                       },
                       "type": "forecast"
                   }]),
        "datetime_display":
        fields.DateTime(description="utc time stamp in seconds",
                        required=True,
                        example=datetime.now(timezone.utc).timestamp()),
    })
示例#3
0
ns = api.namespace('maintenance', description='Operations related to maintenance entries.')
history_schema = HistorySchema()
maintenance_schema = MaintenanceSchema()
bike_schema = BikeSchema()

maintenance_input_parameters = api.model('MaintenanceInputParameters', {
    "category":
        fields.String(description="maintenance work category according to bike module",
                      required=True, example="maintenance category"),
    "name":
        fields.String(description="maintenance work name", required=True, example="maintenance name"),
    "interval_amount":
        fields.Float(description="interval of maintenance work", required=True, example=10.0),
    "interval_unit":
        fields.String(description="unit of maintenance interval", required=False, example="h"),
    "interval_type":
        fields.String(description="type of maintenance interval", required=False, example="planned maintenance"),
    "tags_default":
        fields.Raw(description="default tags of maintenance work", required=False, example=[
            "checked",
            "fixed",
            "replaced",
        ]),
})
maintenance_query_parameters = api.model('MaintenanceQueryParameters', {
    "bike_id":
        fields.String(description="id of the bike where this maintenance belongs to", required=False, example="UUID4"),
    "category":
        fields.String(description="maintenance work category according to bike module",
                      required=False, example="maintenance category"),
示例#4
0
coach_input_parameters = api.model('CoachInputParameters', {
    "category":
        fields.String(description="bike suspension end", required=True, example="category name"),
    "symptom":
        fields.Raw(description="suspension symptom", required=True, example={
            "id": "example ID",
            "name": "example name",
        }),
    "notes":
        fields.String(description="notes", required=False, example="notes on the symptom"),
    "questions":
        fields.Raw(description="array of questions in terms of troubleshouting", required=False, example=[
            "example question 1",
            "example question 2",
        ]),
    "advice":
        fields.Raw(description="object of possible problems and solutions", required=True, example={
            "A": {
                "problem": "problem A description",
                "solution": [
                    "solution approach 1 of the problem",
                    "solution approach 2 of the problem",
                ],
            },
            "B": {
                "problem": "problem B description",
                "solution": [
                    "solution approach 1 of the problem",
                    "solution approach 2 of the problem",
                ],
            },
        }),
})
示例#5
0
from flask_restx import fields
from backend.api import api

well = api.model('Well', {
    'well_id': fields.Integer(readOnly=True),
    'api': fields.String(readOnly=True),
    'well_name': fields.String(readOnly=True),
    'country': fields.String(readOnly=True),
    'basin': fields.String(readOnly=True),
    'state': fields.String(readOnly=True),
    'county': fields.String(readOnly=True),
    'township': fields.String(readOnly=True),
    'section': fields.String(readOnly=True),
    'range': fields.String(readOnly=True),
    'field': fields.String(readOnly=True),
    'target': fields.String(readOnly=True),
    'type': fields.String(readOnly=True),
    'lat': fields.Float(readOnly=True),
    'long': fields.Float(readOnly=True),
    'elevation': fields.Float(readOnly=True),
    'rkb': fields.Float(readOnly=True),
})

job = api.model('Job', {
    'job_num': fields.Integer(readOnly=True),
    'job_id': fields.String(readOnly=True),
    'well_id': fields.Integer(attribute='well.well_id'),
    'operator': fields.String(readOnly=True),
    'rig': fields.String(readOnly=True),
    'dd_job': fields.String(readOnly=True),
    'mwd_job': fields.String(readOnly=True),
示例#6
0
bike_input_parameters = api.model(
    'BikeInputParameters', {
        "operating_hours":
        fields.Float(
            description="operating hours", required=True, example=66.1),
        "manufacturer":
        fields.String(description="bike manufacturer",
                      required=True,
                      example="bike manufacturer"),
        "model":
        fields.String(
            description="bike model", required=True, example="bike model"),
        "year":
        fields.Integer(description="bike year", required=True, example=2020),
        "ccm":
        fields.Float(description="engine size", required=False, example=449.7),
        "stroke":
        fields.Float(description="engine stroke", required=False,
                     example=63.0),
        "piston":
        fields.Float(description="engine piston", required=False,
                     example=97.0),
        "slick_front_name":
        fields.String(description="name of front slick tire",
                      required=False,
                      example="front slick name"),
        "slick_front_notes":
        fields.String(description="front slick tire application notes",
                      required=False,
                      example="front slick notes"),
        "slick_front_pressure":
        fields.Raw(description="recommended pressure of front slick tire",
                   required=False,
                   example=[
                       {
                           "temperature": 40,
                           "pressure": 1.7
                       },
                       {
                           "temperature": 25,
                           "pressure": 1.8
                       },
                   ]),
        "slick_rear_name":
        fields.String(description="name of rear slick tire",
                      required=False,
                      example="rear slick name"),
        "slick_rear_notes":
        fields.String(description="rear slick tire application notes",
                      required=False,
                      example="rear slick notes"),
        "slick_rear_pressure":
        fields.Raw(description="recommended pressure of rear slick tire",
                   required=False,
                   example=[
                       {
                           "temperature": 40,
                           "pressure": 1.7
                       },
                       {
                           "temperature": 25,
                           "pressure": 1.8
                       },
                   ]),
        "rain_front_name":
        fields.String(description="name of front rain tire",
                      required=False,
                      example="front rain tire name"),
        "rain_front_notes":
        fields.String(description="front rain tire application notes",
                      required=False,
                      example="front rain tire notes"),
        "rain_front_pressure":
        fields.Raw(description="recommended pressure of front rain tire",
                   required=False,
                   example=[
                       {
                           "temperature": 40,
                           "pressure": 1.7
                       },
                       {
                           "temperature": 25,
                           "pressure": 1.8
                       },
                   ]),
        "rain_rear_name":
        fields.String(description="name of rear rain tire",
                      required=False,
                      example="rear rain tire name"),
        "rain_rear_notes":
        fields.String(description="rear rain tire application notes",
                      required=False,
                      example="rear rain tire notes"),
        "rain_rear_pressure":
        fields.Raw(description="recommended pressure of rear rain tire",
                   required=False,
                   example=[
                       {
                           "temperature": 40,
                           "pressure": 1.7
                       },
                       {
                           "temperature": 25,
                           "pressure": 1.8
                       },
                   ]),
        "setup":
        fields.Raw(description="bike suspension and engine setup",
                   required=False,
                   example=[
                       {
                           "category": "Engine",
                           "group": None,
                           "name": "Power Mode",
                           "ticks_available": 1,
                           "ticks_current": 1,
                           "ticks_standard": 1,
                       },
                       {
                           "category": "Suspension",
                           "group": "Fork",
                           "name": "Compression",
                           "ticks_available": 37,
                           "ticks_current": 14,
                           "ticks_standard": 15,
                       },
                   ]),
    })
示例#7
0
from backend.database.models.sparepart import SparepartModel, SparepartSchema
from backend.database.models.sparepartitem import SparepartitemSchema

ns = api.namespace('sparepart',
                   description='Operations related to spareparts.')
sparepart_schema = SparepartSchema()
sparepartitem_schema = SparepartitemSchema()

sparepart_input_parameters = api.model(
    'SparepartInputParameters', {
        "name":
        fields.String(description="name of the spare part",
                      required=True,
                      example="spare part name"),
        "module":
        fields.String(
            description="bike module where the spare part belongs to",
            required=True,
            example="Engine"),
        "min_stock":
        fields.Integer(description="minimal stock of the spare part",
                       required=True,
                       example=2),
    })
sparepart_query_parameters = api.model(
    'SparepartQueryParameters', {
        "bike_id":
        fields.String(
            description="id of the bike where the spare part belongs to",
            required=False,
            example="UUID4"),
        "name":
示例#8
0
laptime_schema = LaptimeSchema()

laptime_input_parameters = api.model(
    'LaptimeInputParameters', {
        "session_id":
        fields.String(description="corresponding session ID",
                      required=True,
                      example="UUID4"),
        "lap_no":
        fields.Integer(
            description="lap number of session", required=True, example=1),
        "valid":
        fields.Boolean(
            description="validity of lap", required=False, example=True),
        "laptime_seconds":
        fields.Float(
            description="lap time in seconds", required=False, example=66.61),
        "sectors":
        fields.Raw(description="sector times",
                   required=False,
                   example={
                       "Sector 1": 39.9,
                       "Sector 2": 36.57
                   }),
        "datetime_display":
        fields.DateTime(description="utc time stamp in seconds",
                        required=False,
                        example=datetime.now(timezone.utc).timestamp())
    })

示例#9
0
ns = api.namespace('session',
                   description='Operations related to training sessions.')
session_schema = SessionSchema()
laptime_schema = LaptimeSchema()

session_input_parameters = api.model(
    'SessionInputParameters', {
        "training_id":
        fields.String(description="corresponding training ID",
                      required=True,
                      example="UUID4"),
        "bike_id":
        fields.String(description="corresponding bike ID",
                      required=True,
                      example="UUID4"),
        "setup_id":
        fields.String(description="corresponding setup ID",
                      required=True,
                      example="UUID4"),
        "datetime_display":
        fields.DateTime(description="utc time stamp in seconds",
                        required=True,
                        example=datetime.now(timezone.utc).timestamp()),
    })


@ns.route('/')
class SessionCollection(Resource):
    @api.doc(security='apikey')
    @api.response(200, 'Training session list successfully fetched.')
示例#10
0
setup_input_parameters = api.model('SetupInputParameters', {
    "training_id":
        fields.String(description="corresponding training ID", required=True, example="UUID4"),
    "bike_id":
        fields.String(description="corresponding bike ID", required=True, example="UUID4"),
    "operating_hours":
        fields.Float(description="operating hours", required=True, example=66.1),
    "weather_current":
        fields.Raw(description="current track weather data", required=False, example={
            "lat": 49.2966279,
            "lon": 8.601037,
            "temp": {
                "value": 30.04,
                "units": "C"
            },
            "type": "measurement"
        }),
    "slick_pressure_front":
        fields.Float(description="pressure of front slick tire", required=False, example=2.0),
    "slick_pressure_rear":
        fields.Float(description="pressure of rear slick tire", required=False, example=2.0),
    "rain_pressure_front":
        fields.Float(description="pressure of front rain tire", required=False, example=2.0),
    "rain_pressure_rear":
        fields.Float(description="pressure of front rear tire", required=False, example=2.0),
    "setup":
        fields.Raw(description="bike suspension and engine setup", required=False, example=[
            {
                "category": "Engine",
                "group": None,
                "name": "Power Mode",
                "ticks_available": 1,
                "ticks_current": 1,
                "ticks_standard": 1
            },
            {
                "category": "Suspension",
                "group": "Fork",
                "name": "Compression",
                "ticks_available": 37,
                "ticks_current": 14,
                "ticks_standard": 15
            },
        ]),
    "comment":
        fields.String(description="comment", required=False, example="comment"),
    "datetime_display":
        fields.DateTime(description="utc time stamp in seconds", required=True,
                        example=datetime.now(timezone.utc).timestamp()),
})
示例#11
0
history_input_parameters = api.model(
    'HistoryInputParameters', {
        "maintenance_id":
        fields.String(description="corresponding maintenance ID",
                      required=True,
                      example="UUID4"),
        "bike_id":
        fields.String(description="corresponding bike ID",
                      required=True,
                      example="UUID4"),
        "operating_hours":
        fields.Float(
            description=
            "operating hours of the bike when the maintenance work was done",
            required=True,
            example=66.1),
        "comment":
        fields.String(description="comment on the maintenance entry",
                      required=False,
                      example="comment on the maintenance entry"),
        "tags":
        fields.Raw(description="tags",
                   required=False,
                   example=[
                       "checked",
                       "fixed",
                       "replaced",
                   ]),
        "datetime_display":
        fields.DateTime(description="utc time stamp in seconds",
                        required=True,
                        example=datetime.now(timezone.utc).timestamp()),
    })