Example #1
0
        public async Task <SampleCentre> GetClosestSampleCentreWithAvailableTests(GetSampleCentresWithAvailableTestsFunction sampleCentresFunction, GeoCoordinate currLocation, BlockParameter blockParameter = null)
        {
            GetSampleCentresWithAvailableTestsOutputDTO availableTestsOutput =
                await SampleCentresWithAvailableTestsQueryAsync(sampleCentresFunction, blockParameter).ConfigureAwait(false);

            var availableTestCentres = availableTestsOutput.ReturnValue1;

            var nearestLoc
                = availableTestCentres.Select(x => new GeoCoordinate(ToDbl(x.Location.Lat), ToDbl(x.Location.Long)))
                  .OrderBy(x => x.GetDistanceTo(currLocation))
                  .First();

            return(FindSampleCentreByLocation(availableTestCentres, nearestLoc));
        }
Example #2
0
        public async Task <SampleCentre> GetClosestSampleCentreWithAvailableTests(GetSampleCentresWithAvailableTestsFunction sampleCentresFunction,
                                                                                  GeoCoordinate currLocation,
                                                                                  uint acceptedHotZoneLevel,
                                                                                  uint minAvgTestSensitivity,
                                                                                  uint minAvgTestSpecificity,
                                                                                  BlockParameter blockParameter = null)
        {
            GetSampleCentresWithAvailableTestsOutputDTO availableTestsOutput =
                await SampleCentresWithAvailableTestsQueryAsync(sampleCentresFunction, blockParameter).ConfigureAwait(false);

            var availableTestCentres = availableTestsOutput.ReturnValue1;

            var nearestLoc
                = availableTestCentres.Where(x => x.HotZoneLevel <= acceptedHotZoneLevel)
                  .Where(x => x.AvgTestSensitivtyRating >= minAvgTestSensitivity)
                  .Where(x => x.AvgTestSpecifityRating >= minAvgTestSpecificity)
                  .Select(x => new GeoCoordinate(ToDbl(x.Location.Lat), ToDbl(x.Location.Long)))
                  .OrderBy(x => x.GetDistanceTo(currLocation))
                  .First();

            return(FindSampleCentreByLocation(availableTestCentres, nearestLoc));
        }