private void LoadProviders() { providerConcepts = new EntityLookup <Provider>(Settings.Current.Building.DestinationConnectionString, Settings.Current.Building.DestinationSchemaName); QueryDefinition provider = null; if (Settings.Current.Building.DestinationQueryDefinitions != null) { provider = Settings.Current.Building.DestinationQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); } else { provider = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); } if (provider != null) { //if (Settings.Current.Building.DestinationEngine.Database == Database.Redshift) //{ // providerConcepts.LoadFromS3(provider, provider.Providers[0], "PROVIDER.txt", new Dictionary<string, int> // { // {"PROVIDER_ID", 0}, // {"SPECIALTY_SOURCE_VALUE", 1}, // {"CARE_SITE_ID", 2}, // {"PROVIDER_SOURCE_VALUE", 3} // }); //} //else providerConcepts.Load(provider, provider.Providers[0]); } FlushProvidersToCommonVocab(); }
public void CreateEntityLookup(bool lookupCreated) { LoadEntityLookup(); if (Settings.Current.Builder.IsLead && !lookupCreated) { var provider = Settings.Current.Building.SourceQueryDefinitions.FirstOrDefault(qd => qd.Providers != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor)); if (provider != null) { providerConcepts.Load(provider, provider.Providers[0]); } var saver = Settings.Current.Building.DestinationEngine.GetSaver(); using (saver.Create(Settings.Current.Building.DestinationConnectionString)) { saver.SaveEntityLookup(locationConcepts.Lookup.Values.ToList(), organizationConcepts.Lookup.Values.ToList(), careSiteConcepts.Lookup.Values.ToList(), providerConcepts.Lookup.Values.ToList()); } if (Settings.Current.StoreToAPS) { var aps = new APSDatabaseEngine(); var apsSaver = aps.GetSaver(); using (apsSaver.Create(Settings.Current.APSConnectionString)) { apsSaver.SaveEntityLookup(locationConcepts.Lookup.Values.ToList(), organizationConcepts.Lookup.Values.ToList(), careSiteConcepts.Lookup.Values.ToList(), providerConcepts.Lookup.Values.ToList()); } } } LoadProviders(); }
private void LoadEntityLookup() { var connection = Settings.Current.Building.SourceConnectionString; var queryDefinitions = Settings.Current.Building.SourceQueryDefinitions; var schemaName = Settings.Current.Building.SourceSchemaName; locationConcepts = new EntityLookup <Location>(connection, schemaName); organizationConcepts = new EntityLookup <Organization>(connection, schemaName); careSiteConcepts = new EntityLookup <CareSite>(connection, schemaName); providerConcepts = new EntityLookup <Provider>(connection, schemaName); var location = queryDefinitions.FirstOrDefault(qd => qd.Locations != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor)); if (location != null) { locationConcepts.Load(location, location.Locations[0]); } if (locationConcepts.Lookup.Count == 0) { locationConcepts.Lookup.Add("0", new Location { Id = 1 }); } var organization = queryDefinitions.FirstOrDefault(qd => qd.Organizations != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor)); if (organization != null) { organizationConcepts.Load(organization, organization.Organizations[0]); } if (organizationConcepts.Lookup.Count == 0) { organizationConcepts.Lookup.Add("0", new Organization { Id = 0, LocationId = 0, ConceptId = 0, SourceValue = string.Empty }); } var careSite = queryDefinitions.FirstOrDefault(qd => qd.CareSites != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor)); if (careSite != null) { careSiteConcepts.Load(careSite, careSite.CareSites[0]); } if (careSiteConcepts.Lookup.Count == 0) { careSiteConcepts.Lookup.Add("0", new CareSite { Id = 0, LocationId = 0, OrganizationId = 0, PlaceOfSvcSourceValue = null }); } }
public void CreateEntityLookup() { LoadEntityLookup(); if (Settings.Current.Builder.IsLead) { var provider = Settings.Current.Building.SourceQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); if (provider != null) { providerConcepts.Load(provider, provider.Providers[0]); } SaveEntityLookup(true); } LoadProviders(); }
public void Initialize() { var folder = Settings.Current.Builder.Folder; lookups = new Dictionary <string, MultiLookup>(); sourceLookups = new Dictionary <string, SourceLookup>(); rfLookups = new Dictionary <string, ReferenceFileLookup>(); genderConcepts = new GenderLookup(); genderConcepts.Load(); ingredientLevel = string.IsNullOrEmpty(folder) ? new MultiLookup(Settings.Current.Building.VocabularyConnectionString, @"Common\Lookups\IngredientLevel.sql") : new MultiLookup(Settings.Current.Building.VocabularyConnectionString, Path.Combine(folder, @"Common\Lookups\IngredientLevel.sql")); ingredientLevel.Load(); foreach (var qd in Settings.Current.Building.SourceQueryDefinitions) { if (qd.Persons != null) { foreach (var d in qd.Persons) { d.Vocabulary = this; } } Load(folder, qd.ConditionOccurrence); Load(folder, qd.DrugExposure); Load(folder, qd.ProcedureOccurrence); Load(folder, qd.Observation); Load(folder, qd.VisitOccurrence); Load(folder, qd.CareSites); Load(folder, qd.Providers); Load(folder, qd.ProcedureCost); Load(folder, qd.Death); } locationConcepts = new EntityLookup <Location>(Settings.Current.Building.DestinationConnectionString); var location = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Locations != null); if (location != null) { locationConcepts.Load(location, location.Locations[0]); } }
private void LoadProviders() { providerConcepts = new EntityLookup <Provider>(Settings.Current.Building.DestinationConnectionString, Settings.Current.Building.DestinationSchemaName); QueryDefinition provider = null; if (Settings.Current.Building.DestinationQueryDefinitions != null) { provider = Settings.Current.Building.DestinationQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); } else { provider = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); } if (provider != null) { providerConcepts.Load(provider, provider.Providers[0]); } FlushProvidersToCommonVocab(); }
public void Initialize() { var folder = Settings.Current.Builder.Folder; lookups = new Dictionary<string, MultiLookup>(); sourceLookups = new Dictionary<string, SourceLookup>(); rfLookups = new Dictionary<string, ReferenceFileLookup>(); genderConcepts = new GenderLookup(); genderConcepts.Load(); ingredientLevel = string.IsNullOrEmpty(folder) ? new MultiLookup(Settings.Current.Building.VocabularyConnectionString, @"Common\Lookups\IngredientLevel.sql") : new MultiLookup(Settings.Current.Building.VocabularyConnectionString, Path.Combine(folder, @"Common\Lookups\IngredientLevel.sql")); ingredientLevel.Load(); foreach (var qd in Settings.Current.Building.SourceQueryDefinitions) { if (qd.Persons != null) { foreach (var d in qd.Persons) { d.Vocabulary = this; } } Load(folder, qd.ConditionOccurrence); Load(folder, qd.DrugExposure); Load(folder, qd.ProcedureOccurrence); Load(folder, qd.Observation); Load(folder, qd.VisitOccurrence); Load(folder, qd.CareSites); Load(folder, qd.Providers); Load(folder, qd.ProcedureCost); Load(folder, qd.Death); } locationConcepts = new EntityLookup<Location>(Settings.Current.Building.DestinationConnectionString); var location = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Locations != null); if (location != null) { locationConcepts.Load(location, location.Locations[0]); } }
private void LoadProviders() { providerConcepts = new EntityLookup<Provider>(Settings.Current.Building.DestinationConnectionString); QueryDefinition provider = null; if (Settings.Current.Building.DestinationQueryDefinitions != null) { provider = Settings.Current.Building.DestinationQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); } else { provider = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Providers != null); } if (provider != null) { providerConcepts.Load(provider, provider.Providers[0]); } FlushProvidersToCommonVocab(); }
private void LoadEntityLookup() { var connection = Settings.Current.Building.SourceConnectionString; var queryDefinitions = Settings.Current.Building.SourceQueryDefinitions; locationConcepts = new EntityLookup<Location>(connection); organizationConcepts = new EntityLookup<Organization>(connection); careSiteConcepts = new EntityLookup<CareSite>(connection); providerConcepts = new EntityLookup<Provider>(connection); var location = queryDefinitions.FirstOrDefault(qd => qd.Locations != null); if (location != null) { locationConcepts.Load(location, location.Locations[0]); } if (locationConcepts.Lookup.Count == 0) locationConcepts.Lookup.Add("0", new Location {Id = 1}); var organization = queryDefinitions.FirstOrDefault(qd => qd.Organizations != null); if (organization != null) { organizationConcepts.Load(organization, organization.Organizations[0]); } if (organizationConcepts.Lookup.Count == 0) organizationConcepts.Lookup.Add("0", new Organization {Id = 0, LocationId = 0, ConceptId = 0, SourceValue = string.Empty}); var careSite = queryDefinitions.FirstOrDefault(qd => qd.CareSites != null); if (careSite != null) { careSiteConcepts.Load(careSite, careSite.CareSites[0]); } if (careSiteConcepts.Lookup.Count == 0) careSiteConcepts.Lookup.Add("0", new CareSite {Id = 0, LocationId = 0, OrganizationId = 0, PlaceOfSvcSourceValue = null}); }
public void Initialize() { var folder = Settings.Current.Builder.Folder; lookups = new Dictionary <string, MultiLookup>(); sourceLookups = new Dictionary <string, SourceLookup>(); rfLookups = new Dictionary <string, ReferenceFileLookup>(); genderConcepts = new GenderLookup(); genderConcepts.Load(); var ingredientLevelFile = Settings.Current.Building.CDM.GetAttribute <IngredientLevelFileAttribute>().Value; var vendorIngredientLevelFile = Settings.Current.Building.Vendor.GetAttribute <IngredientLevelFileAttribute>(); if (vendorIngredientLevelFile != null) { ingredientLevelFile = vendorIngredientLevelFile.Value; } ingredientLevel = string.IsNullOrEmpty(folder) ? new MultiLookup(Settings.Current.Building.VocabularyConnectionString, @"Common\Lookups\" + ingredientLevelFile, Settings.Current.Building.VocabularySchemaName) : new MultiLookup(Settings.Current.Building.VocabularyConnectionString, Path.Combine(folder, @"Common\Lookups\" + ingredientLevelFile), Settings.Current.Building.VocabularySchemaName); ingredientLevel.Load(); foreach (var qd in Settings.Current.Building.SourceQueryDefinitions) { if (qd.Persons != null) { foreach (var d in qd.Persons) { d.Vocabulary = this; } } Load(folder, qd.ConditionOccurrence); Load(folder, qd.DrugExposure); Load(folder, qd.ProcedureOccurrence); Load(folder, qd.Observation); Load(folder, qd.VisitOccurrence); Load(folder, qd.CareSites); Load(folder, qd.Providers); Load(folder, qd.Death); Load(folder, qd.Measurement); Load(folder, qd.DeviceExposure); Load(folder, qd.Note); Load(folder, qd.VisitCost); Load(folder, qd.ProcedureCost); Load(folder, qd.DeviceCost); Load(folder, qd.ObservationCost); Load(folder, qd.MeasurementCost); Load(folder, qd.DrugCost); } locationConcepts = new EntityLookup <Location>(Settings.Current.Building.DestinationConnectionString, Settings.Current.Building.DestinationSchemaName); var location = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Locations != null); if (location != null) { //if (Settings.Current.Building.DestinationEngine.Database == Database.Redshift) //{ // locationConcepts.LoadFromS3(location, location.Locations[0], "LOCATION.txt", new Dictionary<string, int> // { // {"LOCATION_ID", 0}, // {"STATE", 1}, // {"LOCATION_SOURCE_VALUE", 2} // }); //} //else { locationConcepts.Load(location, location.Locations[0]); } } }