public async Task <IActionResult> Get(
            [FromServices] IKadRrService kadRrService,
            [FromServices] ILatestQueries latestQueries,
            [FromServices] IOptions <ResponseOptions> responseOptions,
            [FromServices] AddressMatchContext context,
            [FromServices] BuildingContext buildingContext,
            [FromQuery] AddressMatchRequest addressMatchRequest,
            CancellationToken cancellationToken = default)
        {
            await new AddressMatchRequestValidator()
            .ValidateAndThrowAsync(addressMatchRequest, cancellationToken: cancellationToken);

            var warningLogger      = new ValidationMessageWarningLogger();
            var maxNumberOfResults = 10;
            var addressMatch       = new AddressMatchMatchingAlgorithm <AdresMatchScorableItem>(
                kadRrService,
                new ManualAddressMatchConfig(responseOptions.Value.SimilarityThreshold, responseOptions.Value.MaxStreetNamesThreshold),
                latestQueries,
                new GemeenteMapper(responseOptions.Value),
                new StreetNameMapper(responseOptions.Value, latestQueries),
                new AdresMapper(responseOptions.Value, latestQueries),
                maxNumberOfResults,
                warningLogger);

            var result = addressMatch.Process(new AddressMatchBuilder(Map(addressMatchRequest))).Take(maxNumberOfResults);

            return(Ok(new AddressMatchCollection
            {
                AdresMatches = result.ToList().Select(x => AdresMatchItem.Create(x, buildingContext, context, responseOptions.Value)).ToList(),
                Warnings = warningLogger.Warnings
            }));
        }
示例#2
0
 public AddressMatcher(ILatestQueries latestQueries, IMapper <AddressDetailItem, TResult> mapper, IWarningLogger warnings)
 {
     _latestQueries = latestQueries;
     _mapper        = mapper;
     _sanitizer     = new Sanitizer {
         Warnings = warnings
     };
 }
示例#3
0
        //private readonly ITelemetry _telemetry; TODO: Datadog

        public MunicipalityMatcher(ILatestQueries latestQueries, ManualAddressMatchConfig config,
                                   IMapper <MunicipalityLatestItem, TResult> mapper, IWarningLogger warnings)//, ITelemetry telemetry)
        {
            _latestQueries = latestQueries;
            _config        = config;
            _mapper        = mapper;
            _warnings      = warnings;
            //_telemetry = telemetry;
        }
示例#4
0
 public StreetNameMatcher(
     ILatestQueries latestQueries,
     IKadRrService streetNameService,
     ManualAddressMatchConfig config,
     IMapper <StreetNameLatestItem, TResult> mapper,
     IWarningLogger warnings)
 {
     _latestQueries     = latestQueries;
     _streetNameService = streetNameService;
     _config            = config;
     _mapper            = mapper;
     _warnings          = warnings;
 }
        //private readonly ITelemetry _telemetry;

        public StreetNameMatcher(
            ILatestQueries latestQueries,
            IKadRrService streetNameService,
            ManualAddressMatchConfig config,
            IMapper <StreetNameLatestItem, TResult> mapper,
            IWarningLogger warnings)
        //ITelemetry telemetry) TODO: Datadog
        {
            _latestQueries     = latestQueries;
            _streetNameService = streetNameService;
            _config            = config;
            _mapper            = mapper;
            _warnings          = warnings;
            //_telemetry = telemetry;
        }
 public AddressMatchMatchingAlgorithm(
     IKadRrService kadRrService,
     ManualAddressMatchConfig config,
     ILatestQueries latestQueries,
     IMapper <MunicipalityLatestItem, TResult> municipalityMapper,
     IMapper <StreetNameLatestItem, TResult> streetNameMapper,
     IMapper <AddressDetailItem, TResult> addressMapper,
     int maxNumberOfResults,
     IWarningLogger warnings) :
     base(
         new RrAddressMatcher <TResult>(kadRrService, addressMapper, maxNumberOfResults, warnings),
         new MunicipalityMatcher <TResult>(latestQueries, config, municipalityMapper, warnings),
         new StreetNameMatcher <TResult>(latestQueries, kadRrService, config, streetNameMapper, warnings),
         new AddressMatcher <TResult>(latestQueries, addressMapper, warnings))
 {
 }
示例#7
0
 public CrabKadRrService(IMemoryCache memoryCache, ILatestQueries latestQueries, AddressMatchContext context)
     : base(memoryCache)
 {
     _latestQueries = latestQueries;
     _context       = context;
 }
 public StreetNameMapper(ResponseOptions responseOptions, ILatestQueries latestQueries)
 {
     _responseOptions = responseOptions;
     _latestQueries = latestQueries;
 }
示例#9
0
 public AdresMapper(ResponseOptions responseOptions, ILatestQueries latestQueries)
 {
     _responseOptions = responseOptions;
     _latestQueries   = latestQueries;
 }