Skip to content

Commit

Permalink
Added Enrichment to Validate and Enrich request
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitar Ryapov committed Jul 10, 2024
1 parent 7707694 commit 1d3bcaa
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 1 deletion.
121 changes: 120 additions & 1 deletion src/ts/address-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export default class AddressValidation {
};

if (this.searchType === AddressValidationSearchType.SINGLELINE || this.searchType === AddressValidationSearchType.VALIDATE) {
data['attributes'] = {};
data['options'] = [
{
name: 'flatten',
Expand All @@ -414,6 +415,124 @@ export default class AddressValidation {
}
];

if(this.currentDataSet === "gb-address"){
data['attributes'] = {
"uk_location_essential":[
"latitude",
"longitude",
"match_level",
"uprn",
"x_coordinate",
"y_coordinate",
"udprn"
]
};
}
else if(this.currentDataSet === "us-address"){
data['attributes'] = {
"usa_location_insight":[
"delivery_point_barcode",
"dpc",
"check_digit",
"congressional_district_code",
"county_code",
"record_type",
"latitude",
"longitude",
"match_level",
"carrier_route",
"census_tract_number"
]
};
}
else if(this.currentDataSet === "au-address"){
data['attributes']['AUS_CV_Household'] = [
"address",
"adults_at_address_code",
"adults_at_address_description",
"affluence_code",
"affluence_description",
"channel_preference",
"channel_preference_description",
"children_at_address_code_0_10_years",
"children_at_address_code_11_18_years",
"children_at_address_description_0_10_years",
"children_at_address_description_11_18_years",
"credit_demand_code",
"credit_demand_description",
"gnaf_latitude",
"gnaf_longitude",
"gnaf_pid",
"head_of_household_age_code",
"head_of_household_age_description",
"hin",
"household_composition_code",
"household_composition_description",
"household_income_code",
"household_income_description",
"length_of_residence_code",
"length_of_residence_description",
"lifestage_code",
"lifestage_description",
"local_government_area_code",
"local_government_area_name",
"meshblock",
"mosaic_group",
"mosaic_segment",
"mosaic_type",
"postcode",
"residential_flag",
"risk_insight_code",
"risk_insight_description",
"sa1",
"state",
"suburb",
"mosaic_factor1_percentile",
"mosaic_factor1_score",
"mosaic_factor2_percentile",
"mosaic_factor2_score",
"mosaic_factor3_percentile",
"mosaic_factor3_score",
"mosaic_factor4_percentile",
"mosaic_factor4_score",
"mosaic_factor5_percentile",
"mosaic_factor5_score"
];
data['attributes']['AUS_CV_Postcode'] = [
"postcode",
"adults_at_address_code",
"adults_at_address_description",
"affluence_code",
"affluence_code_description",
"children_at_address_code_0_10_years",
"children_at_address_description_0_10_years",
"children_at_address_code_11_18_years",
"children_at_address_description_11_18_years",
"credit_demand_code",
"credit_demand_description",
"head_of_household_age_code",
"head_of_household_age_description",
"household_income_code",
"household_income_description",
"length_of_residence_code",
"length_of_residence_description",
"lifestage_code",
"lifestage_code_description",
"household_composition_code",
"household_composition_description",
"risk_insight_code",
"risk_insight_description",
"mosaic_group",
"mosaic_type"
];
}
data['attributes']['premium_location_insight'] = [
"geocodes",
"geocodes_access",
"geocodes_building_xy",
"time"
];

if (this.searchType === AddressValidationSearchType.SINGLELINE) {
data['options'].push({
name: 'search_type',
Expand Down Expand Up @@ -574,7 +693,7 @@ export default class AddressValidation {
default: {
data = this.generateSearchDataForApiCall();
url = this.baseUrl + (this.searchType === AddressValidationSearchType.VALIDATE ? this.validateEndpoint : this.searchEndpoint);
headers = this.searchType === AddressValidationSearchType.VALIDATE ? [{ key: 'Add-Components', value: true }, { key: 'Add-Metadata', value: true }] : [];
headers = this.searchType === AddressValidationSearchType.VALIDATE ? [{ key: 'Add-Components', value: true }, { key: 'Add-Metadata', value: true }, { key: 'Add-Enrichment', value: true }] : [];
callback = this.searchType === AddressValidationSearchType.VALIDATE ? this.result.handleValidateResponse : this.picklist.show;
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/ts/datasets-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ export const datasetCodes = [
{country: 'United Kingdom', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-additional-multipleresidence', searchType: 'autocomplete, singleline, typedown, validate, lookupv2'},
{country: 'United Kingdom', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-additional-notyetbuilt', searchType: 'autocomplete, singleline, typedown, validate, lookupv2'},
{country: 'United Kingdom AddressBase Premium', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-address-addressbase', searchType: 'singleline, typedown, validate, lookup'},
{country: 'United Kingdom Location Essential', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-address-addressbase', searchType: 'singleline, typedown, validate, lookup'},
{country: 'United Kingdom AddressBase Premium with Islands', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-additional-addressbaseislands', searchType: 'singleline, typedown, validate, lookup'},
{country: 'United Kingdom Business Names', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-additional-business', searchType: 'singleline, typedown'},
{country: 'United Kingdom Electricity', iso3Code: 'GBR', iso2Code: 'GB', datasetCode: 'gb-additional-electricity', searchType: 'autocomplete, singleline, typedown, lookupv2'},
Expand Down

0 comments on commit 1d3bcaa

Please sign in to comment.