-
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.
feature/mx-1744 combine ruleset and extracted item ingestion (#249)
### Changes - update mex-common to 0.50.0 - GraphConnector.ingest now accepts rule-set requests as well - BREAKING: GraphConnector.ingest returns a list of ingested models, instead of ids - POST /ingest now accepts rule-set requests as well as extracted items - BREAKING: POST /ingest returns a container of ingested models, instead of ids ### Removed - remove GraphConnector.create_rule_set, in favor of combined ingest method - remove unused ingest_extracted_items_into_graph helper - remove unused BulkIngestRequest and BulkIngestResponse
- Loading branch information
1 parent
3686d86
commit fb49bb8
Showing
11 changed files
with
132 additions
and
125 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
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 was deleted.
Oops, something went wrong.
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,13 +1,22 @@ | ||
from fastapi import APIRouter | ||
from starlette import status | ||
|
||
from mex.backend.ingest.helpers import ingest_extracted_items_into_graph | ||
from mex.backend.ingest.models import BulkIngestRequest, BulkIngestResponse | ||
from mex.backend.graph.connector import GraphConnector | ||
from mex.common.models import ( | ||
AnyExtractedModel, | ||
AnyRuleSetResponse, | ||
ItemsContainer, | ||
) | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.post("/ingest", status_code=status.HTTP_201_CREATED, tags=["extractors"]) | ||
def ingest_extracted_items(request: BulkIngestRequest) -> BulkIngestResponse: | ||
"""Ingest a batch of extracted items and return their identifiers.""" | ||
return ingest_extracted_items_into_graph(request.items) | ||
def ingest( | ||
request: ItemsContainer[AnyExtractedModel | AnyRuleSetResponse], | ||
) -> ItemsContainer[AnyExtractedModel | AnyRuleSetResponse]: | ||
"""Ingest a batch of extracted items or rule-sets and return them.""" | ||
connector = GraphConnector.get() | ||
return ItemsContainer[AnyExtractedModel | AnyRuleSetResponse]( | ||
items=connector.ingest(request.items) | ||
) |
This file was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.