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
            }));
        }
Esempio n. 2
0
 public AddressMatcher(ILatestQueries latestQueries, IMapper <AddressDetailItem, TResult> mapper, IWarningLogger warnings)
 {
     _latestQueries = latestQueries;
     _mapper        = mapper;
     _sanitizer     = new Sanitizer {
         Warnings = warnings
     };
 }
Esempio n. 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;
        }
Esempio n. 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))
 {
 }
Esempio n. 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;
 }
Esempio n. 9
0
 public AdresMapper(ResponseOptions responseOptions, ILatestQueries latestQueries)
 {
     _responseOptions = responseOptions;
     _latestQueries   = latestQueries;
 }