-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add the necessary structure for the feature pipelines and Mongo…
…DB SQL
- Loading branch information
1 parent
c4d7849
commit f1036a8
Showing
16 changed files
with
154 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
parameters: | ||
parameters: | ||
limit: 100 | ||
extract_collection_name: raw_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
parameters: | ||
parameters: | ||
data_directory: data/ | ||
load_collection_name: raw_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
parameters: | ||
parameters: | ||
limit: 100 | ||
extract_collection_name: raw_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
from zenml import pipeline | ||
|
||
from second_brain.config import settings | ||
from steps.infrastructure import ( | ||
fetch_from_mongodb, | ||
) | ||
|
||
|
||
@pipeline | ||
def compute_rag_vector_index() -> None: | ||
fetch_documents_config = { | ||
"mongodb_uri": settings.MONGODB_OFFLINE_URI, | ||
"database_name": settings.MONGODB_OFFLINE_DATABASE, | ||
"collection_name": settings.MONGODB_OFFLINE_COLLECTION, | ||
"limit": 100, | ||
} | ||
|
||
fetch_from_mongodb(**fetch_documents_config) | ||
def compute_rag_vector_index(limit: int = 100, extract_collection_name: str = "raw_data") -> None: | ||
fetch_from_mongodb(limit=limit, collection_name=extract_collection_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
from zenml import pipeline | ||
|
||
from second_brain.config import settings | ||
from steps.etl import crawl, read_pages_from_disk | ||
from steps.infrastructure import ( | ||
fetch_from_mongodb, | ||
ingest_to_mongodb, | ||
) | ||
|
||
|
||
@pipeline | ||
def etl() -> None: | ||
ingest_json_config = { | ||
"mongodb_uri": settings.MONGODB_OFFLINE_URI, | ||
"database_name": settings.MONGODB_OFFLINE_DATABASE, | ||
"collection_name": settings.MONGODB_OFFLINE_COLLECTION, | ||
"data_directory": settings.DATA_DIRECTORY, | ||
} | ||
fetch_documents_config = { | ||
"mongodb_uri": settings.MONGODB_OFFLINE_URI, | ||
"database_name": settings.MONGODB_OFFLINE_DATABASE, | ||
"collection_name": settings.MONGODB_OFFLINE_COLLECTION, | ||
"limit": 100, | ||
} | ||
def etl(data_directory: str, load_collection_name: str) -> None: | ||
pages = read_pages_from_disk(data_directory=data_directory) | ||
documents = crawl(pages=pages) | ||
ingest_to_mongodb(documents=documents, collection_name=load_collection_name) | ||
|
||
ingest_to_mongodb(**ingest_json_config) | ||
|
||
fetch_from_mongodb(**fetch_documents_config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
from zenml import pipeline | ||
|
||
from second_brain.config import settings | ||
from steps.infrastructure import ( | ||
fetch_from_mongodb, | ||
) | ||
|
||
|
||
@pipeline | ||
def generate_dataset() -> None: | ||
fetch_documents_config = { | ||
"mongodb_uri": settings.MONGODB_OFFLINE_URI, | ||
"database_name": settings.MONGODB_OFFLINE_DATABASE, | ||
"collection_name": settings.MONGODB_OFFLINE_COLLECTION, | ||
"limit": 100, | ||
} | ||
|
||
fetch_from_mongodb(**fetch_documents_config) | ||
def generate_dataset(limit: int = 100, extract_collection_name: str = "raw_data") -> None: | ||
fetch_from_mongodb(limit=limit, collection_name=extract_collection_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.