Selected AI Work

Strategy Sync AI

RAG · Semantic search · Knowledge graph

MSc Data Science · Information Retrieval coursework · Coventry University

The Intelligent Strategic Plan Synchronization System (ISPS): it measures how well an organisation's day-to-day action plan lines up with its long-term strategy, shows exactly which actions support which goals, and explains how to close the gaps.

A strategic plan and an action plan linked by glowing semantic threads through a vector-database cube, with a knowledge graph above and one gap highlighted in amber
Role
AI / IR Engineer
Year
2026
Focus
RAG
Stack
9 technologies
  • Sentence-Transformers
  • ChromaDB
  • RAG
  • OpenAI
  • rdflib · SPARQL
  • Streamlit
  • Plotly
  • pypdf
  • Pydantic
  • 0.90

    Macro Precision@5 vs ground truth

  • 1.00

    Macro Recall@5: every relevant action found

  • 0.88

    Mean NDCG@5 (MAP 0.84)

  • 384-d

    MiniLM sentence embeddings in ChromaDB

  • 3 tiers

    Strong ≥ 0.75 · Medium ≥ 0.55 · Weak

  • 6

    Dashboard tabs, live on Hugging Face

The Streamlit dashboard

Screens from the deployed app on the sample AutoBridge strategic and action plans, as submitted in the coursework report · tap to enlarge

Overview: score & coverage gauges
Label distribution & owner workload
Top-match similarity heatmap
Strategy Explorer: ranked matches
Knowledge graph stats
Evaluation: P@K, R@K, AP, NDCG
RAG improvement recommendations
Data export

Strategic plans describe long-term goals in abstract language. Action plans list short-term tasks in operational language. The two are written separately, so nobody can easily prove that daily work serves the strategy. Manual reviews are slow, subjective, and don't scale to documents hundreds of pages long, and keyword matching fails because the same intent is written in different words.

Strategy Sync treats alignment as a retrieval problem. Each strategic objective and each action item becomes one semantic unit: its title, description, and KPIs (or outputs) joined into a single clean sentence. A Sentence-Transformers model (all-MiniLM-L6-v2) turns every unit into a 384-dimensional normalised vector. Actions are indexed once in a persistent ChromaDB collection, and every strategy becomes a query that retrieves its top-K most similar actions by cosine similarity.

Similarities become decisions through fixed, explainable rules. A strategy's score is the mean of its top-3 matches, labelled Strong (≥ 0.75), Medium (≥ 0.55), or Weak. The overall synchronisation score is the mean across strategies on a 0–100 scale, and coverage is the share of strategies backed by at least two Strong actions. Anything without enough support is flagged as a gap.

Gaps feed the RAG step. For each strategy, the objective, its score, and only its top-K retrieved actions go into a structured prompt (SYSTEM, CONTEXT, INSTRUCTIONS, RESPONSE_FORMAT). The LLM returns strict JSON: an explanation of the score, three new actions, two KPIs, an owner and timeline, and risks. If there's no API key or the call fails, a deterministic rule-based template answers instead, so every run still completes and stays reproducible.

Alongside the scores, the top-K links are written to an RDF knowledge graph (rdflib) and queried with SPARQL for actions per strategy, unsupported strategies, and owner workload. Retrieval is evaluated against a ground-truth map with Precision@K, Recall@K, average precision, and NDCG. Everything appears in a Streamlit dashboard, hosted on Hugging Face Spaces, with JSON, CSV, and Turtle exports. Plans can be uploaded as JSON or as PDFs, which are converted to structured JSON first.

System architecture

A layered, pipeline design. Each layer is one module in the repo, so it can be tested on its own, and the same pipeline runs behind the dashboard and the CLI. Each layer links to its code.

  • Channels
  • AI agents
  • Data & infra
  • Service
  1. Ingestion

    src/pdf_to_json.py · src/models.py
    PDF → JSON code
    • Strategic plan

      JSON array of objectives: id, title, description, KPIs, priority

    • Action plan

      JSON array of tasks: id, title, description, owner, start and end dates, outputs

    • PDF → JSON

      pypdf extracts the text, then an LLM in JSON mode (temperature 0) structures it. Regex heuristics take over without an API key.

    • Pydantic validation

      StrategicObjective and ActionTask models check every record before it enters the pipeline

    typed StrategicObjective[] + ActionTask[]
  2. Processing

    src/text_utils.py · sentence-transformers
    Preprocessing code
    • strategy_to_text()

      title | description | KPIs, joined into one sentence, whitespace collapsed

    • action_to_text()

      title | description | outputs, the same deterministic template

    • all-MiniLM-L6-v2

      384-dimensional embeddings, L2-normalised so cosine similarity is a dot product. Swappable via EMBEDDING_MODEL.

    upsert action vectors · query with strategy vectors
  3. Storage & retrieval

    src/vector_store.py · ChromaDB 0.5
    Vector store code
    • Persistent collection

      "actions" with an HNSW index in cosine space, stored in chroma_db/

    • Upsert by id

      Re-runs update records instead of duplicating them. Owner and dates travel as metadata.

    • Top-K query

      Returns the K nearest actions with similarity = 1 − cosine distance

    • Resilient start-up

      Telemetry off. Falls back to a local client if the sqlite store is read-only (as on hosted Spaces).

    matches + similarities per strategy
  4. Alignment & insight

    src/alignment.py · rag_engine.py · ontology.py · evaluation.py
    Engine code
    • AlignmentEngine

      Top-3 mean per strategy, three-tier label, overall score (0–100) and coverage

    • RAGEngine

      Grounded prompt → OpenAI (gpt-4o-mini by default) → strict JSON, with a rule-based fallback

    • Knowledge graph

      ss:Strategy –hasAction→ ss:ActionTask in RDF, saved as Turtle and queried with SPARQL

    • Evaluation

      Precision@K, Recall@K, AP and NDCG against a ground-truth strategy → action map

    final report JSON
  5. Presentation

    app/streamlit_app.py · src/viz.py · main.py
    Dashboard code
    • Streamlit dashboard

      Overview, Strategy Explorer, Graph, Evaluation, RAG Suggestions, and Data Export tabs

    • Plotly charts

      Score and coverage gauges, per-strategy bars, label pie, similarity heatmap, owner workload

    • CLI

      python main.py full-run strategic.json action.json --ground_truth_path … --top_k 5

    • Hugging Face Space

      Streamlit SDK hosting over HTTPS. The OpenAI key is a Space secret, never in the code.

Pipeline

  1. 01

    Ingest

    JSON / PDF

    Strategic and action plans are loaded and validated. PDFs are converted to structured JSON first.

  2. 02

    Preprocess

    text_utils

    Title, description, and KPIs or outputs become one clean, deterministic sentence per item.

  3. 03

    Embed

    all-MiniLM-L6-v2

    Sentence-Transformers turns each sentence into a normalised 384-d vector.

  4. 04

    Index

    ChromaDB

    Action vectors and metadata are upserted into a persistent cosine-space collection.

  5. 05

    Retrieve

    top-K

    Each strategy vector queries the store for its K most similar actions.

  6. 06

    Score

    Mean of the top-3 similarities, labelled Strong (≥ 0.75), Medium (≥ 0.55), or Weak. Overall score and coverage follow.

  7. 07

    Recommend

    RAG

    Strategy, score, and retrieved actions go into a structured prompt. JSON suggestions come back, or the deterministic fallback runs.

  8. 08

    Graph

    rdflib · SPARQL

    Matches become RDF triples, saved as Turtle, and queried for explainability stats.

  9. 09

    Evaluate

    P@K · R@K · NDCG

    Optional: rankings are compared against a ground-truth strategy → action map.

  10. 10

    Visualise

    Streamlit

    Six-tab dashboard with charts, tables, recommendations, and downloadable reports.

Development phases

Built incrementally, one testable phase at a time, from data preparation to end-to-end validation.

  1. 01

    Requirements & data

    Phase 1

    Scoped the system, chose the two input documents, and fixed one JSON schema for strategies and actions.

  2. 02

    Preprocessing

    Phase 2

    Cleaned and normalised text so formatting noise doesn't distort embeddings.

  3. 03

    Embeddings

    Phase 3

    Generated a vector per item and kept its id and source type for traceability.

  4. 04

    Vector storage

    Phase 4

    Indexed embeddings in ChromaDB for fast cosine search that scales with plan size.

  5. 05

    Top-K matching

    Phase 5

    Retrieved the most similar actions for each objective and recorded the scores.

  6. 06

    Scoring & coverage

    Phase 6

    Turned scores into Strong, Medium, and Weak labels and flagged coverage gaps.

  7. 07

    RAG recommendations

    Phase 7

    Injected retrieved actions into the prompt to generate grounded improvement suggestions.

  8. 08

    Dashboard

    Phase 8

    Built the interactive Streamlit and Plotly interface for technical and non-technical users.

  9. 09

    End-to-end validation

    Phase 9

    Ran test data through the whole pipeline to confirm consistent scores, correct gaps, and relevant suggestions.

Five diagrams drawn from the code and the coursework report: the system, one strategy traced through retrieval and generation, the data model, how scores turn into decisions, and the knowledge graph. Tap any diagram to zoom.

  1. Fig. 01 · Architecture diagram

    System architecture

    Data flows left to right through five layers. Actions are embedded and stored once; strategies are embedded and used as queries. Four modules consume the ranked matches (scoring, RAG, graph, and evaluation), and they all feed the same dashboard and report.

    • PDFs are an optional entry point: they're converted to the same JSON schema as direct uploads
    • The LLM is used in only two places (PDF structuring and recommendations), and both have a non-LLM fallback
    • The same pipeline (src/pipeline.py run_full_flow) runs behind the Streamlit app and the CLI
  2. Fig. 02 · UML sequence diagram

    One strategic objective, end to end

    The RAG flow for a single objective. Retrieval happens first, and only the strategy and its top-K actions (never the full documents) reach the language model. That keeps answers grounded in real plan items and limits how much company data leaves the system.

    • Steps 1–4: retrieval and scoring are fully deterministic. Same input, same scores, every run
    • The prompt has fixed sections and asks for strict JSON, so the output can be parsed and rendered reliably
    • Step 8: if parsing fails or there's no API key, the rule-based template answers, matched to the Weak, Medium or Strong label
  3. Fig. 03 · Data model

    Data model: from JSON record to ranked match

    Which fields are embedded and which ride along as metadata. Title, description, and KPIs or outputs carry the meaning. Owner and dates aren't embedded but are stored with each vector, so every match can name who owns the action and when it runs.

    • Each statement is its own unit, so alignment is measured per objective and per action, not per document
    • Upserting by id keeps the index consistent when the same plan is analysed again
  4. Fig. 04 · Scoring logic

    From similarity to a decision

    The real numbers from the sample run in the report. S1 averages 0.586 over its top three actions (Medium). S2 averages 0.529 (Weak). Together they give an overall synchronisation score of 55.7, and because neither has two Strong actions, coverage is 0%: both are flagged for the recommendation step.

    • Averaging the top three, not just the best match, rewards strategies that several actions support
    • Thresholds were chosen by looking at the observed similarity distribution, and they're configurable
  5. Fig. 05 · Ontology · RDF

    Knowledge graph: alignment as RDF

    The top-K matches become triples in a small ontology (ss:Strategy, ss:ActionTask, ss:hasAction, ss:ownedBy, ss:startDate, ss:endDate). SPARQL then answers the questions a manager asks: what backs each goal, what has nothing behind it, and who carries the work.

    • Saved as outputs/strategy_graph.ttl, so it opens in Protégé or any triple store
    • A base to extend with dependencies, risks, and strategy hierarchies (broader) in future work
  6. Fig. 06 · Phase 1 · Data preparation

    Input: a strategic plan as JSON

    Each objective has a unique id, a title, a description, measurable KPIs, and a priority. The sample is a logistics company (AutoBridge): reduce landed-cost variance, speed up customs clearance, and unify cost tools with anomaly detection.

  7. Fig. 07 · Phase 1 · Data preparation

    Input: an action plan as JSON

    Action items carry an owner (Finance Ops, Data Engineering, Operations), a start and end date, and concrete outputs. The wording deliberately differs from the strategy text, which is exactly where keyword matching breaks and embeddings don't.

  8. Fig. 08 · Reproducibility

    Every report records its configuration

    The final report stores a timestamp, top-K, the embedding model, and the thresholds used, so any result can be traced and re-run exactly.

Retrieval & NLP

Sentence-Transformers
all-MiniLM-L6-v2 embeddings for strategies and actions
ChromaDB
Persistent vector store with HNSW cosine search
NumPy · scikit-learn
Vector handling and similarity utilities

Generation

OpenAI API
gpt-4o-mini for recommendations; JSON mode for PDF structuring
pypdf
Text extraction from uploaded PDF plans

Knowledge & evaluation

rdflib
RDF graph construction, Turtle serialisation, and SPARQL queries
Custom IR metrics
Precision@K, Recall@K, average precision, and NDCG@K

App & delivery

Streamlit
Six-tab dashboard with uploads, a top-K slider, and an LLM toggle
Plotly
Gauges, bars, pie, heatmap, and workload charts
Pydantic · pandas
Typed input models, tables, and CSV export
pytest
Smoke tests for alignment, RAG, and the full pipeline
Hugging Face Spaces
Public hosting, with secrets in environment variables

Retrieval quality vs ground truth

Top-K = 5, macro-averaged over the strategies in the sample run

  • Recall@51.00
  • Precision@50.90
  • NDCG@50.88
  • MAP0.84

Ranking quality per strategy

S1 ranks every relevant action first; S2 finds them all but ranks some lower

  • S1 · AP1.00
  • S1 · NDCG@51.00
  • S2 · AP0.68
  • S2 · NDCG@50.76

Alignment score per strategy

Mean cosine similarity of the top-3 matches. Medium starts at 0.55, Strong at 0.75

  • S1 · AutoBridge strategic plan (Medium)0.586
  • S2 · Platform coverage & availability (Weak)0.529

S1: top-5 retrieved actions

Cosine similarity of each match, as ranked by ChromaDB

  • A20.608
  • A10.580
  • A70.569
  • A50.472
  • AT-001 · Finance Ops0.462
  • Overall synchronisation score (0–100) and coverage gauges, with per-strategy breakdowns that flag weak or unsupported goals
  • Semantic matching that links actions to strategies even when they share no keywords
  • Top-K slider (1–10) and an optional LLM toggle in the sidebar, plus upload of JSON or PDF plans and a ground-truth file
  • RAG recommendations per strategy: an explanation, three new actions, two KPIs, an owner and timeline, and risks
  • RDF knowledge graph with SPARQL stats for actions per strategy, zero-action strategies, and owner workload
  • Built-in IR evaluation (Precision@K, Recall@K, AP, NDCG) when a ground-truth map is supplied
  • One-click downloads: converted JSON, final report JSON, strategies CSV, matches CSV, and the Turtle graph
  • Deterministic by default: no API key needed, and the same input always gives the same scores
  • Strategies with clear, well-documented actions scored high. Abstract, high-level strategies scored lower, which is itself a useful signal that the strategy needs sharper wording or more concrete actions.
  • Coverage analysis showed most goals had some support, but a clear group lacked strong action coverage: strategic blind spots that are hard to find by hand.
  • Manual review of strategy–action pairs confirmed that high-similarity matches were genuine support relationships. Low scores usually traced back to vague strategy text or overly general actions.
  • RAG recommendations stayed tied to the retrieved actions, so they read as specific, practical next steps rather than generic AI advice.
  • Cosine similarity is the core metric: it measures the angle between embedding vectors and is standard in information retrieval.
  • A ground-truth file maps each strategy to the actions that truly support it. Retrieved rankings are scored with Precision@K, Recall@K, average precision, and NDCG@K (binary relevance).
  • The similarity summary compares the mean similarity of all retrieved actions with that of the relevant ones, to check that relevant actions really do score higher.
  • Stability: repeated runs on the same input give identical scores and labels, which pytest smoke tests check for alignment, RAG, and the full pipeline.
  • Only the top-K retrieved actions and the strategy text are sent to the LLM, never whole documents, which keeps data exposure to a minimum.
  • Prompts have fixed sections and a strict response format, which limits prompt injection and instruction overrides from document content.
  • API keys live in environment variables (Space secrets), never in the repository. Similarity, thresholds, and evaluation logic run server-side and can't be changed from the client.
  • Graceful degradation: if the LLM is unavailable, scores, coverage, the graph, and evaluation still work, and only the generated suggestions fall back to templates.
  • Deployed on Hugging Face Spaces over HTTPS, with configuration, data, and application logic kept separate.
  • Results depend on input quality: vague strategies or overly general actions lower alignment accuracy.
  • Thresholds were tuned on the observed data and may need adjusting for other industries or writing styles.
  • The system measures semantic similarity. It doesn't yet model causal or temporal links between actions and outcomes.
  • The reported evaluation uses a small sample dataset, so the metrics show the method works rather than how it performs at scale.
  • 01Applied retrieval-augmented generation to strategic management, an area usually handled by manual review
  • 02A deterministic, explainable alignment score with transparent thresholds and coverage, suited to academic and real-world audit
  • 03Recommendations grounded in retrieved action-plan context, which reduces hallucination and makes the advice traceable
  • 04An end-to-end, deployable tool: PDF or JSON in, scores, graph, evaluation, and recommendations out
  • A formal ontology or knowledge graph of strategic concepts, roles, and dependencies, for impact and cross-department analysis
  • KPI-weighted scoring that links alignment to measurable performance outcomes
  • Adaptive thresholds learned from user feedback, and multilingual document support
  • A multi-user platform with authentication, audit logs, role-based dashboards, and integration with project-management tools