Skip to content

Commit

Permalink
SNL ID added to mpcomplete endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed Apr 7, 2021
1 parent e3ccc89 commit 520a77b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app.py
Expand Up @@ -277,7 +277,7 @@
mpcomplete_store = MongoURIStore(
uri=f"mongodb+srv://{db_uri}",
database="mp_consumers",
key="structure",
key="snl_id",
collection_name="mpcomplete",
)

Expand Down
4 changes: 4 additions & 0 deletions src/mp_api/mpcomplete/models.py
Expand Up @@ -7,6 +7,10 @@ class MPCompleteDoc(BaseModel):
Defines data for MPComplete structure submissions
"""

snl_id: str = Field(
None, title="SNL ID", description="ID for the submission.",
)

structure: Structure = Field(
None,
title="Submitted structure",
Expand Down
4 changes: 4 additions & 0 deletions src/mp_api/mpcomplete/query_operator.py
Expand Up @@ -3,6 +3,7 @@
from pymatgen.core.structure import Structure
from mp_api.core.utils import STORE_PARAMS
from mp_api.core.query_operator import QueryOperator
from uuid import uuid4


class MPCompletePostQuery(QueryOperator):
Expand All @@ -20,8 +21,10 @@ def query(
self.public_name = public_name
self.public_email = public_email
self.comment = comment
self.snl_id = str(uuid4())

crit = {
"snl_id": self.snl_id,
"structure": structure,
"public_email": public_email,
"public_name": public_name,
Expand All @@ -34,6 +37,7 @@ def post_process(self, written):

d = [
{
"snl_id": self.snl_id,
"structure": self.structure,
"public_email": self.public_email,
"public_name": self.public_name,
Expand Down
5 changes: 0 additions & 5 deletions src/mp_api/thermo/client.py
@@ -1,11 +1,6 @@
from typing import List, Optional, Tuple
from collections import defaultdict

from mp_api.core.client import BaseRester
from mp_api.thermo.models import ThermoDoc

import warnings


class ThermoRester(BaseRester):

Expand Down

0 comments on commit 520a77b

Please sign in to comment.