in src/FhirImporter/FhirImportReferenceConverter.cs [58:87]
private static Dictionary<string, IdTypePair> CreateUUIDLookUpTable(JObject bundle)
{
Dictionary<string, IdTypePair> table = new Dictionary<string, IdTypePair>();
JArray entry = (JArray)bundle["entry"];
if (entry == null)
{
throw new ArgumentException("Unable to find bundle entries for creating lookup table");
}
try
{
foreach (var resourceWrapper in entry)
{
var resource = resourceWrapper["resource"];
var fullUrl = (string)resourceWrapper["fullUrl"];
var resourceType = (string)resource["resourceType"];
var id = (string)resource["id"];
table.Add(fullUrl, new IdTypePair { ResourceType = resourceType, Id = id });
}
}
catch
{
Console.WriteLine("Error parsing resources in bundle");
throw;
}
return table;
}