About the project — HealingGlobe

Inspiration

HealingGlobe started as a small experiment to combine a simple, explainable index with a tiny API so people can prototype wellness analytics quickly. I wanted a minimal, well-tested example that shows how domain components (mental, physical, social) can be combined into a single score while keeping the math transparent.

What I learned

  • How to design a very small Flask application with a clear separation between API code and pure functions.
  • The value of small unit tests that document expected behavior and edge cases.
  • A reminder that even tiny transforms (here we use a square-root smoothing) change distributional properties; always document them.

How I built it

  1. I wrote a single pure function compute_healing_index(scores, weights) that:
  • validates inputs (non-empty, values in [0,1])
  • computes a weighted average
  • applies a smoothing transform: final = (\sqrt{\text{avg}})

In math form: given components (s_i\in[0,1]) with weights (w_i\ge 0),

$$ \text{avg} = \frac{\sum_i w_i s_i}{\sum_i w_i}, \qquad \text{index} = \sqrt{\max(0,\min(1,\text{avg}))}. $$

  1. I wrapped the function behind a tiny Flask blueprint with endpoints:
  • GET / — basic metadata
  • POST /health-index — accepts { "scores": {...}, "weights": {...} } and returns { "healing_index": x }.
  1. I added pytest tests for the main behaviors (happy path, weights, invalid inputs).

Challenges faced

  • Choosing a compact but meaningful transform: I used the square-root because it modestly penalizes low averages and is monotonic and simple to explain.
  • Deciding defaults for weights (fallback to equal weights when none provided or weights sum to zero).
  • Keeping the API small while still validating inputs clearly.

Built With

Share this project:

Updates