{"size": 1059, "ext": "js", "max_stars_repo_path": "modules/core/client/services/episode-of-care.client.service.js", "max_stars_repo_name": "popdw/Archive", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "modules/core/client/services/episode-of-care.client.service.js", "max_issues_repo_name": "popdw/Archive", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "modules/core/client/services/episode-of-care.client.service.js", "max_forks_repo_name": "popdw/Archive", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.8292682927, "max_line_length": 109, "alphanum_fraction": 0.4674220963}
(function () {
  'use strict';

  angular
    .module('core')
    .factory('episodeOfCareModel', episodeOfCareModel);

  function episodeOfCareModel(apiService, $q, stringService) {

    return {
      get: function(eocCode) {
        return $q(function(resolve, reject) {
          if (!eocCode) {
            reject();
          } else {
            apiService('episode_of_care/show/' + stringService.urlEncode(eocCode)).then(function (response) {
              var data = response.data;

              if (data.eoc_code) {
                var eoc = {
                  id: data.eoc_code,
                  name: data.eoc_title,
                  category: {
                    id: data.eoc_category.eoc_category_id,
                    name: data.eoc_category.eoc_category_name,
                    description: data.eoc_category.eoc_category_description
                  }
                };

                resolve(eoc);
              } else {
                reject();
              }
            });
          }
        });
      }
    };
  }
}());
