Пример #1
0
        //Parameter hos (Hospital)
        private void ParseHospital(NciUrl url, CTSSearchParams searchParams)
        {
            HospitalLocationSearchParams locParams = new HospitalLocationSearchParams();
            bool hasInvalidParam = false;

            if (IsInUrl(url, "hos"))
            {
                string hospital = url.CTSParamAsStr("hos");
                if (!string.IsNullOrWhiteSpace(hospital))
                {
                    locParams.Hospital = hospital;
                }
                else
                {
                    hasInvalidParam = true;
                    LogParseError(FormFields.Hospital, "Please enter a valid hospital/institution parameter.", searchParams);
                }
            }
            else
            {
                hasInvalidParam = true;
                LogParseError(FormFields.Hospital, "Please enter a valid hospital/institution parameter.", searchParams);
            }

            if (!hasInvalidParam)
            {
                searchParams.LocationParams = locParams;
            }
            else
            {
                searchParams.LocationParams = new HospitalLocationSearchParams();
            }
        }
Пример #2
0
        //Parameter hos (Hospital)
        private static void SerializeHospital(NciUrl url, CTSSearchParams searchParams)
        {
            HospitalLocationSearchParams locParams = (HospitalLocationSearchParams)searchParams.LocationParams;

            if (locParams.IsFieldSet(FormFields.Hospital))
            {
                url.QueryParameters.Add("hos", HttpUtility.UrlEncode(locParams.Hospital));
            }
        }
Пример #3
0
        /// <summary>
        /// Gets a location field value as a string suitable for things like, oh, a velocity template
        /// </summary>
        /// <param name="field">A FormFields enum value</param>
        /// <returns>The value of the field, OR, and error message</returns>
        private string GetLocFieldAsString(FormFields field)
        {
            CountryCityStateLocationSearchParams cLoc = LocationParams as CountryCityStateLocationSearchParams;
            HospitalLocationSearchParams         hLoc = LocationParams as HospitalLocationSearchParams;
            ZipCodeLocationSearchParams          zLoc = LocationParams as ZipCodeLocationSearchParams;

            switch (field)
            {
            case FormFields.AtNIH:
            {
                if (Location == LocationType.AtNIH)
                {
                    return("Yes");
                }
                else
                {
                    throw new Exception();
                }
            }

            case FormFields.City:
            {
                return(cLoc.City);
            }

            case FormFields.Country:
            {
                return(cLoc.Country);
            }

            case FormFields.State:
            {
                return(String.Join(", ", cLoc.State.Select(st => st.Label)));
            }

            case FormFields.Hospital:
            {
                return(hLoc.Hospital);
            }

            case FormFields.ZipCode:
            {
                return(zLoc.ZipCode);
            }

            case FormFields.ZipRadius:
            {
                return(zLoc.ZipRadius.ToString());
            }

            default:
            {
                throw new Exception();
            }
            }
        }
Пример #4
0
        //Parameter hos (Hospital)
        private static void AddAnalyticsHospital(List <string> waList, CTSSearchParams searchParams)
        {
            string value = "none";
            HospitalLocationSearchParams locParams = (HospitalLocationSearchParams)searchParams.LocationParams;

            if (locParams.IsFieldSet(FormFields.Hospital))
            {
                value = locParams.Hospital;
            }
            waList.Add(value);
        }
Пример #5
0
        // TODO: refactor and clean up names

        /// <summary>
        /// Build the list of query abbreviations from completed search fields.
        /// </summary>
        /// <param name="waList"></param>
        /// <param name="searchParams"></param>
        private static void AddAllUsedParams(List <string> waList, CTSSearchParams searchParams)
        {
            //Parameter t (Main Cancer Type)
            if (searchParams.IsFieldSet(FormFields.MainType))
            {
                waList.Add("t");
            }

            //Parameter st (SubTypes)
            if (searchParams.IsFieldSet(FormFields.SubTypes))
            {
                waList.Add("st");
            }

            //Parameter stg (Stages)
            if (searchParams.IsFieldSet(FormFields.Stages))
            {
                waList.Add("stg");
            }

            //Parameter fin (Findings)
            if (searchParams.IsFieldSet(FormFields.Findings))
            {
                waList.Add("fin");
            }

            // Parameter a (Age)
            if (searchParams.IsFieldSet(FormFields.Age))
            {
                waList.Add("a");
            }

            //Parameter q (Keyword/Phrase)
            if (searchParams.IsFieldSet(FormFields.Phrase))
            {
                waList.Add("q");
            }

            // Parameter g (Gender)
            if (searchParams.IsFieldSet(FormFields.Gender))
            {
                waList.Add("g");
            }

            // Parameter loc (Location, and AtNIH if loc=nih)
            if (searchParams.IsFieldSet(FormFields.Location) || searchParams.IsFieldSet(FormFields.IsVAOnly))
            {
                waList.Add("loc");

                if (searchParams.IsVAOnly)
                {
                    waList.Add("va");
                }

                switch (searchParams.Location)
                {
                case LocationType.Zip:
                {
                    ZipCodeLocationSearchParams locParams = (ZipCodeLocationSearchParams)searchParams.LocationParams;
                    if (locParams.IsFieldSet(FormFields.ZipCode))
                    {
                        waList.Add("z");
                    }
                    if (locParams.IsFieldSet(FormFields.ZipRadius))
                    {
                        waList.Add("zp");
                    }
                    break;
                }

                case LocationType.CountryCityState:
                {
                    CountryCityStateLocationSearchParams locParams = (CountryCityStateLocationSearchParams)searchParams.LocationParams;
                    if (locParams.IsFieldSet(FormFields.Country))
                    {
                        waList.Add("lcnty");
                    }
                    if (locParams.IsFieldSet(FormFields.State))
                    {
                        waList.Add("lst");
                    }
                    if (locParams.IsFieldSet(FormFields.City))
                    {
                        waList.Add("lcty");
                    }
                    break;
                }

                case LocationType.Hospital:
                {
                    HospitalLocationSearchParams locParams = (HospitalLocationSearchParams)searchParams.LocationParams;
                    if (locParams.IsFieldSet(FormFields.Hospital))
                    {
                        waList.Add("hos");
                    }
                    break;
                }

                case LocationType.None:
                {
                    //If the user performed a VA search, then leave loc in place.
                    if (!searchParams.IsVAOnly)
                    {
                        waList.Remove("loc");
                    }
                    break;
                }
                } // End switch
            }     // End if

            // Parameter tt (Trial Type)
            if (searchParams.IsFieldSet(FormFields.TrialTypes))
            {
                waList.Add("tt");
            }

            //Parameter d (Drugs)
            if (searchParams.IsFieldSet(FormFields.Drugs))
            {
                waList.Add("d");
            }

            //Parameter i (Other treatments / interventions)
            if (searchParams.IsFieldSet(FormFields.OtherTreatments))
            {
                waList.Add("i");
            }

            //Parameter i (Other treatments / interventions)
            if (searchParams.IsFieldSet(FormFields.HealthyVolunteers))
            {
                waList.Add("hv");
            }

            // Parameter tp (Trial Phase)
            if (searchParams.IsFieldSet(FormFields.TrialPhases))
            {
                waList.Add("tp");
            }

            // Parameter tid (Trial IDs)
            if (searchParams.IsFieldSet(FormFields.TrialIDs))
            {
                waList.Add("tid");
            }

            // Parameter in (Investigator)
            if (searchParams.IsFieldSet(FormFields.Investigator))
            {
                waList.Add("in");
            }

            // Parameter lo (Lead Org)
            if (searchParams.IsFieldSet(FormFields.LeadOrg))
            {
                waList.Add("lo");
            }
        }