class SetpointInterpolationSchema(MappingSchema): name = SchemaNode(typ=String(), title='Name') order = SchemaNode(typ=Int(), title='Type (order)', default=deferred_order_default, widget=SelectWidget(values=[(0, 'Constant'), (1, 'Linear'), (2, 'Quadratic'), (3, 'Cubic'), (4, 'Spline')])) start_value = SchemaNode(typ=Float(), title='Start Value', default=deferred_start_value_default) end_time = SchemaNode(typ=Int(), title='End Time', default=deferred_end_time_default) end_value = SchemaNode(typ=Float(), title='End Value', default=deferred_end_value_default, missing=None) description = SchemaNode(typ=String(), title='Description', default=deferred_description_default, missing=None)
class ContinuousReleaseSchema(ReleaseSchema): initial_elements = SchemaNode(Int(), missing=drop) start_position = WorldPoint() end_position = WorldPoint(missing=drop) _next_release_pos = WorldPointNumpy(missing=drop) end_release_time = SchemaNode(LocalDateTime(), missing=drop, validator=convertible_to_seconds) num_per_timestep = SchemaNode(Int(), missing=drop) description = 'ContinuousRelease object schema'
class Dropout(MappingSchema): year = general_rules.year dropouts_with_mbo1_dimploma = SchemaNode(Int(), validator=Range(min=0, max=5000)) dropouts_with_vmbo_diploma = SchemaNode(Int(), validator=Range(min=0, max=5000)) dropouts_without_diploma = SchemaNode(Int(), validator=Range(min=0, max=5000)) education_structure = SchemaNode(String(), validator=Length(min=3, max=75)) total_dropouts = SchemaNode(Int(), validator=Range(min=0, max=5000)) total_students = SchemaNode(Int(), validator=Range(min=0, max=5000))
class ContinuousReleaseSchema(BaseReleaseSchema): initial_elements = SchemaNode(Int(), missing=drop, save=True, update=True) start_position = WorldPoint(save=True, update=True) end_position = WorldPoint(missing=drop, save=True, update=True) _next_release_pos = WorldPointNumpy(missing=drop, save=True, read_only=True) end_release_time = SchemaNode(LocalDateTime(), missing=drop, validator=convertible_to_seconds, save=True, update=True) num_elements = SchemaNode(Int()) num_per_timestep = SchemaNode(Int(), missing=drop, save=True, update=True) description = 'ContinuousRelease object schema'
class NetCDFOutputSchema(BaseSchema): 'colander schema for serialize/deserialize object' netcdf_filename = SchemaNode(String(), missing=drop) all_data = SchemaNode(Bool(), missing=drop) compress = SchemaNode(Bool(), missing=drop) _start_idx = SchemaNode(Int(), missing=drop) _middle_of_run = SchemaNode(Bool(), missing=drop)
class CostPerYear(MappingSchema): amount_euro = SchemaNode(Int(), validator=Range(min=0, max=1000)) explanation = SchemaNode(String()) link = SchemaNode(String()) other_costs = SchemaNode(Boolean()) # Year can be a bunch of things ("Leerjaar 1", "alle jaren", ...) year = SchemaNode(String(), validator=Length(min=3, max=75))
class SchoolVOBranch(MappingSchema): address = general_rules.Address() avg_education_hours_per_student = AverageEducationHours() avg_education_hours_per_student_url = SchemaNode(String(), validator=url) board = SchemaNode(String(), validator=Length(min=3, max=100)) board_id = general_rules.board_id branch_id = general_rules.branch_id brin = general_rules.brin building_img_url = SchemaNode(String(), validator=url) costs = Costs() costs_url = SchemaNode(String(), validator=url) denomination = general_rules.denomination education_structures = general_rules.EducationStructures() email = SchemaNode(String(), validator=Email()) logo_img_url = SchemaNode(String(), validator=url) municipality = general_rules.municipality municipality_id = general_rules.municipality_code name = general_rules.name parent_satisfaction = Satisfactions() parent_satisfaction_url = SchemaNode(String(), validator=url) phone = general_rules.phone profile = SchemaNode(String(), validator=Length(min=3, max=500)) province = general_rules.province schoolkompas_status_id = SchemaNode(Int(), validator=Range(min=0,\ max=1000)) schoolvo_code = SchemaNode(String(), validator=Length(min=14, max=14)) student_satisfaction = Satisfactions() student_satisfaction_url = SchemaNode(String(), validator=url) website = general_rules.website
class TrajectoryGeoJsonSchema(BaseOutputterSchema): ''' Nothing is required for initialization ''' round_data = SchemaNode(Bool(), missing=drop, save=True, update=True) round_to = SchemaNode(Int(), missing=drop, save=True, update=True) output_dir = SchemaNode(String(), missing=drop, save=True, update=True)
def ballot_voting_form(ballot_voting, request): yes_no_choices = [(True, _('Yes')), (False, _('No')), (None, _('Abstention'))] max_points = 9 if len(ballot_voting.options) > 3 else 3 point_choices = [(i, str(i)) for i in range(max_points+1)] schema = Schema() for option in ballot_voting.options: option_schema = SchemaNode(Mapping(), name=str(option.uuid), title=option.title) option_schema.add(SchemaNode( Boolean(), validator=OneOf([x[0] for x in yes_no_choices]), widget=RadioChoiceWidget(values=yes_no_choices, inline=True), name='yes_no', title=f'Stimmst du dem Antrag zu?')) option_schema.add(SchemaNode( Int(), validator=OneOf([x[0] for x in point_choices]), widget=RadioChoiceWidget(values=point_choices, inline=True, null_value='0'), name='points', title='Welche Punktzahl gibst du dem Antrag?', missing=0)) schema.add(option_schema) form = Form(schema, request, buttons=[Button(title=_('check'))]) return form
class BaseReleaseSchema(ObjTypeSchema): release_time = SchemaNode( LocalDateTime(), validator=convertible_to_seconds, ) num_released = SchemaNode(Int(), read_only=True, test_equal=False)
class CurrentRating(MappingSchema): # education_structure = None # TODO owinsp_id = SchemaNode(Int(), validator=Range(min=0)) owinsp_url = general_rules.url() rating = SchemaNode(String(), validator=Length(min=4, max=20)) rating_excerpt = SchemaNode(String(), validator=Length(min=4, max=500)) rating_valid_since = general_rules.publication_date()
class NewDeviceSchema(ComponentSchema): device_type = SchemaNode( typ=Int(), title='Device Type', descripition='the type of device being controlled', default=deferred_type_default, widget=deferred_type_widget)
class ProjectionSchema(ObjTypeSchema): bounding_box = TupleSchema( missing=drop, save=True, update=False, children=[ TupleSchema(children=[SchemaNode(Float()), SchemaNode(Float())]), TupleSchema(children=[SchemaNode(Float()), SchemaNode(Float())]) ]) image_size = TupleSchema(save=True, update=True, missing=drop, children=[SchemaNode(Int()), SchemaNode(Int())])
class CalendarEntrySchema(MappingSchema): interpolation = SchemaNode( typ=Int(), title='Interpolation', descripition='the type of device being controlled', default=deferred_interpolation_default, widget=deferred_interpolation_widget)
class ComponentMoverSchema(ProcessSchema): '''static schema for ComponentMover''' filename1 = SchemaNode( String(), missing=drop, save=True, update=True, isdatafile=True, test_equal=False ) filename2 = SchemaNode( String(), missing=drop, save=True, update=True, isdatafile=True, test_equal=False ) scale_refpoint = WorldPoint( missing=drop, save=True, update=True ) pat1_angle = SchemaNode( Float(), missing=drop, save=True, update=True ) pat1_speed = SchemaNode( Float(), missing=drop, save=True, update=True ) pat1_speed_units = SchemaNode( Int(), missing=drop, save=True, update=True ) pat1_scale_to_value = SchemaNode( Float(), missing=drop, save=True, update=True ) pat2_angle = SchemaNode( Float(), missing=drop, save=True, update=True ) pat2_speed = SchemaNode( Float(), missing=drop, save=True, update=True ) pat2_speed_units = SchemaNode( Int(), missing=drop, save=True, update=True ) pat2_scale_to_value = SchemaNode( Float(), missing=drop, save=True, update=True ) scale_by = SchemaNode( Int(), missing=drop, save=True, update=True ) wind = WindSchema( missing=drop, save=True, update=True, save_reference=True ) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class ModelSchema(MappingSchema): id = SchemaNode(String(), missing=drop) start_time = SchemaNode(LocalDateTime(), default=now, validator=validators.convertible_to_seconds) duration_days = SchemaNode(Int(), default=1, validator=Range(min=0)) duration_hours = SchemaNode(Int(), default=0, validator=Range(min=0)) uncertain = SchemaNode(Bool(), default=False) time_step = SchemaNode(Float(), default=0.1) surface_release_spills = PointSourceReleasesSchema(default=[], missing=drop) wind_movers = WindMoversSchema(default=[], missing=drop) random_movers = RandomMoversSchema(default=[], missing=drop) cats_movers = CatsMoversSchema(default=[], missing=drop) grid_current_movers = GridCurrentMoversSchema(default=[], missing=drop) winds = WindsSchema(default=[], missing=drop) map = MapSchema(missing=drop)
class InitWindagesSchema(base_schema.ObjType): """ windages initializer values """ windage_range = WindageSchema() windage_persist = SchemaNode(Int(), default=900, description='windage persistence in minutes') name = 'windages'
class InitWindagesSchema(base_schema.ObjTypeSchema): """ windages initializer values """ windage_range = WindageSchema( save=True, update=True, ) windage_persist = SchemaNode( Int(), default=900, save=True, update=True, )
class StageConfigurationSchema(MappingSchema): parameter = SchemaNode( typ=Int(), title='Parameter', widget=SelectWidget(values=[(_id, name) for _id, name in DBSession.query( Parameter._id, Parameter.name)])) time = SchemaNode(typ=Time(), title='Time', default=time(0, 0)) setpoint = SchemaNode(typ=Float(), title='Setpoint') upper_limit = SchemaNode(typ=Float(), title='Upper limit') lower_limit = SchemaNode(typ=Float(), title='Lower limit')
class LimitResults(Schema): # description = "Limit the number of processed documents" max_count = SchemaNode( Int(), default=10, missing=10, title='Results limit', description='Set to 0 if you want unlimited results', )
class PointLineReleaseSchema(BaseReleaseSchema): ''' Contains properties required for persistence ''' # start_position + end_position are only persisted as WorldPoint() instead # of WorldPointNumpy because setting the properties converts them to Numpy # _next_release_pos is set when loading from 'save' file and this does have # a setter that automatically converts it to Numpy array so use # WorldPointNumpy schema for it. start_position = WorldPoint(save=True, update=True) end_position = WorldPoint(missing=drop, save=True, update=True) end_release_time = SchemaNode(LocalDateTime(), missing=drop, validator=convertible_to_seconds, save=True, update=True) num_elements = SchemaNode(Int(), missing=drop) num_per_timestep = SchemaNode(Int(), missing=drop) release_mass = SchemaNode(Float()) description = 'PointLineRelease object schema'
class DocumentSchema(BaseDocumentSchema): """Document schema""" api = SchemaNode(String(), title=_("Document base REST API URL")) oid = SchemaNode(String(), title=_("Document unique identifier")) version = SchemaNode(Int(), title=_("Document version")) href = SchemaNode(String(), title=_("Absolute URL of document data file")) hash = SchemaNode(String(), title=_("SHA512 hash of document data file")) filesize = SchemaNode(Int(), title=_("Document file size")) content_type = SchemaNode(String(), title=_("Document content type")) creator = SchemaNode(String(), title=_("Document creator principal ID")) created_time = SchemaNode(DateTime(), title=_("Document creation timestamp")) owner = SchemaNode(String(), title=_("Current document owner")) updater = SchemaNode(String(), title=_("Last document updater principal ID")) updated_time = SchemaNode(DateTime(), title=_("Last document update timestamp")) status_updater = SchemaNode( String(), title=_("Last workflow status updater principal ID")) status_update_time = SchemaNode( DateTime(), title=_("Last document status update timestamp"))
class DeviceLinkSchema(MappingSchema): device = SchemaNode(typ=Int(), title='Parameter', default=deferred_device_default, widget=deferred_device_widget) target = SchemaNode(typ=String(), title='Target Log', default='value', widget=SelectWidget(values=[('value', 'Values'), ('setpoint', 'Setpoints')])) color = SchemaNode(typ=String(), title='Color', default='#FF0000', widget=TextInputWidget())
class StudentByStructure(MappingSchema): department = SchemaNode(String(), validator=Length(min=3, max=300)) education_name = SchemaNode(String(), validator=Length(min=3, max=300)) education_structure = general_rules.education_structure elementcode = SchemaNode(Int(), validator=Range(min=0)) lwoo = SchemaNode(Boolean()) vmbo_sector = SchemaNode(String(), validator=Length(min=3, max=300)) year_1 = StudentsEnrolledInStructure() year_2 = StudentsEnrolledInStructure() year_3 = StudentsEnrolledInStructure() year_4 = StudentsEnrolledInStructure() year_5 = StudentsEnrolledInStructure() year_6 = StudentsEnrolledInStructure()
class InterpolationKnotSchema(MappingSchema): interpolation_id = SchemaNode(typ=Int(), title='Name', default=deferred_interpolation_id_default, widget=HiddenWidget(readonly=True)) time = SchemaNode( typ=Float(), title='Time', description='between 0 and 1 (becomes start to end time)', default=deferred_time_default) value = SchemaNode(typ=Float(), title='Value', default=deferred_value_default)
class ParameterLinkSchema(MappingSchema): parameter = SchemaNode(typ=Int(), title='Parameter', default=deferred_parameter_default, widget=deferred_parameter_widget) target = SchemaNode( typ=String(), title='Target Log', default=deferred_target_default, widget=SelectWidget(values=[('value', 'Values'), ('setpoint', 'Setpoints')])) color = SchemaNode(typ=String(), title='Color', default=deferred_color_default, widget=TextInputWidget())
class StudentResidence(MappingSchema): municipality = general_rules.municipality municipality_code = general_rules.municipality_code city = general_rules.city zip_code = SchemaNode(String(), validator=Length(min=4, max=4)) year_1 = SchemaNode(Int(), validator=Range(min=0)) year_2 = SchemaNode(Int(), validator=Range(min=0)) year_3 = SchemaNode(Int(), validator=Range(min=0)) year_4 = SchemaNode(Int(), validator=Range(min=0)) year_5 = SchemaNode(Int(), validator=Range(min=0)) year_6 = SchemaNode(Int(), validator=Range(min=0))
class NetCDFOutputSchema(BaseOutputterSchema): 'colander schema for serialize/deserialize object' netcdf_filename = FilenameSchema( missing=drop, save=True, update=False, test_equal=False ) which_data = SchemaNode( String(), default='standard', missing=drop, save=True, update=True ) compress = SchemaNode( Bool(), missing=drop, save=True, update=True ) _start_idx = SchemaNode( Int(), missing=drop, save=True, read_only=True, test_equal=False ) _middle_of_run = SchemaNode( Bool(), missing=drop, save=True, read_only=True, test_equal=False )
class DuoVoBoard(MappingSchema): address = general_rules.Address() correspondence_address = general_rules.Address() board_id = general_rules.board_id name = general_rules.name phone = general_rules.phone municipality = general_rules.municipality municipality_code = general_rules.municipality_code administrative_office_id = SchemaNode(Int()) denomination = general_rules.denomination financial_key_indicators_per_year_reference_date = SchemaNode(Date(), missing=True) reference_year = general_rules.reference_year website = general_rules.website vavo_students_reference_url = general_rules.website vavo_students_reference_date = SchemaNode(Date(), missing=True) vavo_students = VavoStudents()
class DuoPoBoard(MappingSchema): address = general_rules.Address() correspondence_address = general_rules.Address() board_id = general_rules.board_id name = general_rules.name phone = general_rules.phone municipality = general_rules.municipality municipality_code = general_rules.municipality_code administrative_office_id = SchemaNode(Int()) denomination = general_rules.denomination # TODO: #financial_key_indicators_per_year = FinancialKeyIndicatorsPerYear() financial_key_indicators_per_year_reference_date = SchemaNode(Date(), missing=True) financial_key_indicators_per_year_url = general_rules.website reference_year = general_rules.reference_year website = general_rules.website