The scoring algorithm assigns each animal a score from 0–100 for every rescue program. The formula weights breed most heavily because it correlates most strongly with the physical traits and behavioral drives required for search-and-rescue work. Sex and age are weighted equally as secondary criteria. Every animal in the dataset receives a score — no animal is excluded from ranking — but only animals that satisfy all three criteria simultaneously are considered strict qualifiers.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/rescue-retriever/llms.txt
Use this file to discover all available pages before exploring further.
Score Formula
The full scoring implementation lives inlib/filterUtils.js. The three functions below handle normalization, breed matching, and final score computation:
filterUtils.js
scoreAnimal returns a plain object — no side effects, no DOM interaction. The same function is called for every animal–program pair in the application.
Point Breakdown
Each of the three criteria contributes points whether it matches or not. A non-matching criterion still contributes a small baseline score rather than zero, which preserves meaningful ranking between animals that miss on different criteria.| Criterion | Match | No Match |
|---|---|---|
| Breed | 50 | 12 |
| Sex | 25 | 5 |
| Age | 25 | 5 |
| Total range | 22–100 | — |
Math.min(100, ...), though the maximum achievable sum is exactly 100 (50 + 25 + 25), so the cap has no practical effect on real scores.
All Possible Score Values
Because each criterion has exactly two point values, there are eight possible score combinations:| Breed | Sex | Age | Score | Notes |
|---|---|---|---|---|
| ✅ Match | ✅ Match | ✅ Match | 100 | Strict qualifier |
| ✅ Match | ✅ Match | ❌ No match | 80 | Right breed and sex, outside age window |
| ✅ Match | ❌ No match | ✅ Match | 80 | Right breed and age, wrong sex |
| ✅ Match | ❌ No match | ❌ No match | 60 | Breed only |
| ❌ No match | ✅ Match | ✅ Match | 62 | Sex and age only |
| ❌ No match | ✅ Match | ❌ No match | 42 | Sex only |
| ❌ No match | ❌ No match | ✅ Match | 42 | Age only |
| ❌ No match | ❌ No match | ❌ No match | 22 | No criteria met |
Strict Qualification
Thequalifies flag is computed as:
qualifies: true — always score 100 — are displayed in strict candidate lists on the Reports page and surfaced with program badges in the Dashboard. However, all animals receive a score for every program and are ranked accordingly in the full Dashboard view.
The rationale array on the score object provides three human-readable explanation strings — one per criterion — describing the match or mismatch in plain language. These strings are displayed verbatim in the Candidate Detail view.
Multi-Program Scoring
Every animal is scored against all three programs simultaneously usingscoreAllPrograms:
filterUtils.js
getBestScore(animal) returns the single highest-scoring program result for that animal. This best score is used whenever the Dashboard is set to “All Animals” mode.
To find all programs an animal strictly qualifies for, getQualifyingPrograms(animal) filters the scored results to those with breedMatch && sexMatch && ageMatch and returns their program IDs:
filterUtils.js
Sorting Behavior
Sorting logic is handled by two functions inlib/filterUtils.js:
sortByProgram(animals, programId) — Used when a specific program filter is active:
- Sort primary: that program’s
matchScoredescending - Sort secondary:
ageWeeksascending (younger animals rank higher among ties)
getStrictCandidates(animals, programId) — Used for the Reports page:
- Filter: keep only animals where
getQualifyingProgramsincludes the given program ID - Sort primary: that program’s
matchScoredescending - Sort secondary:
ageWeeksascending
- Sort primary:
getBestScore(animal).matchScoredescending - Sort secondary:
ageWeeksascending
Breed matching is a normalized substring check, not an exact match. An animal recorded as
"German Shepherd Mix" will match the "German Shepherd" profile breed because the normalized form of the animal breed ("german shepherd") contains the normalized profile breed ("german shepherd"). See the Data Model for the full normalization algorithm.Related Reference
Data Model
Animal record fields and RescueProfile schema
Filter Utilities
Full API reference for filterUtils.js
Programs Overview
Water, Mountain, and Disaster program details