Skip to content

Commit

Permalink
get mongo docs
Browse files Browse the repository at this point in the history
  • Loading branch information
laugustyniak committed Mar 27, 2024
1 parent 168dd71 commit 68d04ae
Show file tree
Hide file tree
Showing 3 changed files with 489 additions and 346 deletions.
5 changes: 4 additions & 1 deletion juddges/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
'doc_host': 'https://laugustyniak.github.io',
'git_url': 'https://github.com/laugustyniak/juddges',
'lib_path': 'juddges'},
'syms': {'juddges.data.pl_court_api': {}, 'juddges.prompts.information_extraction': {}, 'juddges.settings': {}}}
'syms': { 'juddges.data.models': {},
'juddges.data.pl_court_api': {},
'juddges.prompts.information_extraction': {},
'juddges.settings': {}}}
16 changes: 16 additions & 0 deletions juddges/data/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from pymongo import MongoClient

if os.environ.get("MONGO_URI", None) is None:
raise Exception("Missing `MONGO_URI` environment variable.")


if os.environ.get("MONGO_DB_NAME", None) is None:
raise Exception("Missing `MONGO_DB_NAME` environment variable.")


def get_mongo_collection(collection_name: str):
client = MongoClient(os.environ["MONGO_URI"])
db = client[os.environ["MONGO_DB_NAME"]]
return db[collection_name]
Loading

0 comments on commit 68d04ae

Please sign in to comment.