iOS app that transforms scientific posters into structured summaries, interactive chat, and validated research citations — using a 4-stage multi-API pipeline.
How a poster photo becomes an interactive research assistant — ~$0.0075 per scan
Cloud Functions backend with BigQuery vector search + Vertex AI embeddings for enhanced paper discovery. Deployed on GCP (europe-west2).
iOS app (Swift/SwiftUI) + GCP Cloud Functions (Python)
11 services powering the multi-API pipeline — singletons with retry logic and caching
On-device text extraction using Apple Vision framework. Handles image orientation, preprocessing, and recognition confidence. No API key, no network — pure on-device ML.
GPT-3.5-turbo integration for structured summarization (4-point format), author question generation, and category extraction. Temperature 0.3 for factual responses.
Core Perplexity API client (sonar model). Powers chat, summarization, and author question generation. Singleton with context caching per poster ID.
Perplexity Search API with search_domain_filter restricting to 14 trusted academic domains. Returns real citations with URLs, validated against PubMed.
NCBI E-Utilities client — esearch, esummary, efetch. Validates Perplexity citations by extracting PMIDs, fetching metadata, comparing title similarity (>70% match).
Cloud Functions client for the Evidence V2 endpoint. BigQuery vector search + Vertex AI embeddings with deterministic re-ranking (recency, keyword overlap, specificity).
Conversation management with per-poster context caching. Routes to Perplexity for context-aware Q&A with conversation history.
Extracts research categories from poster text via OpenAI. Colour-coded: Cancer Types (red), Research Focus (purple), Phases (green), Treatment (blue).
Generates A4 PDFs with poster image, structured summary, citations, and categories using UIGraphicsPDFRenderer.
Fixes image orientation by actually rotating pixel data (not just EXIF metadata) via CoreImage transforms.
Centralised error handling: 3 retries with exponential backoff (1s, 2s, 4s), safe JSON parsing, user-friendly error messages for all API failures.
Perplexity Search API restricted to 14 trusted sources — the key innovation that made it into the Cookbook
23 SwiftUI views — 8,146 lines total
Core entities — 1,594 lines across 12 models
Rate limits, models, and error handling across all integrations
GCP Cloud Functions + BigQuery + Vertex AI for enhanced evidence retrieval
evidenceV2 Cloud Function endpoint. Takes poster text, generates embeddings via Vertex AI (text-embedding-004), runs vector similarity search against BigQuery pubmed_rag.papers table, then applies a deterministic re-ranking layer:
Two-stage data pipeline for populating the BigQuery vector store: