Skip to content

Commit

Permalink
Merge pull request #16 from CluedIn-io/fix/city-controlf-lag
Browse files Browse the repository at this point in the history
Fix/city controlf lag
  • Loading branch information
jurgelionis committed May 22, 2024
2 parents ac3ce1c + 1110c2f commit 709a263
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/4.0.3-release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Features
Improved lookup criteria to get more matches
Expanded model that is returned from Google Maps
8 changes: 8 additions & 0 deletions src/ExternalSearch.Providers.GoogleMaps/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public struct KeyName
{
public const string ApiToken = "apiToken";
public const string AcceptedEntityType = "acceptedEntityType";
public const string ControlFlag = "controlFlag";
public const string OrgNameKey = "orgNameKey";
public const string OrgAddressKey = "orgAddressKey";
public const string OrgZipCodeKey = "orgZipCodeKey";
Expand Down Expand Up @@ -52,6 +53,13 @@ public struct KeyName
name = KeyName.AcceptedEntityType
},
new Control()
{
displayName = "Vocabulary Key used to control whether it should be enriched",
type = "input",
isRequired = false,
name = KeyName.ControlFlag
},
new Control()
{
displayName = "Organization Name vocab key",
type = "input",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ public GoogleMapsExternalSearchJobData(IDictionary<string, object> configuration
{
ApiToken = GetValue<string>(configuration, Constants.KeyName.ApiToken);
AcceptedEntityType = GetValue<string>(configuration, Constants.KeyName.AcceptedEntityType);
ControlFlag = GetValue<string>(configuration, Constants.KeyName.ControlFlag);
OrgNameKey = GetValue<string>(configuration, Constants.KeyName.OrgNameKey);
OrgAddressKey = GetValue<string>(configuration, Constants.KeyName.OrgAddressKey);
OrgZipCodeKey = GetValue<string>(configuration, Constants.KeyName.OrgZipCodeKey);
OrgCityKey = GetValue<string>(configuration, Constants.KeyName.OrgCityKey);
OrgStateKey = GetValue<string>(configuration, Constants.KeyName.OrgStateKey);
OrgCountryKey = GetValue<string>(configuration, Constants.KeyName.OrgCountryKey);
LocationAddressKey = GetValue<string>(configuration, Constants.KeyName.LocationAddressKey);
Expand All @@ -27,9 +29,11 @@ public GoogleMapsExternalSearchJobData(IDictionary<string, object> configuration
return new Dictionary<string, object> {
{ Constants.KeyName.ApiToken, ApiToken },
{ Constants.KeyName.AcceptedEntityType, AcceptedEntityType },
{ Constants.KeyName.ControlFlag, ControlFlag },
{ Constants.KeyName.OrgNameKey, OrgNameKey },
{ Constants.KeyName.OrgAddressKey, OrgAddressKey },
{ Constants.KeyName.OrgZipCodeKey, OrgZipCodeKey },
{ Constants.KeyName.OrgCityKey, OrgCityKey },
{ Constants.KeyName.OrgStateKey, OrgStateKey },
{ Constants.KeyName.OrgCountryKey, OrgCountryKey },
{ Constants.KeyName.LocationAddressKey, LocationAddressKey },
Expand All @@ -43,9 +47,11 @@ public GoogleMapsExternalSearchJobData(IDictionary<string, object> configuration

public string ApiToken { get; set; }
public string AcceptedEntityType { get; set; }
public string ControlFlag { get; set; }
public string OrgNameKey { get; set; }
public string OrgAddressKey { get; set; }
public string OrgZipCodeKey { get; set; }
public string OrgCityKey { get; set; }
public string OrgStateKey { get; set; }
public string OrgCountryKey { get; set; }
public string LocationAddressKey { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ private IEnumerable<IExternalSearchQuery> InternalBuildQueries(ExecutionContext
else if (!this.Accepts(request.EntityMetaData.EntityType))
yield break;

if (config.TryGetValue(Constants.KeyName.ControlFlag, out var controlFlag) && !string.IsNullOrWhiteSpace(controlFlag?.ToString()))
{
if (request.EntityMetaData.Properties.GetValue(controlFlag.ToString()) != "true")
{
context.Log.LogTrace($"Skipped enrichment for record {request.EntityMetaData.OriginEntityCode} because VocabularyKey {controlFlag} value was not true. Actual value: {request.EntityMetaData.Properties.GetValue(controlFlag.ToString())}");
yield break;
}
}

//var entityType = request.EntityMetaData.EntityType;

//if (string.IsNullOrEmpty(this.TokenProvider.ApiToken))
Expand Down

0 comments on commit 709a263

Please sign in to comment.