Page 1 of 1

F@H Stats API Enhancements?

Posted: Sat Apr 28, 2018 3:52 am
by bls1999
I contacted FAH's Facebook page to ask them about this and they said to post it on these forums. None of the forums really fit my posting purpose, so I hope this is the right place to post this. :?

I'm a web developer and I was hoping that some improvements to the stats API could be made. Namely, I'm requesting a mode that would get team-specific donor results when both a donor and a team are specified on the donor stats api script (/api/donors).

Right now, if I specify the name "bls1999", the data returned is this:

Code: Select all

{
   "description":"Name is 'bls1999'",
   "monthly":false,
   "results":[
      {
         "wus":414,
         "credit_cert":"api/awards/donor/credit/1574699/10269849",
         "name":"bls1999",
         "rank":17018,
         "credit":10269849,
         "team":143016,
         "wus_cert":"api/awards/donor/wus/1574699/414",
         "id":1574699
      }
   ],
   "month":4,
   "year":2018,
   "query":"donor",
   "path":"donors"
}
The only data added to this when a team is specified is to the description field, which changes to Name is 'bls1999' -- Team '143016'. This, as a developer, is a waste of potential information. If I want that information, the only place I can find it is the fast teampage URL for Team 143016.

What I'm proposing is a change to the structure of the returned data, to something like this when both a donor and a team number are sent:

Code: Select all

{
   "description":"Name is 'bls1999'",
   "monthly":false,
   "results":[
      {
         "wus":414,
         "credit_cert":"api/awards/donor/credit/1574699/10269849",
         "name":"bls1999",
         "rank":17018,
         "credit":10269849,
         "team":143016,
         "wus_cert":"api/awards/donor/wus/1574699/414",
         "id":1574699
      }
   ],
   "team_results":[
         "wus":414,
         "name":"bls1999",
         "rank":29,
         "credit":10269849
   ],
   "month":4,
   "year":2018,
   "query":"both",
   "path":"both"
}
If someone would be needed to make the needed improvements to the script, I would be happy to work on it a bit.

Please let me know if I can answer any questions. Thanks for reading! Cheers. :D

Re: F@H Stats API Enhancements?

Posted: Sat Apr 28, 2018 7:42 pm
by jcoffland
We currently only compute per donor contribution for the 1000 most active teams. This is why this data is only available on the fast team pages. This is a limitation of the current stats DB. We are working on rolling out a new DB which would make this easier. If you want this feature you best bet is to open an issue on GitHub here: https://github.com/FoldingAtHome/fah-issues/issues

Re: F@H Stats API Enhancements?

Posted: Sun Apr 29, 2018 5:31 am
by bls1999
jcoffland wrote:We currently only compute per donor contribution for the 1000 most active teams. This is why this data is only available on the fast team pages. This is a limitation of the current stats DB. We are working on rolling out a new DB which would make this easier. If you want this feature you best bet is to open an issue on GitHub here: https://github.com/FoldingAtHome/fah-issues/issues
Sounds good! I'll do that, thanks.