Skip to content
cccskills
FreePublished on GitHub

qdrant-anomaly-detection

Detect anomalies in procurement data using Qdrant vector operations. Covers centroid-based outlier detection, near-duplicate finding via batch recommend, amount z-score analysis, and vendor variance scoring. Use when building anomaly detection, fraud detection, or data quality features.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md3.4 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Qdrant Anomaly Detection Patterns

Patterns for detecting anomalies, duplicates, and outliers using Qdrant's vector operations.

Centroid-Based Outlier Detection

Extract all vectors, compute centroid, flag distant points:

import numpy as np

# Get all vectors via scroll
records, _ = client.scroll(
    collection_name="DocumentChunk_text",
    limit=100,
    with_vectors=True,
    with_payload=True,
)

vectors = np.array([r.vector for r in records])
centroid = vectors.mean(axis=0)

# Cosine distance from centroid
from numpy.linalg import norm
distances = [1 - np.dot(v, centroid) / (norm(v) * norm(centroid)) for v in vectors]

# Z-score flagging
mean_dist = np.mean(distances)
std_dist = np.std(distances)
outliers = [
    (records[i], distances[i])
    for i in range(len(records))
    if (distances[i] - mean_dist) / std_dist > 2.0
]

Near-Duplicate Detection via Batch Recommend

Find duplicates using batch queries with BEST_SCORE:

# Build batch recommend requests for each point
requests = [
    models.QueryRequest(
        query=models.RecommendInput(positive=[record.id]),
        limit=5,
        score_threshold=0.99,  # near-duplicate threshold
    )
    for record in records[:50]  # batch of 50
]

results = client.query_batch_points(
    collection_name="DocumentChunk_text",
    requests=requests,
)

duplicates = []
for i, batch_result in enumerate(results):
    for hit in batch_result.points:
        if hit.id != records[i].id and hit.score > 0.99:
            duplicates.append((records[i].id, hit.id, hit.score))

Amount Outlier Detection (Z-Score)

Flag transactions with unusually high or low amounts:

amounts = [float(r.payload.get("amount", 0)) for r in records]
mean_amt = np.mean(amounts)
std_amt = np.std(amounts)

amount_outliers = [
    (records[i], amounts[i])
    for i in range(len(records))
    if abs(amounts[i] - mean_amt) / std_amt > 2.5
]

Vendor Variance Scoring

Flag vendors with inconsistent pricing:

from collections import defaultdict

vendor_amounts = defaultdict(list)
for r in records:
    vendor = r.payload.get("vendor_name", "Unknown")
    amount = float(r.payload.get("amount", 0))
    vendor_amounts[vendor].append(amount)

high_variance_vendors = [
    (vendor, np.std(amounts) / np.mean(amounts))  # coefficient of variation
    for vendor, amounts in vendor_amounts.items()
    if len(amounts) > 2 and np.mean(amounts) > 0
    and np.std(amounts) / np.mean(amounts) > 0.8
]

Investigate a Flagged Point

Use recommend to find similar records to a flagged anomaly:

similar = client.recommend(
    collection_name="DocumentChunk_text",
    positive=[flagged_point_id],
    limit=10,
    strategy=models.RecommendStrategy.BEST_SCORE,
    with_payload=True,
)

Decision Table

Anomaly TypeMethodThreshold
Embedding outlierCosine distance from centroidz-score > 2.0
Amount outlierAmount z-scorez-score > 2.5
Near-duplicateBatch recommend similarityscore > 0.99
Vendor inconsistencyCoefficient of variationCV > 0.8

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Use at a cognee hackathon. Watches the participant's experience with cognee throughout the session — errors, slowness, confusion, workarounds, and signs of frustration in how they work with you — and keeps one private feedback file they send to the cognee team at the end.

The English summary is being prepared. Showing the original description.

topoteretes/cognee-hackathons11Updated Oct 18, 2026

Use at the Mem Off hackathon. Keeps a running, evidence-backed report on how the participant's memory system performed for their coding agent during the day — what the harness measured, what cognee-report's scorecard says, what was recalled and whether it helped — in ./memoff-report.md and ./memoff-report.json. The report is submitted together with the action results; it never contains quotes, keys, data or names.

The English summary is being prepared. Showing the original description.

topoteretes/cognee-hackathons11Updated Oct 18, 2026

Use when reviewing, fixing, or verifying a pull request. Focus on correctness regressions, missing tests, permission mistakes, unsafe behavior, and minimal fixes.

The English summary is being prepared. Showing the original description.

topoteretes/cognee-hackathons11Updated Oct 18, 2026

Build spend analytics and dashboards from Qdrant vector data. Covers bulk scroll extraction, aggregation patterns, vendor grouping, and Chart.js visualization. Use when building analytics features, aggregating procurement data, or creating dashboards.

The English summary is being prepared. Showing the original description.

topoteretes/cognee-hackathons11Updated Oct 18, 2026

Semantic search over Qdrant Cloud collections using the Python client. Covers vector search, filtered search, prefetch+RRF fusion, group API, recommend API, discovery API, batch queries, scroll, and payload indexing. Use when building search features, adding new query types, or working with qdrant-client.

The English summary is being prepared. Showing the original description.

topoteretes/cognee-hackathons11Updated Oct 18, 2026

See all skills by topoteretes

Report a problem with this skill