parameters: (self, data)
docstring: Check the values in a line of data.
docstring_summary: Check the values in a line of data.
docstring_tokens: Check the values in a line of data .
function: def checkLine(self, data):
          """Check the values in a line of data."""
          super(ResourceDefinitionValidator, self).checkLine(data)
          resource_id = ''
          resource_type = ''
          for col_index, col_name in enumerate(self.cols):
              # treat cells beyond the end of the line as blanks,
              # super().checkLine() has already logged an error
              value = ''
              if col_index < len(data):
                  value = data[col_index].strip()
  
              # make sure that RESOURCE_ID is present
              if col_name == 'RESOURCE_ID':
                  if value.strip().lower() in self.NULL_VALUES:
                      self.logger.error(
                          'Missing RESOURCE_ID',
                          extra={'line_number': self.line_number,
                                 'column_number': col_index + 1,
                                 'cause': value})
                  else:
                      resource_id = value
  
              # make sure that RESOURCE_TYPE is present and correct
              if col_name == 'RESOURCE_TYPE':
                  if value.strip().lower() in self.NULL_VALUES:
                      self.logger.error(
                          'Missing RESOURCE_TYPE',
                          extra={'line_number': self.line_number,
                                 'column_number': col_index + 1,
                                 'cause': value})
                  elif value.strip() not in self.RESOURCE_TYPES:
                      self.logger.error(
                          'RESOURCE_TYPE is not one of the following : SAMPLE, PATIENT or STUDY',
                          extra={'line_number': self.line_number,
                                 'column_number': col_index + 1,
                                 'cause': value})
                  else:
                      resource_type = value
  
              # make sure that DISPLAY_NAME is present
              if col_name == 'DISPLAY_NAME':
                  if value.strip().lower() in self.NULL_VALUES:
                      self.logger.error(
                          'Missing DISPLAY_NAME',
                          extra={'line_number': self.line_number,
                                 'column_number': col_index + 1,
                                 'cause': value})
  
              # pass for other null columns
              if value.strip().lower() in self.NULL_VALUES:
                      pass
  
              # validate if OPEN_BY_DEFAULT and priority are correct
              if col_name == 'OPEN_BY_DEFAULT':
                  if not (value.strip().lower() == 'true' or value.strip().lower() == 'false'):
                      self.logger.error(
                          'wrong value of OPEN_BY_DEFAULT, should be true or false',
                          extra={'line_number': self.line_number,
                                 'column_number': col_index + 1,
                                 'cause': value})
  
              if col_name == 'PRIORITY':
                  try:
                      int(value.strip())
                  except ValueError:
                      self.logger.error(
                          'wrong value of PRIORITY, the value should be integer',
                          extra={'line_number': self.line_number,
                                 'column_number': col_index + 1,
                                 'cause': value})
          # add resource_id into dictionary
          self.resource_definition_dictionary.setdefault(resource_id, []).append(resource_type)
function_tokens: def checkLine ( self , data ) : super ( ResourceDefinitionValidator , self ) . checkLine ( data ) resource_id = '' resource_type = '' for col_index , col_name in enumerate ( self . cols ) : # treat cells beyond the end of the line as blanks, # super().checkLine() has already logged an error value = '' if col_index < len ( data ) : value = data [ col_index ] . strip ( ) # make sure that RESOURCE_ID is present if col_name == 'RESOURCE_ID' : if value . strip ( ) . lower ( ) in self . NULL_VALUES : self . logger . error ( 'Missing RESOURCE_ID' , extra = { 'line_number' : self . line_number , 'column_number' : col_index + 1 , 'cause' : value } ) else : resource_id = value # make sure that RESOURCE_TYPE is present and correct if col_name == 'RESOURCE_TYPE' : if value . strip ( ) . lower ( ) in self . NULL_VALUES : self . logger . error ( 'Missing RESOURCE_TYPE' , extra = { 'line_number' : self . line_number , 'column_number' : col_index + 1 , 'cause' : value } ) elif value . strip ( ) not in self . RESOURCE_TYPES : self . logger . error ( 'RESOURCE_TYPE is not one of the following : SAMPLE, PATIENT or STUDY' , extra = { 'line_number' : self . line_number , 'column_number' : col_index + 1 , 'cause' : value } ) else : resource_type = value # make sure that DISPLAY_NAME is present if col_name == 'DISPLAY_NAME' : if value . strip ( ) . lower ( ) in self . NULL_VALUES : self . logger . error ( 'Missing DISPLAY_NAME' , extra = { 'line_number' : self . line_number , 'column_number' : col_index + 1 , 'cause' : value } ) # pass for other null columns if value . strip ( ) . lower ( ) in self . NULL_VALUES : pass # validate if OPEN_BY_DEFAULT and priority are correct if col_name == 'OPEN_BY_DEFAULT' : if not ( value . strip ( ) . lower ( ) == 'true' or value . strip ( ) . lower ( ) == 'false' ) : self . logger . error ( 'wrong value of OPEN_BY_DEFAULT, should be true or false' , extra = { 'line_number' : self . line_number , 'column_number' : col_index + 1 , 'cause' : value } ) if col_name == 'PRIORITY' : try : int ( value . strip ( ) ) except ValueError : self . logger . error ( 'wrong value of PRIORITY, the value should be integer' , extra = { 'line_number' : self . line_number , 'column_number' : col_index + 1 , 'cause' : value } ) # add resource_id into dictionary self . resource_definition_dictionary . setdefault ( resource_id , [ ] ) . append ( resource_type )