Ejemplo n.º 1
0
 def resolve_controlaction(self, info, date, time, mac, user, command, params, result):
     return [ControlActionMapper.init_scalar(item) for item in cassandra_mediator.select_control_actions(
         date = None if not date else datetime.datetime.strptime(date, DATE_PATTERN).date(),
         time = None if not time else datetime.datetime.strptime(time, TIME_PATTERN).time(),
         mac_address = None if not mac else string_to_bytes(mac), 
         user_id = None if not user else string_to_bytes(user), 
         command = command, params = params, result = result)]
Ejemplo n.º 2
0
 def mutate(self, info, timestamp, system, result, set_system, set_result):
     parsed_timestamp = None if not timestamp else datetime.datetime.strptime(timestamp, TIMESTAMP_PATTERN)
     SystemTest.validate_system_id(string_to_bytes(set_system))
     cassandra_mediator.update_system_tests(date = None if not parsed_timestamp else parsed_timestamp.date,\
         time = None if not parsed_timestamp else parsed_timestamp.time, system_id = None if not system else string_to_bytes(system),\
         result = result, set_system_id = None if not set_system else string_to_bytes(set_system), set_result = set_result)
     ok = True
     return UpdateSystemTests(ok = ok)
 def mutate(self, info, timestamp, mac, user, command, params, result, set_mac, set_user, set_command, set_params, set_result):
     parsed_timestamp = None if not timestamp else datetime.datetime.strptime(timestamp, TIMESTAMP_PATTERN)
     cassandra_mediator.update_control_actions(date = None if not parsed_timestamp else parsed_timestamp.date,\
         time = None if not parsed_timestamp else parsed_timestamp.time, user_id = None if not user else string_to_bytes(user),\
         mac_address = None if not mac else string_to_bytes(mac), command = command, params = params, result = result, 
         set_user_id = None if not set_user else ControlAction.validate_user_id(string_to_bytes(set_user)),\
         set_mac_address = None if not set_mac else ControlAction.validate_mac_address(string_to_bytes(set_mac)),\
         set_command = set_command, set_params = set_params, set_result = set_result)
     ok = True
     return UpdateControlActions(ok = ok)
 def mutate(self, info, timestamp, mac, user, command, params, result,
            set_mac, set_user, set_command, set_params, set_result):
     parsed_timestamp = None if not timestamp else datetime.datetime.strptime(
         timestamp, TIMESTAMP_PATTERN)
     cassandra_mediator.update_control_actions(date = None if not parsed_timestamp else parsed_timestamp.date,\
         time = None if not parsed_timestamp else parsed_timestamp.time, user_id = None if not user else string_to_bytes(user),\
         mac_address = None if not mac else string_to_bytes(mac), command = command, params = params, result = result,
         set_user_id = None if not set_user else ControlAction.validate_user_id(string_to_bytes(set_user)),\
         set_mac_address = None if not set_mac else ControlAction.validate_mac_address(string_to_bytes(set_mac)),\
         set_command = set_command, set_params = set_params, set_result = set_result)
     ok = True
     return UpdateControlActions(ok=ok)
Ejemplo n.º 5
0
 def resolve_controlaction(self, info, date, time, mac, user, command,
                           params, result):
     return [
         ControlActionMapper.init_scalar(item)
         for item in cassandra_mediator.select_control_actions(
             date=None if not date else datetime.datetime.
             strptime(date, DATE_PATTERN).date(),
             time=None if not time else datetime.datetime.
             strptime(time, TIME_PATTERN).time(),
             mac_address=None if not mac else string_to_bytes(mac),
             user_id=None if not user else string_to_bytes(user),
             command=command,
             params=params,
             result=result)
     ]
Ejemplo n.º 6
0
def create_shift_state(timestamp, shift_id, warning_level,
                       remaining_cartridges, remaining_air,
                       remaining_electricity, comment):
    return ShiftState.create(\
       date = timestamp.date(), time = timestamp.time(), shift_id = string_to_bytes(shift_id),\
       warning_level = warning_level, remaining_cartridges = remaining_cartridges, remaining_air = remaining_air,\
       remaining_electricity = remaining_electricity, comment = comment)
Ejemplo n.º 7
0
def create_operation_state(timestamp, boat_id, operation_id, operation_status, distance_to_the_ship, zenith, azimuth,\
  hydrogenium, helium, lithium, beryllium, borum,\
    carboneum, nitrogenium, oxygenium, fluorum, neon, natrium, magnesium, aluminium, silicium, phosphorus, sulfur, chlorum, argon, kalium, calcium,\
    scandium, titanium, vanadium, chromium, manganum, ferrum, cobaltum, niccolum, cuprum, zincum, gallium, germanium, arsenicum, selenium, bromum,\
    crypton, rubidium, strontium, yttrium, zirconium, niobium, molybdaenum, technetium, ruthenium, rhodium, palladium, argentum, cadmium, indium,\
    stannum, stibium, tellurium, iodium, xenon, caesium, barium, lanthanum, cerium, praseodymium, neodymium, promethium, samarium, europium, gadolinium,\
    terbium, dysprosium, holmium, erbium, thulium, ytterbium, lutetium, hafnium, tantalum, wolframium, rhenium, osmium, iridium, platinum, aurum,\
    hydrargyrum, thallium, plumbum, bismuthum, polonium, astatum, radon, francium, radium, actinium, thorium, protactinium, uranium, neptunium,\
    plutonium, americium, curium, berkelium, californium, einsteinium, fermium, mendelevium, nobelium, lawrencium, rutherfordium, dubnium,\
    seaborgium, bohrium, hassium, meitnerium, darmstadtium, roentgenium, copernicium, nihonium, flerovium, moscovium, livermorium, tennessium,\
    oganesson, comment):
    return OperationState.create(date = timestamp.date(), time = timestamp.time(), boat_id = string_to_bytes(boat_id) if boat_id != '' else None,
      operation_id = string_to_bytes(operation_id), operation_status = operation_status, distance_to_the_ship = distance_to_the_ship,\
      zenith = zenith, azimuth = azimuth, hydrogenium = hydrogenium, helium = helium, lithium = lithium, beryllium = beryllium,\
      borum = borum, carboneum = carboneum, nitrogenium = nitrogenium, oxygenium = oxygenium, fluorum = fluorum, neon = neon,\
      natrium = natrium, magnesium = magnesium, aluminium = aluminium, silicium = silicium, phosphorus = phosphorus, sulfur = sulfur,\
      chlorum = chlorum, argon = argon, kalium = kalium, calcium = calcium, scandium = scandium, titanium = titanium, vanadium = vanadium,\
      chromium = chromium, manganum = manganum, ferrum = ferrum, cobaltum = cobaltum, niccolum = niccolum, cuprum = cuprum, zincum = zincum,\
      gallium = gallium, germanium = germanium, arsenicum = arsenicum, selenium = selenium, bromum = bromum, crypton = crypton,\
      rubidium = rubidium, strontium = strontium, yttrium = yttrium, zirconium = zirconium, niobium = niobium, molybdaenum = molybdaenum,\
       technetium = technetium, ruthenium = ruthenium, rhodium = rhodium, palladium = palladium, argentum = argentum, cadmium = cadmium,\
       indium = indium, stannum = stannum, stibium = stibium, tellurium = tellurium, iodium = iodium, xenon = xenon, caesium = caesium,\
       barium = barium, lanthanum = lanthanum, cerium = cerium, praseodymium = praseodymium, neodymium = neodymium, promethium = promethium,\
       samarium = samarium, europium = europium, gadolinium = gadolinium, terbium = terbium, dysprosium = dysprosium, holmium = holmium,\
       erbium = erbium, thulium = thulium, ytterbium = ytterbium, lutetium = lutetium, hafnium = hafnium, tantalum = tantalum,\
       wolframium = wolframium, rhenium = rhenium, osmium = osmium, iridium = iridium, platinum = platinum, aurum = aurum, hydrargyrum = hydrargyrum,\
       thallium = thallium, plumbum = plumbum, bismuthum = bismuthum, polonium = polonium, astatum = astatum, radon = radon,\
       francium = francium, radium = radium, actinium = actinium, thorium = thorium, protactinium = protactinium, uranium = uranium,\
       neptunium = neptunium, plutonium = plutonium, americium = americium, curium = curium, berkelium = berkelium, californium = californium,\
       einsteinium = einsteinium, fermium = fermium, mendelevium = mendelevium, nobelium = nobelium, lawrencium = lawrencium,\
       rutherfordium = rutherfordium, dubnium = dubnium, seaborgium = seaborgium, bohrium = bohrium, hassium = hassium,\
       meitnerium = meitnerium, darmstadtium = darmstadtium, roentgenium = roentgenium, copernicium = copernicium, nihonium = nihonium,\
       flerovium = flerovium, moscovium = moscovium, livermorium = livermorium, tennessium = tennessium, oganesson = oganesson, comment = comment)
Ejemplo n.º 8
0
def fill_control_action():

	with open(CONTROL_ACTION_DATA_PATH, newline='') as data:
		
		data_reader = csv.reader(data)

		for item in data_reader:
			ControlAction.create(\
				date = datetime.datetime.strptime(item[0], TIME_PATTERN).date(),\
				time = datetime.datetime.strptime(item[0], TIME_PATTERN).time(),\
				mac_address = string_to_bytes(item[1]),\
				user_id = string_to_bytes(item[2]),
				command = item[3],\
				params = item[4],\
				result = item[5]\
			)
Ejemplo n.º 9
0
 def resolve_shiftstate(self, info, date, time, shift, warninglevel, remainingcartridges, remainingair, remainingelectricity, comment):
     return [ShiftStateMapper.init_scalar(item) for item in cassandra_mediator.select_shift_states(
         date = None if not date else datetime.datetime.strptime(date, DATE_PATTERN).date(),
         time = None if not time else datetime.datetime.strptime(time, TIME_PATTERN).time(),
         shift_id = None if not shift else string_to_bytes(shift), 
         warning_level = warninglevel, remaining_cartridges = remainingcartridges, remaining_air = remainingair, remaining_electricity = remainingelectricity,
         comment = comment)]
Ejemplo n.º 10
0
 def resolve_systemtest(self, info, date, time, system, result):
     return [
         SystemTestMapper.init_scalar(item)
         for item in cassandra_mediator.select_system_tests(
             date=None if not date else datetime.datetime.
             strptime(date, DATE_PATTERN).date(),
             time=None if not time else datetime.datetime.
             strptime(time, TIME_PATTERN).time(),
             system_id=None if not system else string_to_bytes(system),
             result=result)
     ]
Ejemplo n.º 11
0
def fill_system_test():

	with open(SYSTEM_TEST_DATA_PATH, newline='') as data:
		
		data_reader = csv.reader(data)

		for item in data_reader:
			print(item[2])
			SystemTest.create(\
				date = datetime.datetime.strptime(item[0], TIME_PATTERN).date(),\
				time = datetime.datetime.strptime(item[0], TIME_PATTERN).time(),\
				system_id = string_to_bytes(item[1]),\
				result = int(float(item[2])))
Ejemplo n.º 12
0
 def resolve_operationstate(self, info, date, time, boat, operation, status, distancetotheship, zenith, azimuth, hydrogenium,
     helium, lithium, beryllium, borum,
     carboneum, nitrogenium, oxygenium, fluorum, neon, natrium, magnesium, aluminium, silicium, phosphorus, sulfur, chlorum, argon, kalium, calcium,\
     scandium, titanium, vanadium, chromium, manganum, ferrum, cobaltum, niccolum, cuprum, zincum, gallium, germanium, arsenicum, selenium, bromum,\
     crypton, rubidium, strontium, yttrium, zirconium, niobium, molybdaenum, technetium, ruthenium, rhodium, palladium, argentum, cadmium, indium,\
     stannum, stibium, tellurium, iodium, xenon, caesium, barium, lanthanum, cerium, praseodymium, neodymium, promethium, samarium, europium, gadolinium,\
     terbium, dysprosium, holmium, erbium, thulium, ytterbium, lutetium, hafnium, tantalum, wolframium, rhenium, osmium, iridium, platinum, aurum,\
     hydrargyrum, thallium, plumbum, bismuthum, polonium, astatum, radon, francium, radium, actinium, thorium, protactinium, uranium, neptunium,\
     plutonium, americium, curium, berkelium, californium, einsteinium, fermium, mendelevium, nobelium, lawrencium, rutherfordium, dubnium,\
     seaborgium, bohrium, hassium, meitnerium, darmstadtium, roentgenium, copernicium, nihonium, flerovium, moscovium, livermorium, tennessium,\
     oganesson, comment):
     return [OperationStateMapper.init_scalar(item) for item in cassandra_mediator.select_operation_states(
         date = None if not date else datetime.datetime.strptime(date, DATE_PATTERN).date(),
         time = None if not time else datetime.datetime.strptime(time, TIME_PATTERN).time(),
         boat_id = None if not boat else string_to_bytes(boat),
         operation_id = None if not operation else string_to_bytes(operation),
         status = status, distance_to_the_ship = distancetotheship, zenith = zenith, azimuth = azimuth, 
         hydrogenium = hydrogenium, helium = helium, lithium = lithium, beryllium = beryllium, borum = borum, carboneum = carboneum, 
         nitrogenium = nitrogenium, oxygenium = oxygenium, fluorum = fluorum, neon = neon, natrium = natrium, magnesium = magnesium, 
         aluminium = aluminium, silicium = silicium, phosphorus = phosphorus, sulfur = sulfur, chlorum = chlorum, argon = argon, kalium = kalium, 
         calcium = calcium, scandium = scandium, titanium = titanium, vanadium = vanadium, chromium = chromium, manganum = manganum, 
         ferrum = ferrum, cobaltum = cobaltum, niccolum = niccolum, cuprum = cuprum, zincum = zincum, gallium = gallium, germanium = germanium, 
         arsenicum = arsenicum, selenium = selenium, bromum = bromum, crypton = crypton, rubidium = rubidium, strontium = strontium, 
         yttrium = yttrium, zirconium = zirconium, niobium = niobium, molybdaenum = molybdaenum, technetium = technetium, ruthenium = ruthenium, 
         rhodium = rhodium, palladium = palladium, argentum = argentum, cadmium = cadmium, indium = indium, stannum = stannum, stibium = stibium, 
         tellurium = tellurium, iodium = iodium, xenon = xenon, caesium = caesium, barium = barium, lanthanum = lanthanum, cerium = cerium, 
         praseodymium = praseodymium, neodymium = neodymium, promethium = promethium, samarium = samarium, europium = europium, gadolinium = gadolinium, 
         terbium = terbium, dysprosium = dysprosium, holmium = holmium, erbium = erbium, thulium = thulium, ytterbium = ytterbium, lutetium = lutetium, 
         hafnium = hafnium, tantalum = tantalum, wolframium = wolframium, rhenium = rhenium, osmium = osmium, iridium = iridium, platinum = platinum, 
         aurum = aurum, hydrargyrum = hydrargyrum, thallium = thallium, plumbum = plumbum, bismuthum = bismuthum, polonium = polonium, astatum = astatum, 
         radon = radon, francium = francium, radium = radium, actinium = actinium, thorium = thorium, protactinium = protactinium, uranium = uranium, 
         neptunium = neptunium, plutonium = plutonium, americium = americium, curium = curium, berkelium = berkelium, californium = californium, 
         einsteinium = einsteinium, fermium = fermium, mendelevium = mendelevium, nobelium = nobelium, lawrencium = lawrencium, 
         rutherfordium = rutherfordium, dubnium = dubnium, seaborgium = seaborgium, bohrium = bohrium, hassium = hassium, meitnerium = meitnerium, 
         darmstadtium = darmstadtium, roentgenium = roentgenium, copernicium = copernicium, nihonium = nihonium, flerovium = flerovium, 
         moscovium = moscovium, livermorium = livermorium, tennessium = tennessium, oganesson = oganesson, comment = comment)]
Ejemplo n.º 13
0
 def resolve_sensordata(self, info, date, time, sensor, event, valuename,
                        value, units):
     return [
         SensorDataMapper.init_scalar(item)
         for item in cassandra_mediator.select_sensor_data(
             date=None if not date else datetime.datetime.
             strptime(date, DATE_PATTERN).date(),
             time=None if not time else datetime.datetime.
             strptime(time, TIME_PATTERN).time(),
             source_id=None if not sensor else string_to_bytes(sensor),
             event=event,
             value_name=valuename,
             value=value,
             units=units)
     ]
Ejemplo n.º 14
0
def fill_sensor_data():

	with open(SENSOR_DATA_DATA_PATH, newline='') as data:
		
		data_reader = csv.reader(data)

		for item in data_reader:
			SensorData.create(\
				date = datetime.datetime.strptime(item[0], TIME_PATTERN).date(),\
				time = datetime.datetime.strptime(item[0], TIME_PATTERN).time(),\
				source_id = string_to_bytes(item[1]),\
				event = item[2],
				value_name = item[3],\
				value = float(item[4]),\
				units = item[5]\
			)
Ejemplo n.º 15
0
 def resolve_shiftstate(self, info, date, time, shift, warninglevel,
                        remainingcartridges, remainingair,
                        remainingelectricity, comment):
     return [
         ShiftStateMapper.init_scalar(item)
         for item in cassandra_mediator.select_shift_states(
             date=None if not date else datetime.datetime.
             strptime(date, DATE_PATTERN).date(),
             time=None if not time else datetime.datetime.
             strptime(time, TIME_PATTERN).time(),
             shift_id=None if not shift else string_to_bytes(shift),
             warning_level=warninglevel,
             remaining_cartridges=remainingcartridges,
             remaining_air=remainingair,
             remaining_electricity=remainingelectricity,
             comment=comment)
     ]
Ejemplo n.º 16
0
def fill_shift_state():

	with open(SHIFT_STATE_DATA_PATH, newline='') as data:
		
		data_reader = csv.reader(data)

		for item in data_reader:
			ShiftState.create(\
				date = datetime.datetime.strptime(item[0], TIME_PATTERN).date(),\
				time = datetime.datetime.strptime(item[0], TIME_PATTERN).time(),\
				shift_id = string_to_bytes(item[1]),\
				warning_level = item[2],
				remaining_cartridges = int(float(item[3])),\
				remaining_air = int(float(item[4])),\
				remaining_electricity = int(float(item[5])),\
				comment = item[6]\
			)
 def mutate(self, info, timestamp, boat, operation, status, distancetotheship, zenith, azimuth, hydrogenium, helium, lithium, beryllium, borum,\
 carboneum, nitrogenium, oxygenium, fluorum, neon, natrium, magnesium, aluminium, silicium, phosphorus, sulfur, chlorum, argon, kalium, calcium,\
 scandium, titanium, vanadium, chromium, manganum, ferrum, cobaltum, niccolum, cuprum, zincum, gallium, germanium, arsenicum, selenium, bromum,\
 crypton, rubidium, strontium, yttrium, zirconium, niobium, molybdaenum, technetium, ruthenium, rhodium, palladium, argentum, cadmium, indium,\
 stannum, stibium, tellurium, iodium, xenon, caesium, barium, lanthanum, cerium, praseodymium, neodymium, promethium, samarium, europium, gadolinium,\
 terbium, dysprosium, holmium, erbium, thulium, ytterbium, lutetium, hafnium, tantalum, wolframium, rhenium, osmium, iridium, platinum, aurum,\
 hydrargyrum, thallium, plumbum, bismuthum, polonium, astatum, radon, francium, radium, actinium, thorium, protactinium, uranium, neptunium,\
 plutonium, americium, curium, berkelium, californium, einsteinium, fermium, mendelevium, nobelium, lawrencium, rutherfordium, dubnium,\
 seaborgium, bohrium, hassium, meitnerium, darmstadtium, roentgenium, copernicium, nihonium, flerovium, moscovium, livermorium, tennessium,\
 oganesson, comment, set_boat, set_operation, set_status, set_distancetotheship, set_zenith, set_azimuth, set_hydrogenium, set_helium,
 set_lithium, set_beryllium, set_borum, set_carboneum, set_nitrogenium, set_oxygenium, set_fluorum, set_neon, set_natrium, set_magnesium,
 set_aluminium, set_silicium, set_phosphorus, set_sulfur, set_chlorum, set_argon, set_kalium, set_calcium, set_scandium, set_titanium,
 set_vanadium, set_chromium, set_manganum, set_ferrum, set_cobaltum, set_niccolum, set_cuprum, set_zincum, set_gallium, set_germanium,
 set_arsenicum, set_selenium, set_bromum, set_crypton, set_rubidium, set_strontium, set_yttrium, set_zirconium, set_niobium, set_molybdaenum,
 set_technetium, set_ruthenium, set_rhodium, set_palladium, set_argentum, set_cadmium, set_indium, set_stannum, set_stibium, set_tellurium,
 set_iodium, set_xenon, set_caesium, set_barium, set_lanthanum, set_cerium, set_praseodymium, set_neodymium, set_promethium, set_samarium,
 set_europium, set_gadolinium, set_terbium, set_dysprosium, set_holmium, set_erbium, set_thulium, set_ytterbium, set_lutetium, set_hafnium,
 set_tantalum, set_wolframium, set_rhenium, set_osmium, set_iridium, set_platinum, set_aurum, set_hydrargyrum, set_thallium, set_plumbum,
 set_bismuthum, set_polonium, set_astatum, set_radon, set_francium, set_radium, set_actinium, set_thorium, set_protactinium, set_uranium,
 set_neptunium, set_plutonium, set_americium, set_curium, set_berkelium, set_californium, set_einsteinium, set_fermium, set_mendelevium,
 set_nobelium, set_lawrencium, set_rutherfordium, set_dubnium, set_seaborgium, set_bohrium, set_hassium, set_meitnerium, set_darmstadtium, 
 set_roentgenium, set_copernicium, set_nihonium, set_flerovium, set_moscovium, set_livermorium, set_tennessium, set_oganesson,set_comment):
     parsed_timestamp = None if not timestamp else datetime.datetime.strptime(timestamp, TIMESTAMP_PATTERN)
     operationstate = cassandra_mediator.update_operation_states(date = None if not parsed_timestamp else parsed_timestamp.date,\
         time = None if not parsed_timestamp else parsed_timestamp.time,
         boat_id = None if not boat else string_to_bytes(boat), 
         operation_id = None if not operation else string_to_bytes(operation), 
         operation_status = status, zenith = zenith, azimuth = azimuth, comment = comment, distancetotheship = distancetotheship,
         set_boat_id = None if not set_boat else OperationState.validate_boat_id(string_to_bytes(set_boat)), 
         set_operation_id = None if not set_operation else OperationState.validate_boat_id(string_to_bytes(set_operation)), 
         set_operation_status = None if not set_status else OperationState.validate_operation_status(set_status), 
         set_distancetotheship = set_distancetotheship,
         set_zenith = None if not set_zenith == float('nan') else OperationState.validate_angle(set_zenith), 
         set_azimuth = None if not set_azimuth == float('nan') else OperationState.validate_angle(set_azimuth),
         set_comment = set_comment,
         set_hydrogenium = set_hydrogenium, hydrogenium = hydrogenium, set_helium = set_helium, helium = helium, 
         set_lithium = set_lithium, lithium = lithium, set_beryllium = set_beryllium, beryllium = beryllium, 
         set_borum = set_borum, borum = borum, set_carboneum = set_carboneum, carboneum = carboneum, set_nitrogenium = set_nitrogenium, 
         nitrogenium = nitrogenium, set_oxygenium = set_oxygenium, oxygenium = oxygenium, set_fluorum = set_fluorum, fluorum = fluorum, 
         set_neon = set_neon, neon = neon, set_natrium = set_natrium, natrium = natrium, set_magnesium = set_magnesium, magnesium = magnesium, 
         set_aluminium = set_aluminium, aluminium = aluminium, set_silicium = set_silicium, silicium = silicium, set_phosphorus = set_phosphorus, 
         phosphorus = phosphorus, set_sulfur = set_sulfur, sulfur = sulfur, set_chlorum = set_chlorum, chlorum = chlorum, set_argon = set_argon, 
         argon = argon, set_kalium = set_kalium, kalium = kalium, set_calcium = set_calcium, calcium = calcium, set_scandium = set_scandium, 
         scandium = scandium, set_titanium = set_titanium, titanium = titanium, set_vanadium = set_vanadium, vanadium = vanadium, 
         set_chromium = set_chromium, chromium = chromium, set_manganum = set_manganum, manganum = manganum, set_ferrum = set_ferrum, 
         ferrum = ferrum, set_cobaltum = set_cobaltum, cobaltum = cobaltum, set_niccolum = set_niccolum, niccolum = niccolum, 
         set_cuprum = set_cuprum, cuprum = cuprum, set_zincum = set_zincum, zincum = zincum, set_gallium = set_gallium, 
         gallium = gallium, set_germanium = set_germanium, germanium = germanium, set_arsenicum = set_arsenicum, 
         arsenicum = arsenicum, set_selenium = set_selenium, selenium = selenium, set_bromum = set_bromum, 
         bromum = bromum, set_crypton = set_crypton, crypton = crypton, set_rubidium = set_rubidium, rubidium = rubidium, 
         set_strontium = set_strontium, strontium = strontium, set_yttrium = set_yttrium, yttrium = yttrium, set_zirconium = set_zirconium, 
         zirconium = zirconium, set_niobium = set_niobium, niobium = niobium, set_molybdaenum = set_molybdaenum, molybdaenum = molybdaenum, 
         set_technetium = set_technetium, technetium = technetium, set_ruthenium = set_ruthenium, ruthenium = ruthenium, set_rhodium = set_rhodium, 
         rhodium = rhodium, set_palladium = set_palladium, palladium = palladium, set_argentum = set_argentum, argentum = argentum, 
         set_cadmium = set_cadmium, cadmium = cadmium, set_indium = set_indium, indium = indium, set_stannum = set_stannum, stannum = stannum, 
         set_stibium = set_stibium, stibium = stibium, set_tellurium = set_tellurium, tellurium = tellurium, set_iodium = set_iodium, 
         iodium = iodium, set_xenon = set_xenon, xenon = xenon, set_caesium = set_caesium, caesium = caesium, set_barium = set_barium, 
         barium = barium, set_lanthanum = set_lanthanum, lanthanum = lanthanum, set_cerium = set_cerium, cerium = cerium, 
         set_praseodymium = set_praseodymium, praseodymium = praseodymium, set_neodymium = set_neodymium, neodymium = neodymium, 
         set_promethium = set_promethium, promethium = promethium, set_samarium = set_samarium, samarium = samarium, set_europium = set_europium, 
         europium = europium, set_gadolinium = set_gadolinium, gadolinium = gadolinium, set_terbium = set_terbium, terbium = terbium, 
         set_dysprosium = set_dysprosium, dysprosium = dysprosium, set_holmium = set_holmium, holmium = holmium, set_erbium = set_erbium, 
         erbium = erbium, set_thulium = set_thulium, thulium = thulium, set_ytterbium = set_ytterbium, ytterbium = ytterbium, 
         set_lutetium = set_lutetium, lutetium = lutetium, set_hafnium = set_hafnium, hafnium = hafnium, set_tantalum = set_tantalum, 
         tantalum = tantalum, set_wolframium = set_wolframium, wolframium = wolframium, set_rhenium = set_rhenium, rhenium = rhenium, 
         set_osmium = set_osmium, osmium = osmium, set_iridium = set_iridium, iridium = iridium, set_platinum = set_platinum, platinum = platinum, 
         set_aurum = set_aurum, aurum = aurum, set_hydrargyrum = set_hydrargyrum, hydrargyrum = hydrargyrum, set_thallium = set_thallium, 
         thallium = thallium, set_plumbum = set_plumbum, plumbum = plumbum, set_bismuthum = set_bismuthum, bismuthum = bismuthum, 
         set_polonium = set_polonium, polonium = polonium, set_astatum = set_astatum, astatum = astatum, set_radon = set_radon, radon = radon, 
         set_francium = set_francium, francium = francium, set_radium = set_radium, radium = radium, set_actinium = set_actinium, actinium = actinium, 
         set_thorium = set_thorium, thorium = thorium, set_protactinium = set_protactinium, protactinium = protactinium, set_uranium = set_uranium, 
         uranium = uranium, set_neptunium = set_neptunium, neptunium = neptunium, set_plutonium = set_plutonium, plutonium = plutonium,
         set_americium = set_americium, americium = americium, set_curium = set_curium, curium = curium, set_berkelium = set_berkelium, 
         berkelium = berkelium, set_californium = set_californium, californium = californium, set_einsteinium = set_einsteinium, einsteinium = einsteinium, 
         set_fermium = set_fermium, fermium = fermium, set_mendelevium = set_mendelevium, mendelevium = mendelevium, set_nobelium = set_nobelium, 
         nobelium = nobelium, set_lawrencium = set_lawrencium, lawrencium = lawrencium, set_rutherfordium = set_rutherfordium, 
         rutherfordium = rutherfordium, set_dubnium = set_dubnium, dubnium = dubnium, set_seaborgium = set_seaborgium, seaborgium = seaborgium, 
         set_bohrium = set_bohrium, bohrium = bohrium, set_hassium = set_hassium, hassium = hassium, set_meitnerium = set_meitnerium, 
         meitnerium = meitnerium, set_darmstadtium = set_darmstadtium, darmstadtium = darmstadtium, set_roentgenium = set_roentgenium, 
         roentgenium = roentgenium, set_copernicium = set_copernicium, copernicium = copernicium, set_nihonium = set_nihonium, nihonium = nihonium, 
         set_flerovium = set_flerovium, flerovium = flerovium, set_moscovium = set_moscovium, moscovium = moscovium, set_livermorium = set_livermorium, 
         livermorium = livermorium, set_tennessium = set_tennessium, tennessium = tennessium, set_oganesson = set_oganesson, oganesson = oganesson)
     ok = True
     return UpdateOperationStates(ok = ok)
Ejemplo n.º 18
0
 def resolve_operationstate(self, info, date, time, boat, operation, status, distancetotheship, zenith, azimuth, hydrogenium,
     helium, lithium, beryllium, borum,
     carboneum, nitrogenium, oxygenium, fluorum, neon, natrium, magnesium, aluminium, silicium, phosphorus, sulfur, chlorum, argon, kalium, calcium,\
     scandium, titanium, vanadium, chromium, manganum, ferrum, cobaltum, niccolum, cuprum, zincum, gallium, germanium, arsenicum, selenium, bromum,\
     crypton, rubidium, strontium, yttrium, zirconium, niobium, molybdaenum, technetium, ruthenium, rhodium, palladium, argentum, cadmium, indium,\
     stannum, stibium, tellurium, iodium, xenon, caesium, barium, lanthanum, cerium, praseodymium, neodymium, promethium, samarium, europium, gadolinium,\
     terbium, dysprosium, holmium, erbium, thulium, ytterbium, lutetium, hafnium, tantalum, wolframium, rhenium, osmium, iridium, platinum, aurum,\
     hydrargyrum, thallium, plumbum, bismuthum, polonium, astatum, radon, francium, radium, actinium, thorium, protactinium, uranium, neptunium,\
     plutonium, americium, curium, berkelium, californium, einsteinium, fermium, mendelevium, nobelium, lawrencium, rutherfordium, dubnium,\
     seaborgium, bohrium, hassium, meitnerium, darmstadtium, roentgenium, copernicium, nihonium, flerovium, moscovium, livermorium, tennessium,\
     oganesson, comment):
     return [
         OperationStateMapper.init_scalar(item)
         for item in cassandra_mediator.select_operation_states(
             date=None if not date else datetime.datetime.
             strptime(date, DATE_PATTERN).date(),
             time=None if not time else datetime.datetime.
             strptime(time, TIME_PATTERN).time(),
             boat_id=None if not boat else string_to_bytes(boat),
             operation_id=None
             if not operation else string_to_bytes(operation),
             status=status,
             distance_to_the_ship=distancetotheship,
             zenith=zenith,
             azimuth=azimuth,
             hydrogenium=hydrogenium,
             helium=helium,
             lithium=lithium,
             beryllium=beryllium,
             borum=borum,
             carboneum=carboneum,
             nitrogenium=nitrogenium,
             oxygenium=oxygenium,
             fluorum=fluorum,
             neon=neon,
             natrium=natrium,
             magnesium=magnesium,
             aluminium=aluminium,
             silicium=silicium,
             phosphorus=phosphorus,
             sulfur=sulfur,
             chlorum=chlorum,
             argon=argon,
             kalium=kalium,
             calcium=calcium,
             scandium=scandium,
             titanium=titanium,
             vanadium=vanadium,
             chromium=chromium,
             manganum=manganum,
             ferrum=ferrum,
             cobaltum=cobaltum,
             niccolum=niccolum,
             cuprum=cuprum,
             zincum=zincum,
             gallium=gallium,
             germanium=germanium,
             arsenicum=arsenicum,
             selenium=selenium,
             bromum=bromum,
             crypton=crypton,
             rubidium=rubidium,
             strontium=strontium,
             yttrium=yttrium,
             zirconium=zirconium,
             niobium=niobium,
             molybdaenum=molybdaenum,
             technetium=technetium,
             ruthenium=ruthenium,
             rhodium=rhodium,
             palladium=palladium,
             argentum=argentum,
             cadmium=cadmium,
             indium=indium,
             stannum=stannum,
             stibium=stibium,
             tellurium=tellurium,
             iodium=iodium,
             xenon=xenon,
             caesium=caesium,
             barium=barium,
             lanthanum=lanthanum,
             cerium=cerium,
             praseodymium=praseodymium,
             neodymium=neodymium,
             promethium=promethium,
             samarium=samarium,
             europium=europium,
             gadolinium=gadolinium,
             terbium=terbium,
             dysprosium=dysprosium,
             holmium=holmium,
             erbium=erbium,
             thulium=thulium,
             ytterbium=ytterbium,
             lutetium=lutetium,
             hafnium=hafnium,
             tantalum=tantalum,
             wolframium=wolframium,
             rhenium=rhenium,
             osmium=osmium,
             iridium=iridium,
             platinum=platinum,
             aurum=aurum,
             hydrargyrum=hydrargyrum,
             thallium=thallium,
             plumbum=plumbum,
             bismuthum=bismuthum,
             polonium=polonium,
             astatum=astatum,
             radon=radon,
             francium=francium,
             radium=radium,
             actinium=actinium,
             thorium=thorium,
             protactinium=protactinium,
             uranium=uranium,
             neptunium=neptunium,
             plutonium=plutonium,
             americium=americium,
             curium=curium,
             berkelium=berkelium,
             californium=californium,
             einsteinium=einsteinium,
             fermium=fermium,
             mendelevium=mendelevium,
             nobelium=nobelium,
             lawrencium=lawrencium,
             rutherfordium=rutherfordium,
             dubnium=dubnium,
             seaborgium=seaborgium,
             bohrium=bohrium,
             hassium=hassium,
             meitnerium=meitnerium,
             darmstadtium=darmstadtium,
             roentgenium=roentgenium,
             copernicium=copernicium,
             nihonium=nihonium,
             flerovium=flerovium,
             moscovium=moscovium,
             livermorium=livermorium,
             tennessium=tennessium,
             oganesson=oganesson,
             comment=comment)
     ]
Ejemplo n.º 19
0
 def resolve_sensordata(self, info, date, time, sensor, event, valuename, value, units):
     return [SensorDataMapper.init_scalar(item) for item in cassandra_mediator.select_sensor_data(
         date = None if not date else datetime.datetime.strptime(date, DATE_PATTERN).date(),
         time = None if not time else datetime.datetime.strptime(time, TIME_PATTERN).time(),
         source_id = None if not sensor else string_to_bytes(sensor), 
         event = event, value_name = valuename, value = value, units = units)]
Ejemplo n.º 20
0
 def mutate(self, info, timestamp, source, event, meaning, value, units, set_source, set_event, set_meaning, set_value, set_units):
     parsed_timestamp = None if not timestamp else datetime.datetime.strptime(timestamp, TIMESTAMP_PATTERN)
     cassandra_mediator.update_sensor_data(date = None if not parsed_timestamp else parsed_timestamp.date,\
         time = None if not parsed_timestamp else parsed_timestamp.time,
         source_id = source, event = event, meaning = meaning, value = value, units = units,
         set_source_id = None if not set_source else SensorData.validate_source_id(string_to_bytes(set_source)),
         set_event = None if not set_event else SensorData.validate_event(set_event), 
         set_value_name = None if not set_meaning else SensorData.validate_value_name(set_value_name),
         set_value = set_value, 
         set_units = None if not set_units else SensorData.validate_units(set_units))
     ok = True
     return UpdateSensorData(ok = ok)
Ejemplo n.º 21
0
def fill_operation_state():

	with open(OPERATION_STATE_DATA_PATH, newline='') as data:
		
		data_reader = csv.reader(data)

		for item in data_reader:
			OperationState.create(\
				date = datetime.datetime.strptime(item[0], TIME_PATTERN).date(),\
				time = datetime.datetime.strptime(item[0], TIME_PATTERN).time(),\
				boat_id = string_to_bytes(item[1]),\
				operation_id = string_to_bytes(item[2]),\
				operation_status = item[3],\
				distance_to_the_ship = float(item[4]),\
				zenith = float(item[5]),\
				azimuth = float(item[6]),\

				hydrogenium = float(item[7]),\
				helium = float(item[8]),\
				lithium = float(item[9]),\
				beryllium = float(item[10]),\
				borum = float(item[11]),\
				carboneum = float(item[12]),\
				nitrogenium = float(item[13]),\
				oxygenium = float(item[14]),\
				fluorum = float(item[15]),\
				neon = float(item[16]),\
				natrium = float(item[17]),\
				magnesium = float(item[18]),\
				aluminium = float(item[19]),\
				silicium = float(item[20]),\
				phosphorus = float(item[21]),\
				sulfur = float(item[22]),\
				chlorum = float(item[23]),\
				argon = float(item[24]),\
				kalium = float(item[25]),\
				calcium = float(item[26]),\
				scandium = float(item[27]),\
				titanium = float(item[28]),\
				vanadium = float(item[29]),\
				chromium = float(item[30]),\
				manganum = float(item[31]),\
				ferrum = float(item[32]),\
				cobaltum = float(item[33]),\
				niccolum = float(item[34]),\
				cuprum = float(item[35]),\
				zincum = float(item[36]),\
				gallium = float(item[37]),\
				germanium = float(item[38]),\
				arsenicum = float(item[39]),\
				selenium = float(item[40]),\
				bromum = float(item[41]),\
				crypton = float(item[42]),\
				rubidium = float(item[43]),\
				strontium = float(item[44]),\
				yttrium = float(item[45]),\
				zirconium = float(item[46]),\
				niobium = float(item[47]),\
				molybdaenum = float(item[48]),\
				technetium = float(item[49]),\
				ruthenium = float(item[50]),\
				rhodium = float(item[51]),\
				palladium = float(item[52]),\
				argentum = float(item[53]),\
				cadmium = float(item[54]),\
				indium = float(item[55]),\
				stannum = float(item[56]),\
				stibium = float(item[57]),\
				tellurium = float(item[58]),\
				iodium = float(item[59]),\
				xenon = float(item[60]),\
				caesium = float(item[61]),\
				barium = float(item[62]),\
				lanthanum = float(item[63]),\
				cerium = float(item[64]),\
				praseodymium = float(item[65]),\
				neodymium = float(item[66]),\
				promethium = float(item[67]),\
				samarium = float(item[68]),\
				europium = float(item[69]),\
				gadolinium = float(item[70]),\
				terbium = float(item[71]),\
				dysprosium = float(item[72]),\
				holmium = float(item[73]),\
				erbium = float(item[74]),\
				thulium = float(item[75]),\
				ytterbium = float(item[76]),\
				lutetium = float(item[77]),\
				hafnium = float(item[78]),\
				tantalum = float(item[79]),\
				wolframium = float(item[80]),\
				rhenium = float(item[81]),\
				osmium = float(item[82]),\
				iridium = float(item[83]),\
				platinum = float(item[84]),\
				aurum = float(item[85]),\
				hydrargyrum = float(item[86]),\
				thallium = float(item[87]),\
				plumbum = float(item[88]),\
				bismuthum = float(item[89]),\
				polonium = float(item[90]),\
				astatum = float(item[91]),\
				radon = float(item[92]),\
				francium = float(item[93]),\
				radium = float(item[94]),\
				actinium = float(item[95]),\
				thorium = float(item[96]),\
				protactinium = float(item[97]),\
				uranium = float(item[98]),\
				neptunium = float(item[99]),\
				plutonium = float(item[100]),\
				americium = float(item[101]),\
				curium = float(item[102]),\
				berkelium = float(item[103]),\
				californium = float(item[104]),\
				einsteinium = float(item[105]),\
				fermium = float(item[106]),\
				mendelevium = float(item[107]),\
				nobelium = float(item[108]),\
				lawrencium = float(item[109]),\
				rutherfordium = float(item[110]),\
				dubnium = float(item[111]),\
				seaborgium = float(item[112]),\
				bohrium = float(item[113]),\
				hassium = float(item[114]),\
				meitnerium = float(item[115]),\
				darmstadtium = float(item[116]),\
				roentgenium = float(item[117]),\
				copernicium = float(item[118]),\
				nihonium = float(item[119]),\
				flerovium = float(item[120]),\
				moscovium = float(item[121]),\
				livermorium = float(item[122]),\
				tennessium = float(item[123]),\
				oganesson = float(item[124]),\

				comment = item[125]\
			)
Ejemplo n.º 22
0
 def mutate(self, info, timestamp, source, event, meaning, value, units,
            set_source, set_event, set_meaning, set_value, set_units):
     parsed_timestamp = None if not timestamp else datetime.datetime.strptime(
         timestamp, TIMESTAMP_PATTERN)
     cassandra_mediator.update_sensor_data(date = None if not parsed_timestamp else parsed_timestamp.date,\
         time = None if not parsed_timestamp else parsed_timestamp.time,
         source_id = source, event = event, meaning = meaning, value = value, units = units,
         set_source_id = None if not set_source else SensorData.validate_source_id(string_to_bytes(set_source)),
         set_event = None if not set_event else SensorData.validate_event(set_event),
         set_value_name = None if not set_meaning else SensorData.validate_value_name(set_value_name),
         set_value = set_value,
         set_units = None if not set_units else SensorData.validate_units(set_units))
     ok = True
     return UpdateSensorData(ok=ok)
Ejemplo n.º 23
0
def create_system_test(timestamp, system_id, result):
    return SystemTest.create(date=timestamp.date(),
                             time=timestamp.time(),
                             system_id=string_to_bytes(system_id),
                             result=result)
Ejemplo n.º 24
0
def create_control_action(timestamp, mac_address, user_id, command, params,
                          result):
    return ControlAction.create(\
      date = timestamp.date(), time = timestamp.time(), mac_address = string_to_bytes(mac_address), user_id = string_to_bytes(user_id),
      command = command, params = params, result = result)
Ejemplo n.º 25
0
def create_sensor_data(timestamp, source, event, meaning, value, units):
    return SensorData.create(\
       date = timestamp.date(), time = timestamp.time(), source_id = string_to_bytes(source), event = event, value_name = meaning,\
       value = value, units = units)
Ejemplo n.º 26
0
 def resolve_systemtest(self, info, date, time, system, result):
     return [SystemTestMapper.init_scalar(item) for item in cassandra_mediator.select_system_tests(
         date = None if not date else datetime.datetime.strptime(date, DATE_PATTERN).date(),
         time = None if not time else datetime.datetime.strptime(time, TIME_PATTERN).time(),
         system_id = None if not system else string_to_bytes(system),
         result = result)]