Catalog PyPI
PACKAGE EXPLORERView in registry

abs-pipelines-core

PyPI

Core utilities for building MongoDB/Cosmos DB aggregation pipelines

Versions collected1
Direct dependencies3From release 0.1.1
Last observed20 Oct, 17:38 UTC

README

Version 0.1.1 documentation

abs-pipelines-core

MongoDB aggregation pipeline builders and file operations for record enrichment.

Installation

# From PyPI
pip install abs-pipelines-core

# Or with Poetry
poetry add abs-pipelines-core

Quick Start - Record Enrichment

Use prepare_enrichment() to get everything you need in one call:

from abs_pipelines_core import RecordEnricher

enricher = RecordEnricher(
    blob_service=blob_service,
    user_collection_name="user_documents"
)

# Fetch ALL fields for the entity
fields = (await field_repository.get_all(filters)).get("founds", [])

# Prepare enrichment config (with optional record filter)
config = enricher.prepare_enrichment(
    fields=fields,
    record_ids=["rec_id_1", "rec_id_2"],  # Optional: filter by specific IDs
    option_field_ids=["status_field_id"]   # Optional: fields needing label resolution
)

# Apply to query
find = ListFilter()
if config.pre_filter:
    find.pre_filters = config.pre_filter
find.reference_fields = AggregationStage(pipeline=config.pipeline)

# Get records
response = await repository.get_all(find, collection_name)

# Add file URLs (post-processing)
response = await enricher.process_file_fields(config.file_field_ids, response)

File Operations - EntityRecordBlobHandler

File upload/download operations for entity records:

from abs_pipelines_core import EntityRecordBlobHandler

# Initialize with blob repository
blob_handler = EntityRecordBlobHandler(blob_repository)

# Upload single file
result = await blob_handler.upload_record_field_file(entity_id, field_id, file)
# Returns: {field_id: file_id}

# Upload multiple files (filename format: {field_id}_actualfilename)
results = await blob_handler.upload_record_field_files(entity_id, files)
# Returns: [{field_id: file_id}, ...]

# Get file URL
url = await blob_handler.get_record_field_file(file_id)

# Get multiple file URLs
urls = await blob_handler.get_record_field_files(entity_id, file_ids)
# Returns: [{file_id: url}, ...]

# Delete file
await blob_handler.delete_record_field_file(file_id)

# Delete field folder
await blob_handler.delete_record_field_folder(entity_id, field_id)

# Delete entity folder
await blob_handler.delete_record_folder(entity_id)

Storage Path Convention

Files are stored with this path structure:

  • entity-{entity_id}/field-{field_id}/{file_id}

Fields with Associations Pipeline

Use build_fields_with_associations_pipeline() to fetch fields with their associated definitions populated:

from abs_pipelines_core import build_fields_with_associations_pipeline

# Build the pipeline
pipeline = build_fields_with_associations_pipeline(user_collection_name="users_documents")

# Add a match stage and run
full_pipeline = [{"$match": {"entity_id": entity_id}}, *pipeline]
fields = await db.fields.aggregate(full_pipeline).to_list(1000)

# Result for association field:
# {
#     "_id": "field_123",
#     "type": "association",
#     "reference": {
#         "entity_id": "entity_456",
#         "entity_fields": [  # <-- Populated!
#             {"_id": "...", "name": "Name", "type": "text", ...},
#         ]
#     }
# }

# Result for user field:
# {
#     "_id": "field_789",
#     "type": "user",
#     "user_filter": {
#         "is_active": true,
#         "users": [  # <-- Populated!
#             {"_id": "...", "name": "John Doe", ...},
#         ]
#     }
# }

EnrichmentConfig

The prepare_enrichment() method returns an EnrichmentConfig with:

PropertyTypeDescription
pipelineList[Dict]Combined $lookup and $addFields aggregation stages
pre_filterOptional[Dict]Filter schema for record_ids (use with find.pre_filters)
file_field_idsList[str]Field IDs for file URL processing

Individual Pipeline Methods

build_lookup_pipeline(fields)

Build $lookup stages for association and user fields:

lookup_pipeline = enricher.build_lookup_pipeline(fields)

build_option_label_pipeline(field_id, value_to_label, is_multi_select)

Build $addFields stage for option label resolution:

value_to_label = {"uuid-1": "Active", "uuid-2": "Inactive"}
option_pipeline = enricher.build_option_label_pipeline(
    field_id="status",
    value_to_label=value_to_label,
    is_multi_select=False
)

process_file_fields(file_fields, response, expiry_minutes)

Attach file URLs to records (async, post-processing):

response = await enricher.process_file_fields(
    file_fields=["file_field_id"],
    response=response,
    expiry_minutes=5
)

Package Structure

abs_pipelines_core/
├── __init__.py          # Public API exports
├── record_enricher.py   # RecordEnricher, schemas, and protocols
├── blob_handler.py      # EntityRecordBlobHandler for file operations
└── fields_pipeline.py   # build_fields_with_associations_pipeline

Exports

from abs_pipelines_core import (
    # Record enrichment
    RecordEnricher,                          # Aggregation pipeline builder
    EnrichmentConfig,                        # Return type for prepare_enrichment()
    FieldConfig,                             # Schema for field configurations
    FieldReference,                          # Schema for association references
    OptionConfig,                            # Schema for select options
    BlobStorageProtocol,                     # Protocol for blob service (get_file_url)

    # Blob/file operations
    EntityRecordBlobHandler,                 # File operations handler
    RequestData,                             # Request data for file uploads
    BlobRepositoryProtocol,                  # Protocol for full blob repository

    # Fields pipeline
    build_fields_with_associations_pipeline, # Fields with associations aggregation
)

Requirements

  • Python 3.11+
  • motor >= 3.6.0
  • pymongo >= 4.10.0
  • pydantic >= 2.10.0

Downloads & popularity

6downloads
1-day window · source-reported counts20 Oct 2026
38190
2026-07-23: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-07-23–2026-07-232026-07-24: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-07-24–2026-07-242026-07-27: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-07-27–2026-07-272026-07-29: 10 · observed 2026-10-21T12:50:58.2397674Z · period 2026-07-29–2026-07-292026-07-30: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-07-30–2026-07-302026-07-31: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-07-31–2026-07-312026-08-01: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-01–2026-08-012026-08-02: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-02–2026-08-022026-08-03: 10 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-03–2026-08-032026-08-04: 5 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-04–2026-08-042026-08-06: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-06–2026-08-062026-08-07: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-07–2026-08-072026-08-09: 5 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-09–2026-08-092026-08-10: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-10–2026-08-102026-08-11: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-11–2026-08-112026-08-13: 3 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-13–2026-08-132026-08-14: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-14–2026-08-142026-08-17: 6 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-17–2026-08-172026-08-18: 38 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-18–2026-08-182026-08-19: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-19–2026-08-192026-08-20: 3 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-20–2026-08-202026-08-21: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-21–2026-08-212026-08-23: 5 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-23–2026-08-232026-08-24: 20 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-24–2026-08-242026-08-25: 3 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-25–2026-08-252026-08-26: 12 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-26–2026-08-262026-08-27: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-27–2026-08-272026-08-28: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-28–2026-08-282026-08-31: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-08-31–2026-08-312026-09-01: 6 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-01–2026-09-012026-09-03: 5 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-03–2026-09-032026-09-04: 12 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-04–2026-09-042026-09-05: 3 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-05–2026-09-052026-09-06: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-06–2026-09-062026-09-07: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-07–2026-09-072026-09-08: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-08–2026-09-082026-09-09: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-09–2026-09-092026-09-10: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-10–2026-09-102026-09-11: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-11–2026-09-112026-09-12: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-12–2026-09-122026-09-13: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-13–2026-09-132026-09-18: 4 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-18–2026-09-182026-09-20: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-20–2026-09-202026-09-23: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-23–2026-09-232026-09-24: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-24–2026-09-242026-09-25: 16 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-25–2026-09-252026-09-26: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-26–2026-09-262026-09-27: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-27–2026-09-272026-09-28: 3 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-28–2026-09-282026-09-29: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-29–2026-09-292026-09-30: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-09-30–2026-09-302026-10-01: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-01–2026-10-012026-10-03: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-03–2026-10-032026-10-05: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-05–2026-10-052026-10-06: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-06–2026-10-062026-10-07: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-07–2026-10-072026-10-08: 13 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-08–2026-10-082026-10-09: 5 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-09–2026-10-092026-10-11: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-11–2026-10-112026-10-12: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-12–2026-10-122026-10-13: 5 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-13–2026-10-132026-10-14: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-14–2026-10-142026-10-15: 2 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-15–2026-10-152026-10-16: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-16–2026-10-162026-10-18: 1 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-18–2026-10-182026-10-19: 9 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-19–2026-10-192026-10-20: 6 · observed 2026-10-21T12:50:58.2397674Z · period 2026-10-20–2026-10-20
23 Jul20 Oct

pypistats · 67 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-20 – 2026-10-2062026-10-21T12:50:58.2397674Z
2026-10-19 – 2026-10-1992026-10-21T12:50:58.2397674Z
2026-10-18 – 2026-10-1812026-10-21T12:50:58.2397674Z
2026-10-16 – 2026-10-1612026-10-21T12:50:58.2397674Z
2026-10-15 – 2026-10-1522026-10-21T12:50:58.2397674Z
2026-10-14 – 2026-10-1412026-10-21T12:50:58.2397674Z
2026-10-13 – 2026-10-1352026-10-21T12:50:58.2397674Z
2026-10-12 – 2026-10-1212026-10-21T12:50:58.2397674Z
2026-10-11 – 2026-10-1122026-10-21T12:50:58.2397674Z
2026-10-09 – 2026-10-0952026-10-21T12:50:58.2397674Z
2026-10-08 – 2026-10-08132026-10-21T12:50:58.2397674Z
2026-10-07 – 2026-10-0712026-10-21T12:50:58.2397674Z
2026-10-06 – 2026-10-0612026-10-21T12:50:58.2397674Z
2026-10-05 – 2026-10-0512026-10-21T12:50:58.2397674Z
2026-10-03 – 2026-10-0312026-10-21T12:50:58.2397674Z
2026-10-01 – 2026-10-0112026-10-21T12:50:58.2397674Z
2026-09-30 – 2026-09-3022026-10-21T12:50:58.2397674Z
2026-09-29 – 2026-09-2922026-10-21T12:50:58.2397674Z
2026-09-28 – 2026-09-2832026-10-21T12:50:58.2397674Z
2026-09-27 – 2026-09-2712026-10-21T12:50:58.2397674Z
2026-09-26 – 2026-09-2622026-10-21T12:50:58.2397674Z
2026-09-25 – 2026-09-25162026-10-21T12:50:58.2397674Z
2026-09-24 – 2026-09-2412026-10-21T12:50:58.2397674Z
2026-09-23 – 2026-09-2322026-10-21T12:50:58.2397674Z
2026-09-20 – 2026-09-2012026-10-21T12:50:58.2397674Z
2026-09-18 – 2026-09-1842026-10-21T12:50:58.2397674Z
2026-09-13 – 2026-09-1312026-10-21T12:50:58.2397674Z
2026-09-12 – 2026-09-1222026-10-21T12:50:58.2397674Z
2026-09-11 – 2026-09-1142026-10-21T12:50:58.2397674Z
2026-09-10 – 2026-09-1012026-10-21T12:50:58.2397674Z
2026-09-09 – 2026-09-0912026-10-21T12:50:58.2397674Z
2026-09-08 – 2026-09-0812026-10-21T12:50:58.2397674Z
2026-09-07 – 2026-09-0722026-10-21T12:50:58.2397674Z
2026-09-06 – 2026-09-0642026-10-21T12:50:58.2397674Z
2026-09-05 – 2026-09-0532026-10-21T12:50:58.2397674Z
2026-09-04 – 2026-09-04122026-10-21T12:50:58.2397674Z
2026-09-03 – 2026-09-0352026-10-21T12:50:58.2397674Z
2026-09-01 – 2026-09-0162026-10-21T12:50:58.2397674Z
2026-08-31 – 2026-08-3122026-10-21T12:50:58.2397674Z
2026-08-28 – 2026-08-2812026-10-21T12:50:58.2397674Z
2026-08-27 – 2026-08-2722026-10-21T12:50:58.2397674Z
2026-08-26 – 2026-08-26122026-10-21T12:50:58.2397674Z
2026-08-25 – 2026-08-2532026-10-21T12:50:58.2397674Z
2026-08-24 – 2026-08-24202026-10-21T12:50:58.2397674Z
2026-08-23 – 2026-08-2352026-10-21T12:50:58.2397674Z
2026-08-21 – 2026-08-2112026-10-21T12:50:58.2397674Z
2026-08-20 – 2026-08-2032026-10-21T12:50:58.2397674Z
2026-08-19 – 2026-08-1922026-10-21T12:50:58.2397674Z
2026-08-18 – 2026-08-18382026-10-21T12:50:58.2397674Z
2026-08-17 – 2026-08-1762026-10-21T12:50:58.2397674Z
2026-08-14 – 2026-08-1442026-10-21T12:50:58.2397674Z
2026-08-13 – 2026-08-1332026-10-21T12:50:58.2397674Z
2026-08-11 – 2026-08-1142026-10-21T12:50:58.2397674Z
2026-08-10 – 2026-08-1022026-10-21T12:50:58.2397674Z
2026-08-09 – 2026-08-0952026-10-21T12:50:58.2397674Z
2026-08-07 – 2026-08-0742026-10-21T12:50:58.2397674Z
2026-08-06 – 2026-08-0612026-10-21T12:50:58.2397674Z
2026-08-04 – 2026-08-0452026-10-21T12:50:58.2397674Z
2026-08-03 – 2026-08-03102026-10-21T12:50:58.2397674Z
2026-08-02 – 2026-08-0212026-10-21T12:50:58.2397674Z
2026-08-01 – 2026-08-0112026-10-21T12:50:58.2397674Z
2026-07-31 – 2026-07-3112026-10-21T12:50:58.2397674Z
2026-07-30 – 2026-07-3012026-10-21T12:50:58.2397674Z
2026-07-29 – 2026-07-29102026-10-21T12:50:58.2397674Z
2026-07-27 – 2026-07-2722026-10-21T12:50:58.2397674Z
2026-07-24 – 2026-07-2412026-10-21T12:50:58.2397674Z
2026-07-23 – 2026-07-2342026-10-21T12:50:58.2397674Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.128 Jan 20263

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:38 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:297a4338dd146ef947b583515ffbad50386740c8ca3de7e59f10dca8928db9c4