public DataTable getTrialDataProvenanceInfo(NBIAQueryParameters queryParameters, string endPointUrl) { _queryParameters = queryParameters; DataTable dataTable = null; NBIAService.CQLQueryResults result = getTrialDataProvenanceCQLInfo(endPointUrl); if (result != null && result.Items != null && result.Items.Length > 0) { dataTable = this.processCQLObjectResult(result); } return(dataTable); }
protected DataTable processCQLObjectResult(NBIAService.CQLQueryResults response) { HashSet <string> uids = new HashSet <string>(); DataTable table = new DataTable(); foreach (CQLAttributeResult result in response.Items) { bool addRow = true; DataRow dr = table.NewRow(); foreach (TargetAttribute attr in result.Attribute) { if (!attr.name.Contains("xmlns")) { if (!table.Columns.Contains(attr.name)) { DataColumn dc = new DataColumn(); dc.DataType = System.Type.GetType("System.String"); dc.ColumnName = attr.name; table.Columns.Add(dc); } // NCIA/NBIA has fixed the study duplication problem. // We keep this line just in case it comes back again. if (attr.name.Equals("studyInstanceUID")) { if (uids.Add(attr.value)) { dr[attr.name] = attr.value; } else { addRow = false; break; } } else { dr[attr.name] = attr.value; } } } if (addRow) { table.Rows.Add(dr); } } return(table); }