(self,
                        elements,
                        xbrl,
                        ignore_errors,
                        logger,
                        context_ids=[],
                        **kwargs)
Process a XBRL tag object and extract the correct value as
        stated by the context.
Process a XBRL tag object and extract the correct value as
        stated by the context.
Process a XBRL tag object and extract the correct value as stated by the context .
def data_processing(self,
                        elements,
                        xbrl,
                        ignore_errors,
                        logger,
                        context_ids=[],
                        **kwargs):
        """
        Process a XBRL tag object and extract the correct value as
        stated by the context.
        """
        options = kwargs.get('options', {'type': 'Number',
                                         'no_context': False})

        if options['type'] == 'String':
            if len(elements) > 0:
                    return elements[0].text

        if options['no_context'] == True:
            if len(elements) > 0 and XBRLParser().is_number(elements[0].text):
                    return elements[0].text

        try:

            # Extract the correct values by context
            correct_elements = []
            for element in elements:
                std = element.attrs['contextref']
                if std in context_ids:
                    correct_elements.append(element)
            elements = correct_elements

            if len(elements) > 0 and XBRLParser().is_number(elements[0].text):
                decimals = elements[0].attrs['decimals']
                if decimals is not None:
                    attr_precision = decimals
                    if xbrl.precision != 0 \
                    and xbrl.precison != attr_precision:
                        xbrl.precision = attr_precision
                if elements:
                    return XBRLParser().trim_decimals(elements[0].text,
                        int(xbrl.precision))
                else:
                    return 0
            else:
                return 0
        except Exception as e:
            if ignore_errors == 0:
                raise XBRLParserException('value extraction error')
            elif ignore_errors == 1:
                return 0
            elif ignore_errors == 2:
                logger.error(str(e) + " error at " +
                    ''.join(elements[0].text))
def data_processing ( self , elements , xbrl , ignore_errors , logger , context_ids = [ ] , * * kwargs ) : options = kwargs . get ( 'options' , { 'type' : 'Number' , 'no_context' : False } ) if options [ 'type' ] == 'String' : if len ( elements ) > 0 : return elements [ 0 ] . text if options [ 'no_context' ] == True : if len ( elements ) > 0 and XBRLParser ( ) . is_number ( elements [ 0 ] . text ) : return elements [ 0 ] . text try : # Extract the correct values by context correct_elements = [ ] for element in elements : std = element . attrs [ 'contextref' ] if std in context_ids : correct_elements . append ( element ) elements = correct_elements if len ( elements ) > 0 and XBRLParser ( ) . is_number ( elements [ 0 ] . text ) : decimals = elements [ 0 ] . attrs [ 'decimals' ] if decimals is not None : attr_precision = decimals if xbrl . precision != 0 and xbrl . precison != attr_precision : xbrl . precision = attr_precision if elements : return XBRLParser ( ) . trim_decimals ( elements [ 0 ] . text , int ( xbrl . precision ) ) else : return 0 else : return 0 except Exception as e : if ignore_errors == 0 : raise XBRLParserException ( 'value extraction error' ) elif ignore_errors == 1 : return 0 elif ignore_errors == 2 : logger . error ( str ( e ) + " error at " + '' . join ( elements [ 0 ] . text ) )