MedlineRecord(ExtendedRecord)

class metaknowledge.medline.MedlineRecord(inRecord, sFile='', sLine=0)

Class for full Medline(Pubmed) entries.

This class is an ExtendedRecord capable of generating its own id number. You should not create them directly, but instead use medlineParser() on a medline file.

__init__(inRecord, sFile='', sLine=0)

Base constructor for Records

fieldDict : is the unpared entry dict with tags as keys and their lines as a list of strings

idValue : is the unique ID of the Record, e.g. the WOS number

titleKey : is the tag giving the title of the Record, e.g. the WOS tag is 'TI'

bad : is the bool to flag the Record as having encountered an errror

error : is the error that bad indicates

sFile : is the name of the source file

sLine : is the line number of the start of the Record entry

altNames : is a dict that maps the names of tags to an alternative name, i.e. the long names dict. It must be bidirectional: map long to short and short to long

proccessingFuncs : is a dict of functions to proccess the tags. It has the short names as keys and their proccessing fucntions as values. Missing tags will result in the unparsed value to be returned.

The Records inheting from this must implement, calling the implementations in Record with super() will not cause errors:

  • writeRecord
  • tagProcessingFunc
  • encoding
  • titleTag
  • getAltName
encoding()

An abstractmethod, gives the encoding string of the record.

Returns

str

The encoding
static getAltName(tag)

An abstractmethod, gives the alternate name of tag or None

Parameters

tag : str

The requested tag

Returns

str

The alternate name of tag or None
specialFuncs(key)

An abstractmethod, process the special tag, key using the whole Record

Parameters

key : str

One of the special tags: 'authorsFull', 'keywords', 'grants', 'j9', 'authorsShort', 'volume', 'selfCitation', 'citations', 'address', 'abstract', 'title', 'month', 'year', 'journal', 'beginningPage' and 'DOI'

Returns

The processed value of key
static tagProcessingFunc(tag)

An abstractmethod, gives the function for processing tag

Parameters

tag : optional [str]

The tag in need of processing

Returns

function

The function to process the raw tag
writeRecord(f)

This is nearly identical to the original the FAU tag is the only tag not writen in the same place, doing so would require changing the parser and lots of extra logic.