Clinics on Rails (Brighton Ruby 2026)

Alex Watt
June 25, 2026
50

Clinics on Rails (Brighton RubyΒ 2026)

Alex Watt

June 25, 2026

Annual Pro sale Β· Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

48 slides
  1. Benefits of clinical data β€’ Set volunteer expectations β€’ Plan

    for pharmacy β€’ Understand community health over time
  2. BackpackEMR βœ… Designed for mobile medical clinics
 ❌ PII stored

    outside of Ethiopia, could not host in country, limited reporting
  3. Google Sheet βœ… Free, ubiquitous, simple
 ❌ Relational data, limited

    data validation, more difficult integrations, permissions
  4. Built in a week (January 2025) Monday rails new Tuesday

    Finished data models Wednesday Deployed with Hatchbox Thursday User policies & launch Friday Addressed feedback
  5. Project Impact β€’ Volunteers can help with medical data β€’

    Medical teams see their impact β€’ Future teams are better prepared
  6. Simple Hybrid Search + semantic fuzzy match Query: fizzy sparkling

    water soda frizzy hair Fizzy’s Diner
  7. Embeddings for diagnoses diagnoses_with_embeddings = Diagnosis.all.map do |diagnosis| text =

    "#{diagnosis.name} (e.g., #{diagnosis.examples})" embedding = embedding(text) { diagnosis: diagnosis, embedding: embedding } end
  8. Query embedding QUERY_PREFIX = "Represent this sentence for searching relevant

    passages: " query_embedding = embedding(QUERY_PREFIX + query)
  9. Search with embeddings and fuzzy text search LIMIT = 3

    diagnoses_with_embeddings.filter_map do |d| semantic = cosine_similarity(query_embedding, d[:embedding]) fuzzy = fuzzy_score(query, d) semantic_relevant = semantic >= MIN_SEMANTIC_SCORE fuzzy_relevant = fuzzy >= MIN_FUZZY_SCORE next unless semantic_relevant || fuzzy_relevant [d[:diagnosis], [semantic, fuzzy].max] end.sort_by { |_, score| -score }.first(LIMIT).map(&:first)
  10. Search with embeddings and fuzzy text search LIMIT = 3

    diagnoses_with_embeddings.filter_map do |d| semantic = cosine_similarity(query_embedding, d[:embedding]) fuzzy = fuzzy_score(query, d) semantic_relevant = semantic >= MIN_SEMANTIC_SCORE fuzzy_relevant = fuzzy >= MIN_FUZZY_SCORE next unless semantic_relevant || fuzzy_relevant [d[:diagnosis], [semantic, fuzzy].max] end.sort_by { |_, score| -score }.first(LIMIT).map(&:first)
  11. Search with embeddings and fuzzy text search LIMIT = 3

    diagnoses_with_embeddings.filter_map do |d| semantic = cosine_similarity(query_embedding, d[:embedding]) fuzzy = fuzzy_score(query, d) semantic_relevant = semantic >= MIN_SEMANTIC_SCORE fuzzy_relevant = fuzzy >= MIN_FUZZY_SCORE next unless semantic_relevant || fuzzy_relevant [d[:diagnosis], [semantic, fuzzy].max] end.sort_by { |_, score| -score }.first(LIMIT).map(&:first)