Logo Search packages:      
Sourcecode: zope-cmfbibliographyat version File versions  Download package

def CMFBibliographyAT::tool::parsers::medline::MedlineParser::parseEntry (   self,
  entry 
)

parses a single entry

returns a dictionary to be passed to
BibliographyEntry's edit method

Definition at line 62 of file medline.py.

00062                                :
        """
        parses a single entry
        
        returns a dictionary to be passed to
        BibliographyEntry's edit method
        """
        result = {}
        
        tokens = self.pattern.split(entry)

        checkAU = 0
        if 'FAU - ' not in tokens:
            checkAU = 1
            
        nested = []
        for i in range(1,len(tokens),2):
            nested.append([tokens[i],tokens[i+1]])

        # some defaults
        result['note'] = 'automatic medline import'

        for key, value in nested:
            if key == 'PT  - ' and value.find('Journal Article')> -1:
                result['publication_type'] = 'ArticleReference'
            elif key == 'TI  - ':
                title = value.replace('\n', ' ').replace('      ', '').strip()
                result['title'] = title
            elif key == 'AB  - ':
                tmp = value.replace('\n', ' ').replace('  ', '')
                result['abstract'] = tmp.replace('  ', '').replace('  ', '')
            elif key == 'PMID- ': result['pmid'] = str(value).strip()
            elif key == 'TA  - ': result['journal'] = str(value).strip()
            elif key == 'VI  - ': result['volume'] = str(value).strip()
            elif key == 'IP  - ': result['number'] = str(value).strip()
            elif key == 'PG  - ': result['pages'] = str(value).strip()
            elif key == 'DP  - ':
                result['publication_year'] = value[:4]
                result['publication_month'] = value[5:].replace('\n','').replace('\r','')
            elif key == 'FAU - ':
                raw = value.replace('\n', '').split(', ')
                lname = raw[0]
                fnames = raw[1].split(' ',1)
                fname = fnames[0]
                if len(fnames)> 1:
                    minit = fnames[1]
                else:
                    minit = ''
                adict = {'firstname': fname
                         ,'middlename': minit
                         ,'lastname': lname
                         }
                result.setdefault('authors',[]).append(adict)

            elif checkAU and key == 'AU  - ':
                raw = value.replace('\n', '').split()
                lname = raw[0]
                fnames = raw[1]
                fname = fnames[0]
                if len(fnames)> 1:
                    minit = fnames[1:]
                else:
                    minit = ''
                adict = {'firstname': fname
                         ,'middlename': minit
                         ,'lastname': lname
                         }
                result.setdefault('authors',[]).append(adict)
    
        return result

 # Class instanciation
InitializeClass(MedlineParser)

   
def manage_addMedlineParser(self, REQUEST=None):


Generated by  Doxygen 1.6.0   Back to index