microbiomedata / nmdc-server

Data portal client and server for NMDC.
https://data.microbiomedata.org
Other
9 stars 0 forks source link

Update `/api/stats` endpoint to return additional metrics data #1266

Open eecavanna opened 4 months ago

eecavanna commented 4 months ago

Tasks

Note: The assessment (second task) may result in us deciding not to pursue the implementation (third task).


Current behavior

For reference, here's what the /api/stats endpoint returns today:

{
  "studies": 28,
  "locations": 33,
  "habitats": 37,
  "data_size": 77352654942449,
  "metagenomes": 2927,
  "metatranscriptomes": 111,
  "proteomics": 52,
  "metabolomics": 34,
  "lipodomics": 0,
  "organic_matter_characterization": 2767
}
eecavanna commented 3 months ago

Here's the SQL query we submit to the Postgres database in order to get the number of user accounts that exist:

SELECT count(*)
FROM (
    SELECT DISTINCT(orcid)
    FROM user_logins
) as distinct_orcids;

-- Note: That happens to produce the same result as... 
--   SELECT count(*)
--   FROM user_logins;