ooiservices/app/uframe/vocab.py
def make_display_name(data):
    """ Get display name values from data in vocab element provided. Return long_name, name and id.
    Sample input data item:
        {
          "@class" : ".VocabRecord",
          "refdes" : "CE01ISSM-MFC31-00-CPMENG000",
          "vocabId" : 1,
          "instrument" : "Buoy Controller Engineering",
          "tocL1" : "Endurance",
          "tocL2" : "OR Inshore Surface Mooring",
          "tocL3" : "Multi-Function Node"
        }
    """
    long_name = None
    name = None
    id = 0
    try:
        rd = data['refdes']
        rd_len = len(rd)
        if rd_len == 27:
            tmp = " ".join([data['tocL1'], data['tocL2']])
            long_name = " - ".join([tmp, data['tocL3'], data['instrument']])
            name = data['instrument']
            id = data['vocabId']
        else:
            message = 'Malformed reference designator (%s), cannot process vocabulary.' % rd
            current_app.logger.info(message)

        return long_name, name, id

    except Exception as err:
        message = 'Failed to assemble display_name for vocabulary; %s ' % str(err)
        return None, None, 0
 Get display name values from data in vocab element provided. Return long_name, name and id.
    Sample input data item:
        {
          "@class" : ".VocabRecord",
          "refdes" : "CE01ISSM-MFC31-00-CPMENG000",
          "vocabId" : 1,
          "instrument" : "Buoy Controller Engineering",
          "tocL1" : "Endurance",
          "tocL2" : "OR Inshore Surface Mooring",
          "tocL3" : "Multi-Function Node"
        }
    
Get display name values from data in vocab element provided. Return long_name, name and id.
Get display name values from data in vocab element provided . Return long_name name and id .
def make_display_name(data):
    long_name = None
    name = None
    id = 0
    try:
        rd = data['refdes']
        rd_len = len(rd)
        if rd_len == 27:
            tmp = " ".join([data['tocL1'], data['tocL2']])
            long_name = " - ".join([tmp, data['tocL3'], data['instrument']])
            name = data['instrument']
            id = data['vocabId']
        else:
            message = 'Malformed reference designator (%s), cannot process vocabulary.' % rd
            current_app.logger.info(message)
        return long_name, name, id
    except Exception as err:
        message = 'Failed to assemble display_name for vocabulary; %s ' % str(err)
        return None, None, 0
def make_display_name ( data ) : long_name = None name = None id = 0 try : rd = data [ 'refdes' ] rd_len = len ( rd ) if rd_len == 27 : tmp = " " . join ( [ data [ 'tocL1' ] , data [ 'tocL2' ] ] ) long_name = " - " . join ( [ tmp , data [ 'tocL3' ] , data [ 'instrument' ] ] ) name = data [ 'instrument' ] id = data [ 'vocabId' ] else : message = 'Malformed reference designator (%s), cannot process vocabulary.' % rd current_app . logger . info ( message ) return long_name , name , id except Exception as err : message = 'Failed to assemble display_name for vocabulary; %s ' % str ( err ) return None , None , 0
Get display name values from data in vocab element provided.
Get display name values from data in vocab element provided .
""" Get display name values from data in vocab element provided. Return long_name, name and id.
    Sample input data item:
        {
          "@class" : ".VocabRecord",
          "refdes" : "CE01ISSM-MFC31-00-CPMENG000",
          "vocabId" : 1,
          "instrument" : "Buoy Controller Engineering",
          "tocL1" : "Endurance",
          "tocL2" : "OR Inshore Surface Mooring",
          "tocL3" : "Multi-Function Node"
        }
    """
data