diff --git a/BaseAssembly/Assign/RAuntNiece.cs b/BaseAssembly/Assign/RAuntNiece.cs index a6ccff8..04ad1a1 100644 --- a/BaseAssembly/Assign/RAuntNiece.cs +++ b/BaseAssembly/Assign/RAuntNiece.cs @@ -66,7 +66,7 @@ public RAuntNiece ( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow dr _dsLinks = dsLinks; _idRelatedLeft = drLeft.ID; - if ( CommonCalculations.GenerationOfSubjectTag(drLeft.SubjectTag_S1) == Generation.Gen1 ) { + if ( CommonCalculations.GenerationOfSubjectTag(drLeft.SubjectTag_S1) == Sample.Nlsy79Gen1 ) { _drBareAunt = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1); _drBareNiece = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2); } @@ -74,8 +74,8 @@ public RAuntNiece ( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow dr _drBareAunt = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2); _drBareNiece = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1); } - Trace.Assert(_drBareAunt.Generation == (byte)Generation.Gen1, "The generation should not be the same for a aunt-niece relationship."); - Trace.Assert(_drBareNiece.Generation == (byte)Generation.Gen2, "The generation should not be the same for a aunt-niece relationship."); + Trace.Assert(_drBareAunt.Generation == (byte)Sample.Nlsy79Gen1, "The generation should not be the same for a aunt-niece relationship."); + Trace.Assert(_drBareNiece.Generation == (byte)Sample.Nlsy79Gen2, "The generation should not be the same for a aunt-niece relationship."); _multipleBirth = MultipleBirth.No; _isMZ = Tristate.No; diff --git a/BaseAssembly/Assign/RGen2Cousins.cs b/BaseAssembly/Assign/RGen2Cousins.cs index de98fae..c4823e8 100644 --- a/BaseAssembly/Assign/RGen2Cousins.cs +++ b/BaseAssembly/Assign/RGen2Cousins.cs @@ -69,8 +69,8 @@ public RGen2Cousins ( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow _drBare1 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1); _drBare2 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2); - Trace.Assert(_drBare1.Generation == (byte)Generation.Gen2, "The generation should be Gen2."); - Trace.Assert(_drBare2.Generation == (byte)Generation.Gen2, "The generation should be Gen2."); + Trace.Assert(_drBare1.Generation == (byte)Sample.Nlsy79Gen2, "The generation should be Gen2."); + Trace.Assert(_drBare2.Generation == (byte)Sample.Nlsy79Gen2, "The generation should be Gen2."); _multipleBirth = MultipleBirth.No; _isMZ = Tristate.No; diff --git a/BaseAssembly/BabyDaddy.cs b/BaseAssembly/BabyDaddy.cs index ba7ea01..d3c8283 100644 --- a/BaseAssembly/BabyDaddy.cs +++ b/BaseAssembly/BabyDaddy.cs @@ -43,7 +43,7 @@ public string Go ( ) { LinksDataSet.tblResponseDataTable dtExtendedResponse = Retrieve.ExtendedFamilyRelevantResponseRows(extendedID, _itemIDsString, minRowCount, _ds.tblResponse); LinksDataSet.tblSubjectRow[] subjectsInExtendedFamily = Retrieve.SubjectsInExtendFamily(extendedID, _ds.tblSubject); foreach ( LinksDataSet.tblSubjectRow drSubject in subjectsInExtendedFamily ) { - if ( (Generation)drSubject.Generation == Generation.Gen2 ) { + if ( (Sample)drSubject.Generation == Sample.Nlsy79Gen2 ) { Int32 recordsAddedForLoop = ProcessSubjectGen2(drSubject, dtExtendedResponse); Interlocked.Add(ref recordsAddedTotal, recordsAddedForLoop); } diff --git a/BaseAssembly/CommonCalculations.cs b/BaseAssembly/CommonCalculations.cs index c660516..7edcb67 100644 --- a/BaseAssembly/CommonCalculations.cs +++ b/BaseAssembly/CommonCalculations.cs @@ -10,12 +10,12 @@ public static Int32 PermutationOf2 ( Int32 topValue ) { return topValue * (topValue - 1); } //public static Int32 CombinationOf2 ( Int16 topValue ) { return PermutationOf2(topValue) / 2;//Integer division //} - public static Generation GenerationOfSubjectTag ( Int32 subjectTag ) { + public static Sample GenerationOfSubjectTag ( Int32 subjectTag ) { double remainder = Math.IEEERemainder(subjectTag, 100); if ( remainder == 0 ) - return Generation.Gen1; + return Sample.Nlsy79Gen1; else - return Generation.Gen2; + return Sample.Nlsy79Gen2; } public static Int16 MotherIDOfGen2Subject ( Int32 gen2SubjectID ) { Trace.Assert(Constants.Gen2IDMin <= gen2SubjectID && gen2SubjectID <= Constants.Gen2IDMax, "The SubjectID should be valid for Generation 2."); diff --git a/BaseAssembly/CommonFunctions.cs b/BaseAssembly/CommonFunctions.cs index b6f6b02..973271b 100644 --- a/BaseAssembly/CommonFunctions.cs +++ b/BaseAssembly/CommonFunctions.cs @@ -77,7 +77,7 @@ public static Tristate TranslateYesNo ( YesNo yn ) { //} public static byte LastTwoDigitsOfGen2SubjectID ( LinksDataSet.tblSubjectRow drSubject ) { if ( drSubject == null ) throw new ArgumentNullException("drSubject"); - if ( drSubject.Generation != (byte)Generation.Gen2 ) throw new ArgumentOutOfRangeException("drSubject", drSubject.Generation, "This function is valid for only Gen2 subjects."); + if ( drSubject.Generation != (byte)Sample.Nlsy79Gen2 ) throw new ArgumentOutOfRangeException("drSubject", drSubject.Generation, "This function is valid for only Gen2 subjects."); string subjectIDString = drSubject.SubjectID.ToString(); Int32 startIndex = subjectIDString.Length - 2; return Convert.ToByte(subjectIDString.Substring(startIndex)); @@ -92,7 +92,7 @@ public static Int16[] CreateExtendedFamilyIDs ( LinksDataSet dsLinks ) { internal static bool BothGen1 ( LinksDataSet.tblSubjectRow drSubject1, LinksDataSet.tblSubjectRow drSubject2 ) { if ( drSubject1 == null ) throw new ArgumentNullException("drSubject1"); if ( drSubject2 == null ) throw new ArgumentNullException("drSubject2"); - return drSubject1.Generation == (byte)Generation.Gen1 && drSubject2.Generation == (byte)Generation.Gen1; + return drSubject1.Generation == (byte)Sample.Nlsy79Gen1 && drSubject2.Generation == (byte)Sample.Nlsy79Gen1; } //internal static bool BothGen1 ( LinksDataSet.tblRelatedRow drRelated ) { // if ( drRelated == null ) throw new ArgumentNullException("drRelated"); diff --git a/BaseAssembly/EnumLookupTables.cs b/BaseAssembly/EnumLookupTables.cs index dede189..acb97cf 100644 --- a/BaseAssembly/EnumLookupTables.cs +++ b/BaseAssembly/EnumLookupTables.cs @@ -181,9 +181,10 @@ public enum SurveySource : byte { Gen2C = 2, Gen2YA = 3, } - public enum Generation : byte { - Gen1 = 1, - Gen2 = 2, + public enum Sample : byte { + Nlsy79Gen1 = 1, + Nlsy79Gen2 = 2, + Nlsy97 = 3, } public enum MultipleBirth : byte {// 'Keep these values sync'ed with tblLUMultipleBirth in the database. No = 0, diff --git a/BaseAssembly/FatherOfGen2.cs b/BaseAssembly/FatherOfGen2.cs index 90ab150..c7e7d4c 100644 --- a/BaseAssembly/FatherOfGen2.cs +++ b/BaseAssembly/FatherOfGen2.cs @@ -37,7 +37,7 @@ public string Go ( ) { LinksDataSet.tblResponseDataTable dtExtendedResponse = Retrieve.ExtendedFamilyRelevantResponseRows(extendedID, _itemIDsString, minRowCount, _ds.tblResponse); LinksDataSet.tblSubjectRow[] subjectsInExtendedFamily = Retrieve.SubjectsInExtendFamily(extendedID, _ds.tblSubject); foreach ( LinksDataSet.tblSubjectRow drSubject in subjectsInExtendedFamily ) { - if ( (Generation)drSubject.Generation == Generation.Gen2 ) { + if ( (Sample)drSubject.Generation == Sample.Nlsy79Gen2 ) { Int32 recordsAddedForLoop = ProcessSubjectGen2(drSubject, dtExtendedResponse); Interlocked.Add(ref recordsAddedTotal, recordsAddedForLoop); } diff --git a/BaseAssembly/Mob.cs b/BaseAssembly/Mob.cs index 6df3718..e0abeb9 100644 --- a/BaseAssembly/Mob.cs +++ b/BaseAssembly/Mob.cs @@ -8,8 +8,8 @@ public static class Mob { if ( drSubject == null ) throw new ArgumentNullException("drSubject"); const Int32 maxRows = 1; - switch ( (Generation)drSubject.Generation ) { - case Generation.Gen1: + switch ( (Sample)drSubject.Generation ) { + case Sample.Nlsy79Gen1: const SurveySource sourceGen1 = SurveySource.Gen1; Int32? monthGen1 = Nls.BaseAssembly.Retrieve.ResponseNullPossible(Constants.Gen1MobSurveyYearPreferred, Item.DateOfBirthMonth, sourceGen1, drSubject.SubjectTag, maxRows, dt); Int32 yearGen1 = Int32.MinValue; @@ -22,7 +22,7 @@ public static class Mob { yearGen1 = Nls.BaseAssembly.Retrieve.Response(Constants.Gen1MobSurveyYearBackup, Item.DateOfBirthYearGen1, drSubject.SubjectTag, maxRows, dt); } return CalculateMobForGen1(monthGen1.Value, yearGen1); - case Generation.Gen2: + case Sample.Nlsy79Gen2: if ( OverridesGen2.MissingMobInvalidSkip.Contains(drSubject.SubjectID) ) return null; const SurveySource sourceGen2 = SurveySource.Gen2C; diff --git a/BaseAssembly/Outcome.cs b/BaseAssembly/Outcome.cs index a4cc8eb..d46c95c 100644 --- a/BaseAssembly/Outcome.cs +++ b/BaseAssembly/Outcome.cs @@ -71,9 +71,9 @@ public string Go( ) { private Int32 ProcessSubject( LinksDataSet.tblSubjectRow drSubject, LinksDataSet.tblResponseDataTable dtExtended ) { const Int32 minRowCount=0; string itemString = ""; - if( drSubject.Generation == (byte)Generation.Gen1 ) + if( drSubject.Generation == (byte)Sample.Nlsy79Gen1 ) itemString = _itemIDsStringGen1; - else if( drSubject.Generation == (byte)Generation.Gen2 ) + else if( drSubject.Generation == (byte)Sample.Nlsy79Gen2 ) itemString = _itemIDsStringGen2; else throw new InvalidOperationException("The execution should not have gotten here. The value of Generation was not recognized."); diff --git a/BaseAssembly/PairR.cs b/BaseAssembly/PairR.cs index b375581..866ba78 100644 --- a/BaseAssembly/PairR.cs +++ b/BaseAssembly/PairR.cs @@ -41,8 +41,8 @@ public PairR ( Int32 subjectTag1, Int32 subjectTag2, Int32 relatedID, float? r ) _isInterpolated = false; } public static PairR[] BuildRelatedPairsOfGen1Housemates ( DataColumn dcPass1, Int32 subjectTag1, Int32 subjectTag2, Int32 extendedID, LinksDataSet ds ) { - if ( CommonCalculations.GenerationOfSubjectTag(subjectTag1) != Generation.Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag1 isn't Gen1."); - if ( CommonCalculations.GenerationOfSubjectTag(subjectTag2) != Generation.Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag2 isn't Gen1."); + if ( CommonCalculations.GenerationOfSubjectTag(subjectTag1) != Sample.Nlsy79Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag1 isn't Gen1."); + if ( CommonCalculations.GenerationOfSubjectTag(subjectTag2) != Sample.Nlsy79Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag2 isn't Gen1."); if ( dcPass1 == null ) throw new ArgumentNullException("dcPass1"); switch ( dcPass1.ColumnName ) { case "RImplicitPass1": @@ -77,8 +77,8 @@ public static PairR[] BuildRelatedPairsOfGen1Housemates ( DataColumn dcPass1, In return pairs; } public static PairR[] BuildRelatedPairsOfGen2Sibs ( DataColumn dcPass1, Int32 subjectTag1, Int32 subjectTag2, Int32 extendedID, LinksDataSet ds ) { - if ( CommonCalculations.GenerationOfSubjectTag(subjectTag1) != Generation.Gen2 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag1 isn't Gen2."); - if ( CommonCalculations.GenerationOfSubjectTag(subjectTag2) != Generation.Gen2 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag2 isn't Gen2."); + if ( CommonCalculations.GenerationOfSubjectTag(subjectTag1) != Sample.Nlsy79Gen2 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag1 isn't Gen2."); + if ( CommonCalculations.GenerationOfSubjectTag(subjectTag2) != Sample.Nlsy79Gen2 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag2 isn't Gen2."); if ( dcPass1 == null ) throw new ArgumentNullException("dcPass1"); switch ( dcPass1.ColumnName ) { case "RImplicitPass1": diff --git a/BaseAssembly/PairShare.cs b/BaseAssembly/PairShare.cs index 389f9ea..b7cbd3f 100644 --- a/BaseAssembly/PairShare.cs +++ b/BaseAssembly/PairShare.cs @@ -41,8 +41,8 @@ public PairShare ( Int32 subjectTag1, Int32 subjectTag2, Int32 relatedID, Trista _isInterpolated = false; } public static PairShare[] BuildRelatedPairsOfGen1Housemates ( DataColumn dcPass1, Int32 subjectTag1, Int32 subjectTag2, Int32 extendedID, LinksDataSet ds ) { - if ( CommonCalculations.GenerationOfSubjectTag(subjectTag1) != Generation.Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag1 isn't Gen1."); - if ( CommonCalculations.GenerationOfSubjectTag(subjectTag2) != Generation.Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag2 isn't Gen1."); + if ( CommonCalculations.GenerationOfSubjectTag(subjectTag1) != Sample.Nlsy79Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag1 isn't Gen1."); + if ( CommonCalculations.GenerationOfSubjectTag(subjectTag2) != Sample.Nlsy79Gen1 ) throw new ArgumentOutOfRangeException("The generation implied by subjectTag2 isn't Gen1."); if ( dcPass1 == null ) throw new ArgumentNullException("dcPass1"); switch ( dcPass1.ColumnName ) { case "ImplicitShareBiomomPass1": diff --git a/BaseAssembly/ParentsOfGen1Current.cs b/BaseAssembly/ParentsOfGen1Current.cs index db7cf1b..95bcbf0 100644 --- a/BaseAssembly/ParentsOfGen1Current.cs +++ b/BaseAssembly/ParentsOfGen1Current.cs @@ -45,7 +45,7 @@ public string Go ( ) { LinksDataSet.tblResponseDataTable dtExtendedResponse = Retrieve.ExtendedFamilyRelevantResponseRows(extendedID, _itemIDsString, minRowCount, _ds.tblResponse); LinksDataSet.tblSubjectRow[] subjectsInExtendedFamily = Retrieve.SubjectsInExtendFamily(extendedID, _ds.tblSubject); foreach ( LinksDataSet.tblSubjectRow drSubject in subjectsInExtendedFamily ) { - if ( (Generation)drSubject.Generation == Generation.Gen1 ) { + if ( (Sample)drSubject.Generation == Sample.Nlsy79Gen1 ) { Int32 recordsAddedForLoop = ProcessSubjectGen1(drSubject, dtExtendedResponse); Interlocked.Add(ref recordsAddedTotal, recordsAddedForLoop); } diff --git a/BaseAssembly/ParentsOfGen1Retro.cs b/BaseAssembly/ParentsOfGen1Retro.cs index e179a94..2a1c9b5 100644 --- a/BaseAssembly/ParentsOfGen1Retro.cs +++ b/BaseAssembly/ParentsOfGen1Retro.cs @@ -41,7 +41,7 @@ public string Go ( ) { LinksDataSet.tblResponseDataTable dtExtendedResponse = Retrieve.ExtendedFamilyRelevantResponseRows(extendedID, _itemIDsString, minRowCount, _ds.tblResponse); LinksDataSet.tblSubjectRow[] subjectsInExtendedFamily = Retrieve.SubjectsInExtendFamily(extendedID, _ds.tblSubject); foreach ( LinksDataSet.tblSubjectRow drSubject in subjectsInExtendedFamily ) { - if ( (Generation)drSubject.Generation == Generation.Gen1 ) { + if ( (Sample)drSubject.Generation == Sample.Nlsy79Gen1 ) { Int32 recordsAddedForLoop = ProcessSubjectGen1(drSubject, dtExtendedResponse); Interlocked.Add(ref recordsAddedTotal, recordsAddedForLoop); } diff --git a/BaseAssembly/RelatedStructure.cs b/BaseAssembly/RelatedStructure.cs index e8368f8..952e9b1 100644 --- a/BaseAssembly/RelatedStructure.cs +++ b/BaseAssembly/RelatedStructure.cs @@ -73,10 +73,10 @@ private Int32 ProcessPair ( LinksDataSet.tblSubjectRow drSubject1, Int16 extende } private static RelationshipPath GetRelationshipPath ( LinksDataSet.tblSubjectRow drSubject1, LinksDataSet.tblSubjectRow drSubject2 ) { Trace.Assert(drSubject1.ExtendedID == drSubject2.ExtendedID, "The two subject should be in the same extended family."); - if ( drSubject1.Generation == (byte)Generation.Gen1 && drSubject2.Generation == (byte)Generation.Gen1 ) { + if ( drSubject1.Generation == (byte)Sample.Nlsy79Gen1 && drSubject2.Generation == (byte)Sample.Nlsy79Gen1 ) { return RelationshipPath.Gen1Housemates; } - else if ( drSubject1.Generation == (byte)Generation.Gen2 && drSubject2.Generation == (byte)Generation.Gen2 ) { + else if ( drSubject1.Generation == (byte)Sample.Nlsy79Gen2 && drSubject2.Generation == (byte)Sample.Nlsy79Gen2 ) { if ( CommonCalculations.Gen2SubjectsHaveCommonMother(drSubject1.SubjectID, drSubject2.SubjectID) ) return RelationshipPath.Gen2Siblings; else return RelationshipPath.Gen2Cousins; } diff --git a/BaseAssembly/Response.cs b/BaseAssembly/Response.cs index 832c2b1..190e9a2 100644 --- a/BaseAssembly/Response.cs +++ b/BaseAssembly/Response.cs @@ -34,21 +34,21 @@ public string Go ( ) { sw.Start(); CheckVariableExistInImportedDataTables(); Int32 reponseRecordsAddedCount = 0; - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Links, Generation.Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen1Links); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Explicit, Generation.Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen1Explicit); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Implicit, Generation.Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen1Implicit); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2Links, Generation.Gen2, false, Constants.Gen2PassoverResponses, _dsImport.tblGen2Links); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2LinksFromGen1, Generation.Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen2LinksFromGen1); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2ImplicitFather, Generation.Gen2, false, Constants.Gen2PassoverResponses, _dsImport.tblGen2ImplicitFather); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2FatherFromGen1, Generation.Gen1, true, Constants.Gen1PassoverResponses, _dsImport.tblGen2FatherFromGen1); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Outcomes, Generation.Gen1, false, Constants.Gen1PassoverResponsesNoNegatives, _dsImport.tblGen1Outcomes); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2OutcomesHeight, Generation.Gen2, false, Constants.Gen2PassoverResponseNoNegatives, _dsImport.tblGen2OutcomesHeight); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2OutcomesWeight, Generation.Gen2, false, Constants.Gen2PassoverResponseNoNegatives, _dsImport.tblGen2OutcomesWeight); - reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2OutcomesMath, Generation.Gen2, false, Constants.Gen2PassoverResponseNoNegatives, _dsImport.tblGen2OutcomesMath); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Links, Sample.Nlsy79Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen1Links); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Explicit, Sample.Nlsy79Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen1Explicit); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Implicit, Sample.Nlsy79Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen1Implicit); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2Links, Sample.Nlsy79Gen2, false, Constants.Gen2PassoverResponses, _dsImport.tblGen2Links); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2LinksFromGen1, Sample.Nlsy79Gen1, false, Constants.Gen1PassoverResponses, _dsImport.tblGen2LinksFromGen1); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2ImplicitFather, Sample.Nlsy79Gen2, false, Constants.Gen2PassoverResponses, _dsImport.tblGen2ImplicitFather); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2FatherFromGen1, Sample.Nlsy79Gen1, true, Constants.Gen1PassoverResponses, _dsImport.tblGen2FatherFromGen1); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen1Outcomes, Sample.Nlsy79Gen1, false, Constants.Gen1PassoverResponsesNoNegatives, _dsImport.tblGen1Outcomes); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2OutcomesHeight, Sample.Nlsy79Gen2, false, Constants.Gen2PassoverResponseNoNegatives, _dsImport.tblGen2OutcomesHeight); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2OutcomesWeight, Sample.Nlsy79Gen2, false, Constants.Gen2PassoverResponseNoNegatives, _dsImport.tblGen2OutcomesWeight); + reponseRecordsAddedCount += TranslateExtractSource(ExtractSource.Gen2OutcomesMath, Sample.Nlsy79Gen2, false, Constants.Gen2PassoverResponseNoNegatives, _dsImport.tblGen2OutcomesMath); sw.Stop(); return string.Format("{0:N0} response records were translated.\nElapsed time: {1}", reponseRecordsAddedCount, sw.Elapsed.ToString()); } - private Int32 TranslateExtractSource ( ExtractSource extractSource, Generation generation, bool femalesOnly, Int32[] passoverValues, DataTable dtImport ) { + private Int32 TranslateExtractSource ( ExtractSource extractSource, Sample generation, bool femalesOnly, Int32[] passoverValues, DataTable dtImport ) { Int32 gen1ReponseRecordsAddedCount = 0; LinksDataSet.tblVariableRow[] drsVariablesToTranslate = VariablesToTranslate(extractSource); _dsLinks.tblResponse.BeginLoadData(); @@ -56,11 +56,11 @@ private Int32 TranslateExtractSource ( ExtractSource extractSource, Generation g string subjectIDColumnName; string genderColumnName; switch ( generation ) { - case Generation.Gen1: + case Sample.Nlsy79Gen1: subjectIDColumnName = Constants.Gen1SubjectIDColumn; genderColumnName = Constants.Gen1GenderColumn; break; - case Generation.Gen2: + case Sample.Nlsy79Gen2: subjectIDColumnName = Constants.Gen2SubjectIDColumn; genderColumnName = Constants.Gen2GenderColumn; break; diff --git a/BaseAssembly/Retrieve.cs b/BaseAssembly/Retrieve.cs index aca641b..8153eb2 100644 --- a/BaseAssembly/Retrieve.cs +++ b/BaseAssembly/Retrieve.cs @@ -220,7 +220,7 @@ internal static EnumResponsesGen1.Gen1Roster Gen1Roster1979 ( LinksDataSet.tblRe EnumResponsesGen1.Gen1Roster relationship = (EnumResponsesGen1.Gen1Roster)drsForRoster[0].Value; return relationship; } - internal static Int32 SubjectTagFromSubjectIDAndGeneration ( Int32 subjectID, Generation generation, LinksDataSet dsLinks ) { + internal static Int32 SubjectTagFromSubjectIDAndGeneration ( Int32 subjectID, Sample generation, LinksDataSet dsLinks ) { if ( dsLinks == null ) throw new ArgumentNullException("dsLinks"); if ( dsLinks.tblSubject.Count <= 0 ) throw new InvalidOperationException("There should be more than one row in tblSubject."); @@ -246,7 +246,7 @@ internal static LinksDataSet.tblMzManualRow MzManualRecord ( LinksDataSet.tblSub DateTime? mob1 = Mob.Retrieve(dr1.SubjectTag, dsLinks.tblSubjectDetails); DateTime? mob2 = Mob.Retrieve(dr2.SubjectTag, dsLinks.tblSubjectDetails); if ( mob1.HasValue && mob2.HasValue ) { - if ( (dr1.Generation == (byte)Generation.Gen2) || (dr1.Gender == dr2.Gender) ) { + if ( (dr1.Generation == (byte)Sample.Nlsy79Gen2) || (dr1.Gender == dr2.Gender) ) { Int32 daysDifferenceAbsolute = (Int32)Math.Abs(mob2.Value.Subtract(mob1.Value).TotalDays); Trace.Assert(daysDifferenceAbsolute > Constants.MaxDaysBetweenTwinBirths, "If siblings have close birthdays, there should be a record in tblMzManual."); } diff --git a/BaseAssembly/Subject.cs b/BaseAssembly/Subject.cs index 499490d..581cf8f 100644 --- a/BaseAssembly/Subject.cs +++ b/BaseAssembly/Subject.cs @@ -19,7 +19,7 @@ public static string CreateSubject ( ImportDataSet dsImport, LinksDataSet dsLink drBare.SubjectID = (Int32)drGen1[Constants.Gen1SubjectIDColumn]; drBare.SubjectTag = drBare.SubjectID * 100;//For Gen1 subjects, append "00" at the end. drBare.ExtendedID = Convert.ToInt16(drGen1[Constants.Gen1ExtendedFamilyIDColumn]); - drBare.Generation = (byte)Generation.Gen1; + drBare.Generation = (byte)Sample.Nlsy79Gen1; drBare.Gender = Convert.ToByte(drGen1[Constants.Gen1GenderColumn]); dsLinks.tblSubject.AddtblSubjectRow(drBare); subjectRecordsAddedCount += 1; @@ -32,7 +32,7 @@ public static string CreateSubject ( ImportDataSet dsImport, LinksDataSet dsLink drBare.SubjectTag = drBare.SubjectID; Int32 motherID = drGen2.C0000200; drBare.ExtendedID = RetrieveExtendedFamilyIDFromGenMotherID(dsImport, motherID); - drBare.Generation = (byte)Generation.Gen2; + drBare.Generation = (byte)Sample.Nlsy79Gen2; Int32 genderTemp = drGen2.C0005400; if ( genderTemp == -3 ) genderTemp = (byte)Gender.InvalidSkipGen2; diff --git a/BaseAssembly/SubjectDetails.cs b/BaseAssembly/SubjectDetails.cs index 4dd9bfb..7543b23 100644 --- a/BaseAssembly/SubjectDetails.cs +++ b/BaseAssembly/SubjectDetails.cs @@ -128,7 +128,7 @@ private static DeathCondition DetermineSubjectDeath ( ) { return new DeathCondition(false , null); } private static DeathCondition DetermineBiodadDeath ( LinksDataSet.tblSubjectRow drSubject, LinksDataSet.tblResponseDataTable dtExtended ) { - if ( (Generation)drSubject.Generation == Generation.Gen1 ) + if ( (Sample)drSubject.Generation == Sample.Nlsy79Gen1 ) return new DeathCondition(null, null); Int32 motherTag = CommonCalculations.MotherTagOfGen2Subject(drSubject.SubjectID); byte? childLoop = Retrieve.MotherLoopIndexForChildTag(motherTag, drSubject, dtExtended); @@ -171,10 +171,10 @@ private byte DetermineSiblingCountInNls ( LinksDataSet.tblSubjectRow drSubject ) drSubject.Generation, _ds.tblSubject.GenerationColumn); LinksDataSet.tblSubjectRow[] drs = (LinksDataSet.tblSubjectRow[])_ds.tblSubject.Select(select); Trace.Assert(drs.Length > 0, "At least one row should be returned."); - switch ( (Generation)drSubject.Generation ) { - case Generation.Gen1: + switch ( (Sample)drSubject.Generation ) { + case Sample.Nlsy79Gen1: return (byte)drs.Length; - case Generation.Gen2: + case Sample.Nlsy79Gen2: byte siblingCount = 0; Int32 motherID = CommonCalculations.MotherIDOfGen2Subject(drSubject.SubjectTag); @@ -197,8 +197,8 @@ private BirthCondition DetermineNlsBirthOrder ( LinksDataSet.tblSubjectRow drSub bool hasMzPossibly = false; DateTime? mobOfSubject = Mob.Retrieve(drSubject, dtExtended); //There shouldn't be any missing Mobs in Gen1. - switch ( (Generation)drSubject.Generation ) { - case Generation.Gen1: + switch ( (Sample)drSubject.Generation ) { + case Sample.Nlsy79Gen1: Trace.Assert(drs.Length == siblingCountInNls, "The number of returned rows should match 'siblingCountInNls'."); foreach ( LinksDataSet.tblSubjectRow dr in drs ) { @@ -212,7 +212,7 @@ private BirthCondition DetermineNlsBirthOrder ( LinksDataSet.tblSubjectRow drSub } } break; - case Generation.Gen2: + case Sample.Nlsy79Gen2: Trace.Assert(drs.Length >= siblingCountInNls, "The number of returned rows should be equal or greater than 'siblingCountInNls'."); Int32 motherIDV1 = CommonCalculations.MotherIDOfGen2Subject(drSubject.SubjectTag); Int32 motherIDV2 = Retrieve.Response(Item.Gen1MomOfGen2Subject, drSubject.SubjectTag, dtExtended); @@ -256,11 +256,11 @@ private static bool DetermineMzPossibility ( LinksDataSet.tblSubjectRow dr1, Lin return true; } private static byte? DetermineBioKidCount ( LinksDataSet.tblSubjectRow drSubject, LinksDataSet.tblResponseDataTable dtExtended, float? lastAge ) { - switch ( (Generation)drSubject.Generation ) { - case Generation.Gen1: + switch ( (Sample)drSubject.Generation ) { + case Sample.Nlsy79Gen1: return (byte)Retrieve.Response(Item.BioKidCountGen1, drSubject.SubjectTag, dtExtended); - case Generation.Gen2: + case Sample.Nlsy79Gen2: //EnumResponsesGen2.KidBioCount count = (EnumResponsesGen2.KidBioCount)Retrieve.Response(Item.BioKidCountGen2, drSubject.SubjectTag, dtExtended); Int32? response =Retrieve.ResponseNullPossible(Item.BioKidCountGen2, drSubject.SubjectTag, dtExtended); if ( response.HasValue ) @@ -274,11 +274,11 @@ private static bool DetermineMzPossibility ( LinksDataSet.tblSubjectRow dr1, Lin } } private static byte? DetermineNlsKidCount ( LinksDataSet.tblSubjectRow drSubject, LinksDataSet.tblSubjectRow[] subjectsInExtendedFamily ) { - switch ( (Generation)drSubject.Generation ) { - case Generation.Gen1: + switch ( (Sample)drSubject.Generation ) { + case Sample.Nlsy79Gen1: byte tally = 0; foreach ( LinksDataSet.tblSubjectRow drRelative in subjectsInExtendedFamily ) { - if ( (Generation)drRelative.Generation == Generation.Gen2 ) { + if ( (Sample)drRelative.Generation == Sample.Nlsy79Gen2 ) { Int32 motherIDV1 = CommonCalculations.MotherIDOfGen2Subject(drRelative.SubjectTag); //Int32 motherIDV2 = Retrieve.Response(Item.Gen1MomOfGen2Subject, drSubject.SubjectTag, dtExtended); //Trace.Assert(motherIDV1 == motherIDV2, "The mother IDs should match."); @@ -287,7 +287,7 @@ private static bool DetermineMzPossibility ( LinksDataSet.tblSubjectRow dr1, Lin } } return tally; - case Generation.Gen2: + case Sample.Nlsy79Gen2: return null; default: throw new InvalidOperationException("The Generation value was not recognized."); diff --git a/BaseAssembly/SurveyTime.cs b/BaseAssembly/SurveyTime.cs index 28179bf..398ae80 100644 --- a/BaseAssembly/SurveyTime.cs +++ b/BaseAssembly/SurveyTime.cs @@ -73,7 +73,7 @@ private Int32 ProcessSubject ( LinksDataSet.tblSubjectRow drSubject ) { SurveySource source = DetermineSurveySource(surveyYear, drSubject, dtResponse); OverridesGen1.SubjectYear subjectYear = new OverridesGen1.SubjectYear(drSubject.SubjectID, surveyYear); bool invalidSkipOverride = false; - if ( (drSubject.Generation == (byte)Generation.Gen1) && (_overrides.Contains(subjectYear)) ) { + if ( (drSubject.Generation == (byte)Sample.Nlsy79Gen1) && (_overrides.Contains(subjectYear)) ) { source = SurveySource.Gen1; invalidSkipOverride = true; } @@ -102,9 +102,9 @@ private SurveySource DetermineSurveySource ( Int16 surveyYear, LinksDataSet.tblS else { SurveySource source = (SurveySource)drsResponse[0].SurveySource; switch ( source ) { - case SurveySource.Gen1: Trace.Assert(drSubject.Generation == (byte)Generation.Gen1, "The subject should be Gen1."); break; - case SurveySource.Gen2C: Trace.Assert(drSubject.Generation == (byte)Generation.Gen2, "The subject should be Gen2."); break; - case SurveySource.Gen2YA: Trace.Assert(drSubject.Generation == (byte)Generation.Gen2, "The subject should be Gen2."); break; + case SurveySource.Gen1: Trace.Assert(drSubject.Generation == (byte)Sample.Nlsy79Gen1, "The subject should be Gen1."); break; + case SurveySource.Gen2C: Trace.Assert(drSubject.Generation == (byte)Sample.Nlsy79Gen2, "The subject should be Gen2."); break; + case SurveySource.Gen2YA: Trace.Assert(drSubject.Generation == (byte)Sample.Nlsy79Gen2, "The subject should be Gen2."); break; default: throw new InvalidOperationException("The determined SurveySource was not recognized.");//The NotInterviewed shouldn't be possible for this switch. } return source; @@ -184,7 +184,7 @@ private SurveySource DetermineSurveySource ( Int16 surveyYear, LinksDataSet.tblS return null; } else { - Trace.Assert(drsResponse[0].Generation == (byte)Generation.Gen2, "Only Gen2 subjects should be answering this item (specifically the Cs -not the YAs)."); + Trace.Assert(drsResponse[0].Generation == (byte)Sample.Nlsy79Gen2, "Only Gen2 subjects should be answering this item (specifically the Cs -not the YAs)."); float ageInYears = (float)((drsResponse[0].Value + ageBiasCorrectionInMonths) / monthsPerYear); Trace.Assert(ageInYears > 0, "Age should be positive (non-null) value, at this point of the execution."); return ageInYears; diff --git a/BaseFixture/CommonFunctionsFixture.cs b/BaseFixture/CommonFunctionsFixture.cs index 9fba870..3553d3f 100644 --- a/BaseFixture/CommonFunctionsFixture.cs +++ b/BaseFixture/CommonFunctionsFixture.cs @@ -14,7 +14,7 @@ public void LastTwoDigitsOfGen2SubjectIDTest2 ( ) { LinksDataSet.tblSubjectRow dr = ds.tblSubject.NewtblSubjectRow(); dr.ExtendedID = 10; dr.SubjectID = 1002; - dr.Generation = (byte)Generation.Gen2; + dr.Generation = (byte)Sample.Nlsy79Gen2; dr.Gender = (byte)Gender.Male; Int32 expected = 2; Int32 actual = CommonFunctions.LastTwoDigitsOfGen2SubjectID(dr); @@ -26,7 +26,7 @@ public void LastTwoDigitsOfGen2SubjectIDTest22 ( ) { LinksDataSet.tblSubjectRow dr = ds.tblSubject.NewtblSubjectRow(); dr.ExtendedID = 4000; dr.SubjectID = 400122; - dr.Generation = (byte)Generation.Gen2; + dr.Generation = (byte)Sample.Nlsy79Gen2; dr.Gender = (byte)Gender.Male; Int32 expected = 22; Int32 actual = CommonFunctions.LastTwoDigitsOfGen2SubjectID(dr);