/// <summary> /// Gets the type specific query parameters to be sent to the API from the given URL params /// </summary> /// <returns>A JObject with all of the parameters converted to those needed by API</returns> protected override JObject GetTypeSpecificQueryParameters() { JObject queryParams = new JObject(); // Get friendly name to c-code mapping string disIDs = this.DiseaseIDs; if (FriendlyNameWithOverridesMapping.MappingContainsFriendlyName(this.DiseaseIDs.ToLower())) { disIDs = FriendlyNameWithOverridesMapping.GetCodeFromFriendlyName(this.DiseaseIDs.ToLower()); } else { if (FriendlyNameMapping.MappingContainsFriendlyName(this.DiseaseIDs.ToLower())) { disIDs = FriendlyNameMapping.GetCodeFromFriendlyName(this.DiseaseIDs.ToLower()); } } string[] diseaseIDsarr = disIDs.Split(new char[] { ',' }); queryParams.Add("diseases.nci_thesaurus_concept_id", new JArray(diseaseIDsarr)); if (!string.IsNullOrWhiteSpace(this.TrialType)) { if (FriendlyNameWithOverridesMapping.MappingContainsFriendlyName(this.TrialType.ToLower())) { queryParams.Add("primary_purpose.primary_purpose_code", FriendlyNameWithOverridesMapping.GetCodeFromFriendlyName(this.TrialType.ToLower())); } else { queryParams.Add("primary_purpose.primary_purpose_code", this.TrialType); } } if (!string.IsNullOrWhiteSpace(this.InterventionIDs)) { // Get friendly name to c-code mapping string ivIDs = this.InterventionIDs; if (FriendlyNameWithOverridesMapping.MappingContainsFriendlyName(this.InterventionIDs.ToLower())) { ivIDs = FriendlyNameWithOverridesMapping.GetCodeFromFriendlyName(this.InterventionIDs.ToLower()); } else { if (FriendlyNameMapping.MappingContainsFriendlyName(this.InterventionIDs.ToLower())) { ivIDs = FriendlyNameMapping.GetCodeFromFriendlyName(this.InterventionIDs.ToLower()); } } string[] interventionIDsarr = ivIDs.Split(new char[] { ',' }); queryParams.Add("arms.interventions.intervention_code", new JArray(interventionIDsarr)); } return(queryParams); }
/// <summary> /// Replaces the Placeholder Codes (or text) with Override Labels /// </summary> /// <param name="codes"></param> /// <returns>A string with the override text</returns> private string GetOverride(string valToOverride, bool needsTitleCase) { // Get friendly name to c-code mapping if (FriendlyNameWithOverridesMapping.MappingContainsFriendlyName(valToOverride.ToLower())) { valToOverride = FriendlyNameWithOverridesMapping.GetCodeFromFriendlyName(valToOverride); } else { if (FriendlyNameMapping.MappingContainsFriendlyName(valToOverride.ToLower())) { valToOverride = FriendlyNameMapping.GetCodeFromFriendlyName(valToOverride); } } // Get label mappings var labelMapping = DynamicTrialListingMappingService.Instance; string overrideText = ""; // Add check for whether override/EVS mapping has all of the codes. // If so, keep as is. If not, split and find the first match. // If combination of codes is in label mappings, set override if (labelMapping.MappingContainsKey(valToOverride)) { if (needsTitleCase) { overrideText = labelMapping.GetTitleCase(valToOverride); } else { overrideText = labelMapping.Get(valToOverride); } } // Raise 404 error if overrides aren't found else { Response.Headers.Add("X-CTSMap", "ID not found"); LogManager.GetLogger(typeof(DynamicTrialListingPageDiseaseControl)).ErrorFormat("" + "Invalid parameter in dynamic listing page: {0} does not have override", valToOverride); NCI.Web.CDE.Application.ErrorPageDisplayer.RaisePageByCode("DynamicTrialListingPageDiseaseControl", 404, "Invalid parameter in dynamic listing page: value given does not have override"); } return(overrideText); }
/// <summary> /// Gets the type specific query parameters to be sent to the API from the given URL params /// </summary> /// <returns>A JObject with all of the parameters converted to those needed by API</returns> protected override JObject GetTypeSpecificQueryParameters() { JObject queryParams = new JObject(); // Get friendly name to c-code mapping string ivIDs = this.InterventionIDs; if (FriendlyNameWithOverridesMapping.MappingContainsFriendlyName(this.InterventionIDs.ToLower())) { ivIDs = FriendlyNameWithOverridesMapping.GetCodeFromFriendlyName(this.InterventionIDs.ToLower()); } else { if (FriendlyNameMapping.MappingContainsFriendlyName(this.InterventionIDs.ToLower())) { ivIDs = FriendlyNameMapping.GetCodeFromFriendlyName(this.InterventionIDs.ToLower()); } } // Add check for whether override/EVS mapping has all of the codes. // If so, keep as is. If not, split and find the first match. string[] interventionIDsarr = ivIDs.Split(new char[] { ',' }); queryParams.Add("arms.interventions.intervention_code", new JArray(interventionIDsarr)); if (!string.IsNullOrWhiteSpace(this.TrialType)) { if (FriendlyNameWithOverridesMapping.MappingContainsFriendlyName(this.TrialType.ToLower())) { queryParams.Add("primary_purpose.primary_purpose_code", FriendlyNameWithOverridesMapping.GetCodeFromFriendlyName(this.TrialType.ToLower())); } else { queryParams.Add("primary_purpose.primary_purpose_code", this.TrialType); } } return(queryParams); }