lookit / lookit-api

Codebase for Lookit v2 and Experimenter v2. Includes an API. Docs: http://lookit.readthedocs.io/
https://lookit.mit.edu/
MIT License
10 stars 18 forks source link

Scoping: Query info for a grant #1403

Closed okaycj closed 3 months ago

okaycj commented 3 months ago

A research lab has asked us if we could provide information for the following statement:

"To date, XXX labs have used our platform to run XXX studies and we have XXX children aged 8-13 years enrolled in our registry"

Would this be an easy thing to query? Or should we offer something similar, but more tractable like "currently XXX children aged 8-13 years are registered on Children Helping Science"?

okaycj commented 3 months ago

Number of Labs

SQL Query

select count(distinct sl.name)
from studies_lab sl
where sl.institution not in ('Lookit', '') and sl.approved_to_test

Result

228

Number of Children Aged 12-13 Years

SQL Query

select count(*)
from (select given_name, birthday, AGE(NOW(), birthday) as age from accounts_child) sub
where sub.age between (interval '8' year) and (interval '14' year)

Result

8372

Number Studies With Responses From Children Aged 12-13 Years

select count(distinct sr.study_id) from studies_response sr
join accounts_child ac on ac.id = sr.child_id 
where AGE(NOW(), ac.birthday) between interval '8' year and interval '14' year

Result

664

okaycj commented 3 months ago

@ianchandlercampbell To the best of knowledge, this should be what you're looking for. Let me know if you have any questions.

ianchandlercampbell commented 3 months ago

@okaycj Perfect, thank you! I'll let the researchers know.