more use(less,ful) comments
This commit is contained in:
@@ -83,10 +83,10 @@ class Entrypoint:
|
||||
def __init__(self, sample_data):
|
||||
try:
|
||||
self.extra = sample_data["metadata_decoded"]["extra_fields"]
|
||||
self.linked_items = sample_data["items_links"]
|
||||
self.batch_elabid = self.extra["Substrate batch"]["value"]
|
||||
self.linked_experiments = sample_data["related_experiments_links"]
|
||||
self.linked_experiments_elabid = [ i["entityid"] for i in self.linked_experiments ]
|
||||
self.linked_items = sample_data["items_links"] # dict
|
||||
self.batch_elabid = self.extra["Substrate batch"]["value"] # elabid
|
||||
self.linked_experiments = sample_data["related_experiments_links"] # dict
|
||||
self.linked_experiments_elabid = [ i["entityid"] for i in self.linked_experiments ] # list of elabid
|
||||
except KeyError as k:
|
||||
# Some keys are not required and can be called through the .get() method - which is permissive and allows null values;
|
||||
# Other keys are required so if they can't be called (invalid or null) raise error and stop execution of the program:
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Currently unused!
|
||||
"""
|
||||
import json, requests
|
||||
from APIHandler import APIHandler
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ if __name__=="__main__":
|
||||
elif data.get("category_title") in ["PLD Target", "Substrate"]:
|
||||
item = Material(data)
|
||||
print(item.get_compound_formula(apikey))
|
||||
else:
|
||||
raise Exception("The selected item or experiment is not in one of the following categories: [Sample, PLD Target, Substrate, PLD Deposition].")
|
||||
result = item.__dict__
|
||||
result.pop("extra")
|
||||
print(result)
|
||||
Reference in New Issue
Block a user