Skip to content

Commit

Permalink
Updates for merge (#248)
Browse files Browse the repository at this point in the history
Fixed issues with merge issues
  • Loading branch information
swmuirdhie authored Sep 12, 2024
1 parent 2b1ad11 commit 107b1b6
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ namespace CDC.DEX.FHIR.Function.DataExport
public class FhirEventProcessor
{

private string TruncateStrForLog(string jsonString, int maxLen)
{
return jsonString.Length > maxLen ? jsonString.Substring(0, maxLen) + "..." : jsonString;
} // .TruncateStrForLog

/// <summary>
/// Read resource created event message and retrieve the created fhir resource
/// </summary>
Expand All @@ -36,7 +41,7 @@ public async Task<JObject> ProcessFhirEvent(FhirResourceCreated resourceCreated
using (HttpClient client = httpClientFactory.CreateClient())
{

string token = await FhirServiceUtils.GetFhirServerToken(config, client);
string token = await FhirServiceUtils.GetFhirServerToken(config, client,log);
int maxLengthForLog = 500;

client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));//ACCEPT header
Expand All @@ -45,9 +50,7 @@ public async Task<JObject> ProcessFhirEvent(FhirResourceCreated resourceCreated
using (var request = new HttpRequestMessage(HttpMethod.Get, requestUrl))
{
// get auth token
log.LogInformation(DataExport.LogPrefix() + "GetFhirServerToken Start");
string token = await FhirServiceUtils.GetFhirServerToken(config, client,log);
log.LogInformation(DataExport.LogPrefix() + "GetFhirServerToken End");


request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
// request.Headers.Add("Ocp-Apim-Subscription-Key", config["OcpApimSubscriptionKey"]);
Expand All @@ -58,7 +61,7 @@ public async Task<JObject> ProcessFhirEvent(FhirResourceCreated resourceCreated

response.EnsureSuccessStatusCode();
string jsonString = await response.Content.ReadAsStringAsync();
log.LogInformation(DataExport.LogPrefix() + $"FHIR Record details returned from FHIR service: " + TruncateStrForLog(validateReportingBundleResult.JsonString, maxLengthForLog));
log.LogInformation(DataExport.LogPrefix() + $"FHIR Record details returned from FHIR service: " + TruncateStrForLog(jsonString, maxLengthForLog));
fhirResourceToProcessJObject = JObject.Parse(jsonString);
return fhirResourceToProcessJObject;
}
Expand Down

0 comments on commit 107b1b6

Please sign in to comment.