Citations
#404
Replies: 1 comment
-
Hi @c-heat16, thank you so much for your message. I tried to debug the issue to see if this is an SDK, API, or frontend problem. I wrote a small script creating citation on an experiment, saved it to API, and got it back from the API. I can see that the SDK can properly save it to the API and the API can correctly retrieve it, so I am thinking that this might be a frontend issue. @bearmit is our frontend engineers and are more knowledgeable about the frontend and can answer this question better than I can. import datetime
import json
import os
import cript
with cript.API(host="https://lb-stage.mycriptapp.org/", api_token=os.getenv("CRIPT_TOKEN"),
storage_token=os.getenv("CRIPT_STORAGE_TOKEN")) as api:
# current time to keep the node names unique
current_time = str(datetime.datetime.now())
# create needed nodes
my_project = cript.Project(name=f"my project name {current_time}")
my_collection = cript.Collection(name=f"my collection name {current_time}")
my_experiment = cript.Experiment(name=f"my experiment name {current_time}")
my_reference = cript.Reference(type="journal_article", title=f"my title {current_time}")
my_citation = cript.Citation(type="reference", reference=my_reference)
# assemble the nodes
my_project.collection = [my_collection]
my_project.collection[0].experiment = [my_experiment]
my_project.collection[0].experiment[0].citation = [my_citation]
# print(my_project.json)
# save Project to API
api.save(project=my_project)
# get frontend Project URL for easy viewing
print(f"https://stage.mycriptapp.org/Project/{my_project.uuid}")
# get the project from API
project_paginator = api.search(
node_type=cript.Project,
search_mode=cript.SearchModes.UUID,
value_to_search=str(my_project.uuid)
)
# convert first result from paginator to node
my_project_node_from_api = cript.load_nodes_from_json(
nodes_json=json.dumps(project_paginator.current_page_results[0])
)
print(my_project_node_from_api.json) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Where are experiment citations presented?
I have added a citation to an experiment as described below, but I can't seem to find it on the experiment page of the CRIPT site. This was working in the previous version of CRIPT, so maybe I'm just missing it? Or maybe I'm adding it incorrectly?
Code:
Experiment in CRIPT:

Beta Was this translation helpful? Give feedback.
All reactions