OxbridgeEconomics commited on
Commit
ecb280c
·
1 Parent(s): fcadd90

fix: update import paths to streamline database collection access

Browse files
app/collectors/finfast/article.py CHANGED
@@ -2,7 +2,7 @@
2
  from venv import logger
3
  from datetime import datetime, timedelta
4
  from pymongo.errors import PyMongoError
5
- from database.mongodb import article_collection
6
 
7
  from .utils import scan_dynamodb_table, delete_old_documents, upsert_item
8
 
 
2
  from venv import logger
3
  from datetime import datetime, timedelta
4
  from pymongo.errors import PyMongoError
5
+ from database import article_collection
6
 
7
  from .utils import scan_dynamodb_table, delete_old_documents, upsert_item
8
 
app/collectors/finfast/category.py CHANGED
@@ -11,7 +11,7 @@ from typing import Dict, List, Tuple
11
  from collections import defaultdict
12
  from dataclasses import dataclass
13
  from botocore.exceptions import ClientError
14
- from database.mongodb import category_collection
15
 
16
  from ..utils import get_client_connection
17
 
 
11
  from collections import defaultdict
12
  from dataclasses import dataclass
13
  from botocore.exceptions import ClientError
14
+ from database import category_collection
15
 
16
  from ..utils import get_client_connection
17
 
app/collectors/finfast/entity.py CHANGED
@@ -1,7 +1,7 @@
1
  """Module for collecting and managing entity data from DynamoDB to MongoDB."""
2
  from datetime import datetime, timedelta
3
  from pymongo.errors import PyMongoError
4
- from database.mongodb import entity_collection
5
 
6
  from .utils import scan_dynamodb_table, delete_old_documents, upsert_item
7
 
 
1
  """Module for collecting and managing entity data from DynamoDB to MongoDB."""
2
  from datetime import datetime, timedelta
3
  from pymongo.errors import PyMongoError
4
+ from database import entity_collection
5
 
6
  from .utils import scan_dynamodb_table, delete_old_documents, upsert_item
7
 
app/controllers/category.py CHANGED
@@ -4,7 +4,7 @@ Category Controller - Business logic for handling category data.
4
  This module contains functions that interact with the database
5
  to fetch and process data sorted by category
6
  """
7
- from database.mongodb import category_collection
8
  def get_categories():
9
 
10
  """
 
4
  This module contains functions that interact with the database
5
  to fetch and process data sorted by category
6
  """
7
+ from database import category_collection
8
  def get_categories():
9
 
10
  """
app/controllers/summary/utils.py CHANGED
@@ -6,7 +6,7 @@ from datetime import datetime, timedelta
6
  from typing import Dict, Any, List, DefaultDict
7
  from collections import defaultdict
8
 
9
- from database.mongodb import article_collection, entity_collection
10
 
11
 
12
  def _get_latest_publish_date_from_collection(collection) -> datetime:
 
6
  from typing import Dict, Any, List, DefaultDict
7
  from collections import defaultdict
8
 
9
+ from database import article_collection, entity_collection
10
 
11
 
12
  def _get_latest_publish_date_from_collection(collection) -> datetime:
app/database/__init__.py CHANGED
@@ -1,10 +1,8 @@
1
  """Module for Mongodb database"""
2
- from .mongodb import MongodbClient, FinFastMongodbClient
3
-
4
- MongoClient = MongodbClient
5
- FinFastMongoClient = FinFastMongodbClient
6
 
7
  __all__ = [
8
- "MongoClient",
9
- "FinFastMongoClient"
 
10
  ]
 
1
  """Module for Mongodb database"""
2
+ from .mongodb import article_collection, entity_collection, category_collection
 
 
 
3
 
4
  __all__ = [
5
+ "article_collection",
6
+ "entity_collection",
7
+ "category_collection"
8
  ]
app/database/mongodb.py CHANGED
@@ -3,7 +3,6 @@ import os
3
  from pymongo import MongoClient
4
 
5
  MongodbClient = MongoClient(os.getenv('MONGODB_URI'))
6
- FinFastMongodbClient = MongoClient(os.getenv("MONGODB_FINFAST_URI"))
7
- article_collection = FinFastMongodbClient["FinFAST_China"]["Article"]
8
- category_collection = FinFastMongodbClient["FinFAST_China"]["Category"]
9
- entity_collection = FinFastMongodbClient["FinFAST_China"]["Entity"]
 
3
  from pymongo import MongoClient
4
 
5
  MongodbClient = MongoClient(os.getenv('MONGODB_URI'))
6
+ article_collection = MongodbClient["FinFAST_China"]["Article"]
7
+ category_collection = MongodbClient["FinFAST_China"]["Category"]
8
+ entity_collection = MongodbClient["FinFAST_China"]["Entity"]