Skip to content

Commit

Permalink
Merge pull request #109 from IATI/check_transactions_dac
Browse files Browse the repository at this point in the history
Add search for DAC sector codes in transaction
  • Loading branch information
hayfield committed Aug 15, 2017
2 parents 52a14b9 + ba9af6b commit 22947bb
Show file tree
Hide file tree
Showing 2 changed files with 342 additions and 74 deletions.
4 changes: 2 additions & 2 deletions stats/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,8 @@ def is_text_in_element(elementName):
'contact-info': self.element.findall('contact-info/email'),
'location': self.element.xpath('location/point/pos|location/name|location/description|location/location-administrative'),
'location_point_pos': self.element.xpath('location/point/pos'),
'sector_dac': self.element.xpath('sector[@vocabulary="{}" or @vocabulary="{}" or not(@vocabulary)]'.format(self._dac_5_code(), self._dac_3_code())),
'sector_dac': self.element.xpath('sector[@vocabulary="{}" or @vocabulary="{}" or not(@vocabulary)]'.format(self._dac_5_code(), self._dac_3_code())) or
(self._major_version() != '1' and all_and_not_empty([transaction.xpath('sector[@vocabulary="{}" or @vocabulary="{}" or not(@vocabulary)]'.format(self._dac_5_code(), self._dac_3_code())) for transaction in self.element.xpath('transaction')])),
'capital-spend': self.element.xpath('capital-spend/@percentage'),
'document-link': self.element.findall('document-link'),
'activity-website': self.element.xpath('activity-website' if self._major_version() == '1' else 'document-link[category/@code="A12"]'),
Expand Down Expand Up @@ -1074,7 +1075,6 @@ def empty_or_percentage_sum_is_100(path, by_vocab=False):
else:
return len(elements) == 1 or sum(decimal_or_zero(x.attrib.get('percentage')) for x in elements) == 100

#import pdb;pdb.set_trace()
bools.update({
'version': bools['version'] and self.element.getparent().attrib['version'] in CODELISTS[self._major_version()]['Version'],
'iati-identifier': (
Expand Down
Loading

0 comments on commit 22947bb

Please sign in to comment.