File tree Expand file tree Collapse file tree 3 files changed +22
-23
lines changed
Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Original file line number Diff line number Diff line change 3030from pydantic .main import BaseModel
3131
3232from nomad import normalizing
33- from nomad .app .v1 .models import Aggregation , StatisticsAggregation
3433from nomad .config import config
3534from nomad .parsing import parsers
3635from nomad .parsing .parsers import code_metadata
37- from nomad .search import search
36+ from nomad .search import get_statistics
3837from nomad .utils import strip
3938
4039INFO_CACHE_TTL : Final [int ] = 1 * 24 * 60 * 60 # 1 day in seconds
@@ -120,26 +119,6 @@ class InfoModel(BaseModel):
120119 )
121120
122121
123- def get_statistics ():
124- search_response = search (
125- aggregations = dict (
126- statistics = Aggregation (
127- statistics = StatisticsAggregation (
128- metrics = [
129- 'n_entries' ,
130- 'n_materials' ,
131- 'n_uploads' ,
132- 'n_quantities' ,
133- 'n_calculations' ,
134- ]
135- )
136- )
137- )
138- )
139- statistics = search_response .aggregations ['statistics' ].statistics .data
140- return statistics
141-
142-
143122@router .get (
144123 '' ,
145124 tags = [APITag .DEFAULT ],
Original file line number Diff line number Diff line change 4949
5050import nomad .patch # noqa: F401
5151from nomad import infrastructure , utils
52- from nomad .app .v1 .routers .info import get_statistics
5352from nomad .config import config
5453from nomad .config .models .config import CELERY_WORKER_ROUTING
54+ from nomad .search import get_statistics
5555
5656if config .logstash .enabled :
5757 from nomad .utils import structlogging
Original file line number Diff line number Diff line change @@ -1973,3 +1973,23 @@ def quantity_values(
19731973 page_after_value = value_agg .pagination .next_page_after_value
19741974 if page_after_value is None :
19751975 break
1976+
1977+
1978+ def get_statistics ():
1979+ search_response = search (
1980+ aggregations = dict (
1981+ statistics = Aggregation (
1982+ statistics = StatisticsAggregation (
1983+ metrics = [
1984+ 'n_entries' ,
1985+ 'n_materials' ,
1986+ 'n_uploads' ,
1987+ 'n_quantities' ,
1988+ 'n_calculations' ,
1989+ ]
1990+ )
1991+ )
1992+ )
1993+ )
1994+ statistics = search_response .aggregations ['statistics' ].statistics .data
1995+ return statistics
You can’t perform that action at this time.
0 commit comments