person.rank is the rank of the person in the database: https://github.com/fedora-infra/tahrir-api/blob/develop/tahrir_api/model.py#L113 while the rank from the user_to_rank is the index of the person in that OrderedDict which should correspond to the ranking of this person in that period of time.

So I would actually use %{rank} instead of %{person.rank} here (unless I am mistaking in understanding the code).