public RrAddressMatcher(IKadRrService kadRrService, IMapper <AddressDetailItem, TResult> mapper, int maxNumberOfResults, IWarningLogger warnings)
 {
     _kadRrService       = kadRrService;
     _mapper             = mapper;
     _maxNumberOfResults = maxNumberOfResults;
     _warnings           = warnings;
 }
        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
            }));
        }
Exemple #3
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))
 {
 }