def get_location_data(self, activity_id): """ Get Set/Up/Location info @param activity_id: DB ID @return: 2D Array built from Set/Up/# locations """ self._logger.info('Loading FishingLocationsModel for haul ID {}'.format(activity_id)) location_data_var = [] locs_q = FishingLocations.select().where(FishingLocations.fishing_activity == activity_id) if len(locs_q) > 0: for loc in locs_q: # Build FramListModel date_str, time_str = loc.location_date.split(' ') lat_deg, lat_min = FramUtil.convert_decimal_degs(loc.latitude) long_deg, long_min = FramUtil.convert_decimal_degs(loc.longitude) location_data_var.append({ 'haul_db_id': loc.fishing_activity.fishing_activity, # id 'loc_id': loc.fishing_location, 'position': loc.position, # position -1, 0, ... (Set, Up, etc) 'date_str': date_str, 'time_str': time_str, 'lat_deg': lat_deg, 'lat_min': lat_min, 'long_deg': long_deg, 'long_min': long_min, 'depth': loc.depth }) return location_data_var
def cert_rolenames(self): """ :return: role names for FramListModel """ rolenames = FramUtil.get_model_props(TripCertificates) # Add additional roles (e.g. Vessel Name, to be acquired via FK) return rolenames
def model_props(self): props = FramUtil.get_model_props(BioSpecimenItems) props.append('bio_specimen_id') props.append('barcodes_str') props.append('tags_str') props.append('biosample_str') return props
def model_props(self): props = FramUtil.get_model_props(HookCounts) # props.append('bio_specimen_id') # props.append('barcodes_str') # props.append('tags_str') # props.append('biosample_str') return props
def model_props(self): props = FramUtil.get_model_props(SpeciesCompositionBaskets) props.append( 'extrapolated_number') # Add model-only (not persisted) temp field # Allow primary key for species basket or for catch basket to be stored in same field props.append( 'basket_primary_key') # Add model-only (not persisted) temp field return props
def ticket_rolenames(self): """ :return: role names for FramListModel """ rolenames = FramUtil.get_model_props(FishTickets) # Add additional roles (e.g. Vessel Name, to be acquired via FK) # rolenames.append('vessel_name') return rolenames
def model_props(self): props = FramUtil.get_model_props(SpeciesCompositionItems) props.append('common_name') props.append('weighed_and_tallied_count') props.append('avg_weight') props.append('bio_count') props.append( 'total_fish_counted') # FIELD-2040, unextrapolated fish count return props
def trip_rolenames(self): """ :return: role names for FramListModel """ rolenames = FramUtil.get_model_props(Trips) # Add additional roles (e.g. Vessel Name, to be acquired via FK) rolenames.append('user_name') rolenames.append('vessel_name') rolenames.append('vessel_id') return rolenames
def haul_set_rolenames(self): """ :return: """ rolenames = FramUtil.get_model_props(FishingActivities) # Add additional roles not specified in DB (e.g. Vessel Name, to be acquired via FK) rolenames.append('trip_id') rolenames.append('target_strategy_code') rolenames.append('location_start_end') rolenames.append('errors') return rolenames
def model_rolenames(self): """ :return: role names for FramListModel """ rolenames = FramUtil.get_model_props(TripIssues) # Add additional roles (e.g. trip check id, to be acquired via FK) rolenames.append( 'check_message' ) # TripChecks.check_message on FK TripIssues.trip_check rolenames.append( 'check_type') # TripChecks.check_type on FK TripIssues.trip_check return rolenames
def model_rolenames(self): """ :return: role names for FramListModel """ rolenames = FramUtil.get_model_props(Catches) # Add additional roles (e.g. Vessel Name, to be acquired via FK) rolenames.append('catch_category_code') # look up by FK rolenames.append('catch_category_name') # look up by FK rolenames.append('sample_method') # look up by FK rolenames.append('catch_or_sample_weight') rolenames.append('catch_or_sample_count') return rolenames
def ping_test(self, wheelhouse_ip, debug=False): """ Pings wheelhouse, printer, access point, moxa :return: String with test results, success """ overall_status = True results = '' try: dbs = [('Wheelhouse', wheelhouse_ip)] ip_octets = wheelhouse_ip.split('.') # Make Printer MOXA IP ip_octets[3] = '70' dbs.append(('Printer MOXA', '.'.join(ip_octets))) # Make Access Point IP ip_octets[3] = '254' dbs.append(('Access Point', '.'.join(ip_octets))) # Make Comm Box MOXA IP ip_octets[3] = '253' dbs.append(('Comm Box MOXA', '.'.join(ip_octets))) for ip in dbs: output = FramUtil.ping_response(ip[1], debug=debug) if isinstance(output, bytes): output = output.decode('utf-8') if "reply from" in output.lower(): ip_status = True else: ip_status = False overall_status = False results += '{0} IP: {1} Ping Result: {2}\n'.format( ip[0], ip[1], 'OK' if ip_status else 'FAIL') except Exception as e: logging.error('Could not perform ping test, {0}'.format(e)) return results, overall_status
def model_props(self): props = FramUtil.get_model_props(Dissections) props.append('bio_specimen_item_id') # store ID return props
def model_props(self): props = FramUtil.get_model_props(Species) return props
def model_props(self): props = FramUtil.get_model_props(CatchAdditionalBaskets) return props
def model_props(self): props = FramUtil.get_model_props(BioSpecimens) props.append('species_name') # Get from FK return props
def model_props(self): props = FramUtil.get_model_props(CatchCategories) return props
discard_reason = DiscardReason(db=observer_data) context.setContextProperty('discardReason', discard_reason) catch_category = CatchCategory(db=observer_data) context.setContextProperty('catchCategory', catch_category) autocomplete = AutoComplete(db=observer_data) context.setContextProperty('autocomplete', autocomplete) db_sync = ObserverDBSyncController() context.setContextProperty('db_sync', db_sync) error_reports = ObserverErrorReports() context.setContextProperty('errorReports', error_reports) framutil = FramUtil() context.setContextProperty('framutil', framutil) sound_player = SoundPlayer() context.setContextProperty('soundPlayer', sound_player) # On an unhandled exception: log, display message box, and exit OPTECS. UnhandledExceptionHandler.connect_to_system_excepthook( logging, log_filename_for_today, appstate) engine.load(main_qml) engine.quit.connect(app.quit) ret = app.exec_() if PROFILE_CODE: pr.disable() s = io.StringIO()