FoldingAtHome / fah-issues

49 stars 9 forks source link

[Stats API] Donor's stats for a specific team #1227

Open bls1999 opened 6 years ago

bls1999 commented 6 years ago

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:

{
   "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:

{
   "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"
}

I assume this is scripted in php. If someone would be needed to make the needed improvements to the script, I would be happy to work on it a bit.

jcoffland commented 6 years ago

Thanks for the enhancement request. I'll keep this in mind when I update the stats scripts for the new stats DB. FYI, not php but Python.

bls1999 commented 6 years ago

@jcoffland sounds good! Thanks!