Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from mp_api.core.resource import GetResource | ||
from emmet.core.electronic_structure import ElectronicStructureDoc | ||
|
||
from fastapi.param_functions import Query | ||
|
||
from mp_api.core.query_operator import PaginationQuery, SortQuery, SparseFieldsQuery | ||
from mp_api.routes.materials.query_operators import ( | ||
ElementsQuery, | ||
FormulaQuery, | ||
MinMaxQuery, | ||
) | ||
from mp_api.routes.dos.query_operators import DOSDataQuery | ||
|
||
from mp_api.core.utils import STORE_PARAMS | ||
from fastapi import HTTPException, Depends | ||
|
||
|
||
def es_resource(es_store): | ||
resource = GetResource( | ||
es_store, | ||
ElectronicStructureDoc, | ||
query_operators=[ | ||
FormulaQuery(), | ||
ElementsQuery(), | ||
MinMaxQuery(), | ||
SortQuery(), | ||
PaginationQuery(), | ||
SparseFieldsQuery( | ||
ElectronicStructureDoc, default_fields=["material_id", "last_updated"] | ||
), | ||
], | ||
tags=["Electronic Structure"], | ||
) | ||
|
||
return resource |