Skip to content

Rank surgeons by procedure

This guide builds a ranked list of clinicians who perform a given procedure in a given state, then pulls a full profile for the top name. The first three steps spend 3 credits.

Terminal window
curl "$OPH_API/api/procedures?q=knee%20arthroplasty" -H "Authorization: Bearer $OPH_KEY"

Take the code of the row you want. Total knee replacement is 27447.

Terminal window
curl "$OPH_API/api/providers?hcpcs=27447&state=AZ&min_services=50&limit=50" \
-H "Authorization: Bearer $OPH_KEY"

Rows come back sorted by services, highest first. min_services drops occasional operators.

To narrow to one metro, add city=Phoenix. The match is on the whole city name, so Phoenix will not return Scottsdale; run one call per city.

Terminal window
curl "$OPH_API/api/providers/1234567893" -H "Authorization: Bearer $OPH_KEY"

The parts a rep usually wants:

  • procedures: the rest of their case mix, with place_of_service showing hospital (F) against office (O).
  • groups: the practice to route the account to.
  • payments: which manufacturers already pay them, and how much.

The search returns up to 200 rows a page. For every clinician that matches, send the same filters to exports (10 credits):

Terminal window
curl "$OPH_API/api/exports" \
-H "Authorization: Bearer $OPH_KEY" -H "Content-Type: application/json" \
-d '{"list": "providers", "params": {"hcpcs": "27447", "state": "AZ", "min_services": 50}}'

The response has a url to a CSV with the same columns as the search.

For something the search has no column for, such as each surgeon’s share of cases done in a hospital, ask in plain English (25 credits):

Terminal window
curl "$OPH_API/api/ask" \
-H "Authorization: Bearer $OPH_KEY" \
-H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"question": "For the top knee replacement surgeons in Arizona, what share of their cases are done in a facility?"}'

Each tile in the answer carries the sql the model wrote, so you can see how the share was computed.