예제 #1
0
  def __init__(self, abstract, useAnnotated=False, useTrialReports=True):
    """ create a list of groups and common medical conditions given 
        an abstact object. """
    self.abstract = abstract
    self.useTrialReports = useTrialReports
    self.nTrueGroups = 0
    self.nTrueConditions = 0
    self.nTrueGroupSizes = 0

    if useAnnotated == True:
      self.groupTemplates = abstract.annotatedEntities.getList('group')
      self.ageTemplates = createAnnotatedMergedList(abstract, 'age')
      self.conditionTemplates = abstract.annotatedEntities.getList('condition')
      populationTemplates = createAnnotatedMergedList(abstract, 'population')
    else:  
      self.groupTemplates = abstract.entities.getList('group')
      self.ageTemplates = createMergedList(abstract, 'age')
      self.conditionTemplates = abstract.entities.getList('condition')
      populationTemplates = createMergedList(abstract, 'population') 
           
    self.ageInfo = AgeInfo(self.ageTemplates, abstract, self.useTrialReports) 
    self.gender = Gender(populationTemplates, abstract, self.useTrialReports)
    
    
    # filter useless population terms
    self.populationTemplates = []
    for pTemplate in populationTemplates:
      if pTemplate.isInteresting() > 0:
        # term is informative, keep it
        self.populationTemplates.append(pTemplate)
예제 #2
0
    def __init__(self, abstract, useTrialReports=True):
        """ build list of locations """
        self.abstract = abstract
        self.source = ''
        self.locationTemplates = []
        self.locationStrings = []

        if useTrialReports and self.abstract.report != None \
          and len(self.abstract.report.locations) > 0:
            for country in self.abstract.report.locations:
                self.locationStrings.append(country)
                self.source = 'trial_registry'
        else:
            self.locationTemplates = createMergedList(abstract, 'location')
            self.source = 'abstract'
            if len(self.locationTemplates) == 0 \
               and len(self.abstract.affiliationSentences) > 0:
                # use location in the affiliation section of the abstract
                self.source = 'affiliation'
                s = self.abstract.affiliationSentences[0]
                lastTokenIndex = len(s.tokens) - 1
                if s.tokens[lastTokenIndex].text == '.':
                    lastTokenIndex -= 1
                if lastTokenIndex > 0 and s.tokens[lastTokenIndex].isLocation(
                ):
                    country = s.tokens[lastTokenIndex].text
                    i = lastTokenIndex - 1
                    while i >= 0 and s.tokens[i].text != ',':
                        country = s.tokens[i].text + ' ' + country
                        i -= 1
                    self.locationStrings.append(country)
예제 #3
0
  def __init__(self, abstract, useTrialReports=True):
    """ build list of locations """
    self.abstract = abstract
    self.source = ''
    self.locationTemplates = []
    self.locationStrings = []

    if useTrialReports and self.abstract.report != None \
      and len(self.abstract.report.locations) > 0:
      for country in self.abstract.report.locations:
        self.locationStrings.append(country)
        self.source = 'trial_registry'
    else: 
      self.locationTemplates = createMergedList(abstract, 'location') 
      self.source = 'abstract'
      if len(self.locationTemplates) == 0 \
         and len(self.abstract.affiliationSentences) > 0:
        # use location in the affiliation section of the abstract
        self.source = 'affiliation'
        s = self.abstract.affiliationSentences[0]
        lastTokenIndex = len(s.tokens)-1
        if s.tokens[lastTokenIndex].text == '.':
          lastTokenIndex -= 1
        if lastTokenIndex > 0 and s.tokens[lastTokenIndex].isLocation():
          country = s.tokens[lastTokenIndex].text
          i = lastTokenIndex - 1
          while i >= 0 and s.tokens[i].text != ',':
            country = s.tokens[i].text + ' ' + country
            i -= 1
          self.locationStrings.append(country)