public MedicareController(
     MedicareEntities medicareDatabase,
     HttpContextBase httpContext)
 {
     this.medicareDatabase = medicareDatabase;
     this.httpContext      = httpContext;
 }
            public IQueryable <MedicareExtendedProvider> apply(
                MedicareEntities medicareDatabase,
                IQueryable <MedicareExtendedProvider> query)
            {
                var hasFilter = false;

                var utilization = medicareDatabase
                                  .MedicareExtendedUtilizationAndPayments
                                  .AsQueryable();

                if (!String.IsNullOrEmpty(hcpcs))
                {
                    utilization = utilization.Where(x => x.hcpcs_code == hcpcs);
                    hasFilter   = true;
                }

                if (year > 1900)
                {
                    utilization = utilization.Where(x => x.year == year);
                    hasFilter   = true;
                }

                if (hasFilter)
                {
                    query =
                        from q in query
                        join npi in utilization.Select(x => x.npi).Distinct()
                        on q.NPI equals npi
                        select q;
                }

                // filter within distance
                if (miles > 0 && zipcode > 0)
                {
                    var lat_lon = medicareDatabase.ZipCodes.Find(zipcode);

                    if (lat_lon != null)
                    {
                        // convert miles to meters
                        var withinMeters = miles * 1609.344f;

                        query =
                            from q in query
                            join z in medicareDatabase.ZipCodes
                            on q.us_business_practice_location_zip_code_5 equals z.geoid
                            where z.point.Distance(lat_lon.point) <= withinMeters
                            select q;
                    }
                }

                return(query);
            }
Example #3
0
 public AccountController(MedicareEntities medicareDatabase)
 {
     this.medicareDatabase = medicareDatabase;
 }