93 lines
2.5 KiB
C#
93 lines
2.5 KiB
C#
<Query Kind="Program">
|
|
<NuGetReference>LinqToCsv</NuGetReference>
|
|
<Namespace>LINQtoCSV</Namespace>
|
|
<Namespace>Newtonsoft.Json</Namespace>
|
|
</Query>
|
|
|
|
void Main()
|
|
{
|
|
var thefile = @"D:\Users\tlamb\Downloads\DimCaseType QA Master.csv";
|
|
var csvdata = File.ReadAllLines(thefile);
|
|
//csvdata.Dump();
|
|
var inputFileDescription = new CsvFileDescription
|
|
{
|
|
SeparatorChar = ',',
|
|
FirstLineHasColumnNames = false,
|
|
EnforceCsvColumnAttribute = true,
|
|
IgnoreUnknownColumns = true,
|
|
UseFieldIndexForReadingData = true
|
|
};
|
|
var cc = new CsvContext();
|
|
var data = cc.Read<DimCaseType>(thefile, inputFileDescription).ToList();
|
|
//data.Dump();
|
|
string.Join("\r\n",
|
|
data.ConvertAll(d => $"UPDATE dss.DimCaseType SET CaseTypeConfigJSON = '{d.CaseTypeConfigJSON}' WHERE Name = '{d.Name}' and CaseTypeID = {d.CaseTypeID};")).Dump();
|
|
}
|
|
|
|
// Define other methods and classes here
|
|
public class DimCaseType
|
|
{
|
|
[CsvColumn(FieldIndex = 1)]
|
|
public int CaseTypeID { get; set; }
|
|
[CsvColumn(FieldIndex = 2)]
|
|
public string Name { get; set; }
|
|
[CsvColumn(FieldIndex = 3)]
|
|
public string CaseTypeConfigJSON { get; set; }
|
|
//public MSDRGCaseTypeConfiguration CaseTypeConfig => JsonConvert.DeserializeObject<MSDRGCaseTypeConfiguration>(CaseTypeConfigJSON);
|
|
}
|
|
|
|
public class CaseTypeConfiguration
|
|
{
|
|
public int PhysicianMinVolume { get; set; } = 0;
|
|
}
|
|
|
|
public class DRGCaseTypeConfiguration : CaseTypeConfiguration
|
|
{
|
|
public List<int> AgeCohortIDInclusions { get; set; } = new List<int>();
|
|
public List<int> PhysicianIDExclusions { get; set; } = new List<int>();
|
|
public StandardDeviationExclusions StandardDeviationExcludedTypeEnum { get; set; } = StandardDeviationExclusions.None;
|
|
public int LengthOfStayThreshold { get; set; } = 0;
|
|
public HashSet<string> CPTCodes { get; set; } = new HashSet<string>();
|
|
public List<int> PatientTypeRollupIDInclusions { get; set; } = new List<int>();
|
|
}
|
|
|
|
public class MSDRGCaseTypeConfiguration : DRGCaseTypeConfiguration
|
|
#pragma warning restore S101 // Types should be named in PascalCase
|
|
{
|
|
public HashSet<CCMCCCategoryTypes> CCMCCCategories { get; set; } = new HashSet<CCMCCCategoryTypes>();
|
|
|
|
}
|
|
|
|
public enum CCMCCCategoryTypes
|
|
#pragma warning restore S2342 // Enumeration types should comply with a naming convention
|
|
{
|
|
None,
|
|
CC,
|
|
MCC,
|
|
WO,
|
|
NA,
|
|
CCMCC
|
|
}
|
|
|
|
public enum StandardDeviationExclusions
|
|
{
|
|
None = 0,
|
|
TwoStdDev = 1,
|
|
ThreeStdDev = 2,
|
|
CustomLOSOutlier = 3
|
|
}
|
|
|
|
public enum PhysicianGroupingTypes
|
|
{
|
|
Physician = 0,
|
|
Specialty = 1,
|
|
GroupAffiliation = 2
|
|
}
|
|
|
|
public enum CaseTypeCategories
|
|
{
|
|
MSDRG = 0,
|
|
APRDRG = 1,
|
|
PatientPopulation = 2
|
|
}
|