As outlined in a previous Discuss post, the Technical Team has been working towards upgrading the programming language that is used across a number of IATI tools from Python 2.x to Python 3.x
One of the tools that is undergoing upgrade work is IATI’s Publishing Statistics site.
Some of the functionality changes between Python2 and Python3 have led to some scores in the Publishing Statistics pages altering slightly. These changes - and how we propose to handle them - are summarised below:
Change to ‘Bankers’ Rounding’
- In Python2, x.5 numbers are rounded away from 0. E.g. 75.5 rounds to 76, 76.5 rounds to 77.
- In Python3, x.5 numbers are rounded to the nearest even integer. Therefore 75.5 still rounds to 76, but 76.5 would also round to 76.
- This means in Python3 that two publishers with a score that is a whole integer different in an initial calculation (e.g. 75.5 and 76.5) could be assigned the same score - 76 in this case.
- The Technical Team proposes that we amend the code so that the Python2 functionality is replicated (while still upgrading the language itself to Python3), so that those two publishers would continue to score 76 and 77, respectively.
Change to integer division functionality
- In Python2, an integer divided by another integer, yields an integer. E.g. (2 / 3) * 100 = 66%
- In Python3, an integer divided by another integer, yields a ‘float’. E.g. (2 / 3) * 100 = 66.66%
- The Technical Team proposes that the core Python3 functionality is retained. Therefore where an initial calculation of 66.66 is currently output as 66, this will change to the value being output as 67.
The only material difference to the metrics (as a result of the integer division change) is that some values in the Publishing Statistics calculations will be one unit higher than they currently are. Therefore, no publisher will be penalised by the changes that we propose.
We welcome the community’s thoughts on this before proceeding with the amendments and deploying to the live Publisher Statistics site. Please provide your input by Wednesday 15th April. The upgrade will be implemented following this if there are no objections.
Many thanks,
IATI Tech Team