From 01c4829564698f5329f51f7fb128bdfd68f11b38 Mon Sep 17 00:00:00 2001 From: lasseedfast <> Date: Thu, 17 Oct 2024 14:41:59 +0200 Subject: [PATCH] Refactor test.py to import necessary modules, update code structure, and retrieve crossref data for dois_checked collection --- test.pdf | 3 +++ test.py | 28 +++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 test.pdf diff --git a/test.pdf b/test.pdf new file mode 100644 index 0000000..78de9ec --- /dev/null +++ b/test.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:622fad792b585088c13bfb2455ab30822083046fb8ae46c79866d568fd8cd8dd +size 14416 diff --git a/test.py b/test.py index 154dfe2..dcf2ee6 100644 --- a/test.py +++ b/test.py @@ -1,19 +1,17 @@ +import crossref_commons.retrieval as crossref from _arango import ArangoDB - +from time import sleep arango = ArangoDB() -initiatives = [i for i in arango.db.collection("eu_initiatives").all()] -ordered_by_headline = sorted(initiatives, key=lambda x: x["headline"]) -import env_manager -import os -from ollama import Client -import httpx - -ollama = Client( - os.getenv("https://lasseedfast.se/api/chat/"), - auth=httpx.BasicAuth(username="lasse", password="p239q8wimerxr2m389"), -) +checked = arango.db.collection('dois_checked').all() -ollama.generate( - "What is the European Green Deal?" -) # This will generate a response from the LLM model +for doi in checked: + print(doi) + try: + crossref_data = crossref.get_publication_as_json(doi['doi']) + arango.db.collection('dois_checked').update({'_key': doi['_key'], 'crossref_data': crossref_data}) + sleep(1) + except Exception as e: + print(e) + sleep(1) + continue