77b65bea-e766-4e3c-a1ed-c4c2534b6019 true D0001-SQL-01.sdt.local jazz dev master true <ProgramFilesX64>\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\plugins\Diagnostics\Newtonsoft.Json.dll Amazon.Lambda.S3Events AWSSDK.Core AWSSDK.S3 Amazon Amazon.Auth.AccessControlPolicy Amazon.Auth.AccessControlPolicy.ActionIdentifiers Amazon.Internal Amazon.Lambda.S3Events Amazon.MissingTypes Amazon.Runtime Amazon.Runtime.CredentialManagement Amazon.Runtime.CredentialManagement.Internal Amazon.Runtime.EventStreams Amazon.Runtime.EventStreams.Internal Amazon.Runtime.Internal Amazon.Runtime.Internal.Auth Amazon.Runtime.Internal.Settings Amazon.Runtime.Internal.Transform Amazon.Runtime.Internal.Util Amazon.Runtime.SharedInterfaces Amazon.Runtime.SharedInterfaces.Internal Amazon.S3 Amazon.S3.Encryption Amazon.S3.Encryption.Internal Amazon.S3.Internal Amazon.S3.IO Amazon.S3.Model Amazon.S3.Model.Internal.MarshallTransformations Amazon.S3.Transfer Amazon.S3.Util Amazon.Util Amazon.Util.Internal Amazon.Util.Internal.PlatformServices Newtonsoft.Json Newtonsoft.Json.Converters Newtonsoft.Json.Linq Newtonsoft.Json.Schema Newtonsoft.Json.Serialization System System.ComponentModel.Composition System.ComponentModel.Composition.Hosting System.ComponentModel.Composition.Primitives System.ComponentModel.Composition.ReflectionModel System.Diagnostics System.Diagnostics.Tracing System.IO.Compression System.Net.Http System.Net.Http.Headers System.Numerics ThirdParty.BouncyCastle.Asn1 ThirdParty.BouncyCastle.Asn1.Utilities ThirdParty.BouncyCastle.Math ThirdParty.BouncyCastle.OpenSsl ThirdParty.BouncyCastle.Utilities.IO.Pem ThirdParty.Ionic.Zlib ThirdParty.Json.LitJson ThirdParty.MD5 //var reports = from report in REReports select report; //reports.Dump(); var parms = from report in REReports join module in Folders on report.FolderGUID equals module.FolderGuid into reportModules from rptModule in reportModules.DefaultIfEmpty() join setup in REDSCubeReportSetups on report.ReportGUID equals setup.ReportGUID join parameter in REDSCubeReportParameters on report.ReportGUID equals parameter.ReportGUID where parameter.Name == "Patient Populations" && parameter.ParameterXML != null && parameter.ParameterXML != "" select new { reportName = report.Name, module = rptModule.Name, //parameterName = parameter.Name, //parameter.ColumnName, parameterXML = XDocument.Parse(parameter.ParameterXML).Descendants("{http://schemas.datacontract.org/2004/07/Strata.CS.Jazz.Biz.Reporting.Parameters}DSCubeSearchCondition"), Value = XDocument.Parse(parameter.ParameterXML).Descendants("{http://schemas.datacontract.org/2004/07/Strata.CS.Jazz.Biz.Reporting.Parameters}Value"), ValueIds = XDocument.Parse(parameter.ParameterXML).Descendants("{http://schemas.datacontract.org/2004/07/Strata.CS.Jazz.Biz.Reporting.Parameters}ValueIDArray") }; parms.ToList().Where(p => p.parameterXML.Any()).OrderBy(r => r.reportName) .Select(p => new { p.reportName, p.module, values = p.Value.FirstOrDefault()?.Value.Split(new[] { ',' }).Select(v => v.Trim()), valueIds = p.ValueIds.Descendants().Select(vi => vi.Value) }).Dump(); var mappings = parms.ToList().Where(p => p.parameterXML.Any()).ToList() .SelectMany(p => from ci in DimClinicalIndicators join def in Definitions on ci.Name equals def.Name where p.ValueIds.Descendants().Select(vi => Regex.Replace(vi.Value, @"[^\d]", "")).ToList().Contains(ci.ClinicalIndicatorID.ToString()) select new { id = ci.ClinicalIndicatorID, Guid = ci.MemberGUID, name = ci.Name, definitionGuid = def.Id } ).Distinct().OrderBy(p => p.name); mappings.Dump(); var sql = "INSERT INTO dbo.StandardDefinitionMapping ( StandardDefinitionGUID, StandardDefinitionName, StandardDefinitionType, MappingMemberValue )\r\nValues " + string.Join(",\r\n ", mappings.Select(y => $"('{y.definitionGuid}','[Patient Populations].[Patient Populations].&[{y.id}]','Patient Populations','{y.name}')")); sql.Dump();