public function getLocationsByChildCareProgramId($program_id) {
    $programMap = [];

    $cid = __METHOD__ . $program_id;
    if ($cache = $this->cache->get($cid)) {
      $programMap = $cache->data;
    }
    else {
      $config = $this->configFactory->get('openy_programs_search.settings');
      $pinned_programs = $config->get('pinned_programs');
      $locations = $this->getDaxkoLocationMap();
      $locsr = array_flip($locations);
      $locexp = $this->customLocationStem($locations);

      $programs = $this->getAllChildCarePrograms();
      foreach ($programs as $program) {
        $loc = strstr($program->name, ' ', TRUE);

        if (isset($locsr[$loc])) {
          $programMap[$program->id][$locsr[$loc]] = $locsr[$loc];
        }
        else {
          $ranking = [];
          foreach ($locexp as $k => $exps) {

            $ranking[$k] = 0;
            if (substr($program->name, 0, 1) == substr($exps[0], 0, 1)) {
              if (($i = count($pinned_programs)) > 0) {
                foreach ($pinned_programs as $pinned_program) {
                  if ((strpos($program->name, $pinned_program) !== FALSE)) {
                    // Allow the order of the pinned programs be used as an
                    // additional weight.
                    $ranking[$k] += -10 -$i;
                  }
                  $i -= 1;
                }
              }
              $ranking[$k] += .25;
            }

            foreach ($exps as $exp) {
              if (!empty($exp)) {
                $smatch = strpos($program->name, $exp);
                if ($smatch !== FALSE) {
                  $ranking[$k] += 2 / ($smatch + 1);
                }
              }
            }
          }

          // Reverse sort the ranking.
          arsort($ranking);
          $top_rank = -1;

          foreach ($ranking as $lid => $rank) {
            if ($top_rank == -1 || $top_rank == $rank) {
              $top_rank = $rank;
              $programMap[$program->id][$lid] = $lid;
            }
          }
        }
      }

      $this->cache->set($cid, $programMap);
    }

    return $programMap[$program_id];
  }