Refactor test.py to import necessary modules, update code structure, and retrieve crossref data for dois_checked collection

main
lasseedfast 1 year ago
parent 96c4a13aa5
commit 01c4829564
  1. 3
      test.pdf
  2. 28
      test.py

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:622fad792b585088c13bfb2455ab30822083046fb8ae46c79866d568fd8cd8dd
size 14416

@ -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

Loading…
Cancel
Save