コード例 #1
0
 internal static LinksDataSet.tblMzManualRow MzManualRecord( LinksDataSet.tblSubjectRow dr1, LinksDataSet.tblSubjectRow dr2, LinksDataSet dsLinks )
 {
     string select = string.Format("{0}={1} AND {2}={3}",
         dr1.SubjectTag, dsLinks.tblMzManual.SubjectTag_S1Column.ColumnName,
         dr2.SubjectTag, dsLinks.tblMzManual.SubjectTag_S2Column.ColumnName);
     LinksDataSet.tblMzManualRow[] drs = (LinksDataSet.tblMzManualRow[])dsLinks.tblMzManual.Select(select);
     switch ( drs.Length ) {
         case 0:
             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) ) {
                     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.");
                 }
             }
             else {
                 Trace.Assert(OverridesGen2.MissingMobInvalidSkip.Contains(dr1.SubjectID) || OverridesGen2.MissingMobInvalidSkip.Contains(dr2.SubjectID), "Subjects with missing MOBs should be recognized.");
             }
             return null;
         case 1:
             return drs[0];
         default:
             Trace.Fail("At most, one record should be retrieved.");
             throw new InvalidOperationException();
     }
 }
コード例 #2
0
        public RParentChild( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft )
        {
            //ImportDataSet dsImport, , LinksDataSet.tblRelatedStructureRow drRight
            if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
            if ( drLeft == null ) throw new ArgumentNullException("drLeft");
            if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it.");
            _dsLinks = dsLinks;
            _drLeft = drLeft;
            _idRelatedLeft = _drLeft.ID;
            _drBare1 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1);
            _drBare2 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2);
            Trace.Assert(_drBare1.Generation != _drBare2.Generation, "The generation should not be the same for a parent-child relationship.");

            _multipleBirth = MultipleBirth.No;
            _isMZ = Tristate.No;

            //For IAssignPass1
            _rImplicitPass1 = RCoefficients.ParentChild;
            _rImplicit2004 = RCoefficients.ParentChild;
            _rExplicitOldestSibVersion = null;
            _rExplicitYoungestSibVersion = null;
            _rExplicitPass1 = RCoefficients.ParentChild;
            _rPass1 = RCoefficients.ParentChild;

            //For IAssignPass2
            _rImplicit = RCoefficients.ParentChild;
            _rImplicitSubject = RCoefficients.ParentChild;
            _rImplicitMother = RCoefficients.ParentChild;
            _rExplicit = RCoefficients.ParentChild;
            _rFull = RCoefficients.ParentChild;
            _rPeek = RCoefficients.ParentChild;
        }
コード例 #3
0
        internal static EnumResponsesGen1.Gen1Roster Gen1Roster1979( LinksDataSet.tblRelatedStructureRow drRelated, LinksDataSet.tblResponseDataTable dt )
        {
            //LinksDataSet.tblSubjectRow drSubject1, LinksDataSet.tblSubjectRow drSubject2 ) {
            if ( dt == null ) throw new ArgumentNullException("dt");
            if ( drRelated == null ) throw new ArgumentNullException("drRelated");
            const Int32 expectedSurveyYear = 1979;
            LinksDataSet.tblSubjectRow drSubject1 = drRelated.tblSubjectRowByFK_tblRelatedStructure_tblSubject_Subject1;
            LinksDataSet.tblSubjectRow drSubject2 = drRelated.tblSubjectRowByFK_tblRelatedStructure_tblSubject_Subject2;

            string selectToGetLoopIndex = string.Format("{0}={1} AND {2}={3} AND {4}={5}",
                drSubject1.SubjectTag, dt.SubjectTagColumn.ColumnName,
                (Int16)Item.IDOfOther1979RosterGen1, dt.ItemColumn.ColumnName,
                drSubject2.SubjectID, dt.ValueColumn.ColumnName);
            LinksDataSet.tblResponseRow[] drsForLoopIndex = (LinksDataSet.tblResponseRow[])dt.Select(selectToGetLoopIndex);
            Trace.Assert(drsForLoopIndex.Length == 1, "Exactly one row should be returned matching Subject2");
            Trace.Assert(drsForLoopIndex[0].SurveyYear == expectedSurveyYear, "The SurveyYear should be " + expectedSurveyYear);
            Int32 loopIndex = drsForLoopIndex[0].LoopIndex;

            string selectToRoster = string.Format("{0}={1} AND {2}={3} AND {4}={5}",
                drSubject1.SubjectTag, dt.SubjectTagColumn.ColumnName,
                (Int16)Item.RosterGen1979, dt.ItemColumn.ColumnName,
                loopIndex, dt.LoopIndexColumn.ColumnName);
            LinksDataSet.tblResponseRow[] drsForRoster = (LinksDataSet.tblResponseRow[])dt.Select(selectToRoster);
            Trace.Assert(drsForRoster.Length == 1, "Exactly one row should be returned for the Roster relationship to Subject2");
            Trace.Assert(drsForRoster[0].SurveyYear == expectedSurveyYear, "The SurveyYear should be " + expectedSurveyYear);
            EnumResponsesGen1.Gen1Roster relationship = (EnumResponsesGen1.Gen1Roster)drsForRoster[0].Value;
            return relationship;
        }
コード例 #4
0
 public RelatedStructure( LinksDataSet dsLinks )
 {
     if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
     if ( dsLinks.tblSubject.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblSubject.");
     if ( dsLinks.tblRelatedStructure.Count != 0 ) throw new ArgumentException("There should be zero rows in tblRelatedStructure.");
     _dsLinks = dsLinks;
 }
コード例 #5
0
 public static Int16[] CreateExtendedFamilyIDs( LinksDataSet dsLinks )
 {
     if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
     if ( dsLinks.tblSubject.Count <= 0 ) throw new ArgumentException("The tblSubject is empty.", "dsLinks");
     IEnumerable<Int16> ids = (from dr in dsLinks.tblSubject
                                       select dr.ExtendedID).Distinct();
     return ids.ToArray();
 }
コード例 #6
0
 //public static bool? TranslateYesNo ( YesNo yn ) {
 //   switch ( yn ) {
 //      case YesNo.Yes: return true;
 //      case YesNo.No: return false;
 //      default: return null;
 //   }
 //}
 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.");
     string subjectIDString = drSubject.SubjectID.ToString();
     Int32 startIndex = subjectIDString.Length - 2;
     return Convert.ToByte(subjectIDString.Substring(startIndex));
 }
コード例 #7
0
ファイル: Mob.cs プロジェクト: LiveOak/NlsyLinksDetermination
 internal static DateTime? Retrieve( Int32 subjectTag, LinksDataSet.tblSubjectDetailsDataTable dt )
 {
     LinksDataSet.tblSubjectDetailsRow dr = dt.FindBySubjectTag(subjectTag);
     if ( dr.IsMobNull() )
         return null;
     else
         return dr.Mob;
 }
コード例 #8
0
        public SurveyTime( LinksDataSet ds )
        {
            if ( ds == null ) throw new ArgumentNullException("ds");
            if ( ds.tblResponse.Count <= 0 ) throw new InvalidOperationException("tblResponse must NOT be empty.");
            if ( ds.tblSurveyTime.Count != 0 ) throw new InvalidOperationException("tblSurveyTime must be empty before creating rows for it.");
            _ds = ds;

            _itemIDsString = CommonCalculations.ConvertItemsToString(_items);
        }
コード例 #9
0
        public RGen2Cousins( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft )
        {
            //ImportDataSet dsImport, , LinksDataSet.tblRelatedStructureRow drRight
            if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
            if ( drLeft == null ) throw new ArgumentNullException("drLeft");
            if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it.");
            _dsLinks = dsLinks;
            _idRelatedLeft = drLeft.ID;

            _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.");

            _multipleBirth = MultipleBirth.No;
            _isMZ = Tristate.No;

            LinksDataSet.tblRelatedValuesRow drValuesOfGen1Housemates = Gen1HousematesValues(_drBare1.SubjectTag, _drBare2.SubjectTag);//RelatedValues.Retrieve(_dsLinks, _path,
            //For IAssignPass1
            if ( drValuesOfGen1Housemates.IsRImplicitPass1Null() ) _rImplicitPass1 = null;
            else _rImplicitPass1 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicitPass1);

            if ( drValuesOfGen1Housemates.IsRImplicit2004Null() ) _rImplicit2004 = null;
            else _rImplicit2004 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicit2004);

            _rExplicitOldestSibVersion = null;
            _rExplicitYoungestSibVersion = null;

            if ( drValuesOfGen1Housemates.IsRExplicitPass1Null() ) _rExplicitPass1 = null;
            else _rExplicitPass1 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RExplicitPass1);

            if ( drValuesOfGen1Housemates.IsRPass1Null() ) _rPass1 = null;
            else _rPass1 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RPass1); ;

            //For IAssignPass2
            if ( drValuesOfGen1Housemates.IsRImplicitNull() ) _rImplicit = null;
            else _rImplicit = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicit);

            if ( drValuesOfGen1Housemates.IsRImplicitSubjectNull() ) _rImplicitSubject = null;
            else _rImplicitSubject = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicitSubject);

            if ( drValuesOfGen1Housemates.IsRImplicitMotherNull() ) _rImplicitMother = null;
            else _rImplicitMother = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicitMother);

            if ( drValuesOfGen1Housemates.IsRExplicitNull() ) _rExplicit = null;
            else _rExplicit = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RExplicit);

            if ( drValuesOfGen1Housemates.IsRNull() ) _r= null;
            else _r= (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.R);

            if ( drValuesOfGen1Housemates.IsRFullNull() ) _rFull = null;
            else _rFull = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RFull);

            if ( drValuesOfGen1Housemates.IsRPeekNull() ) _rPeek = null;
            else _rPeek = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RPeek);
        }
コード例 #10
0
 public MarkerGen2( LinksDataSet dsLinks )
 {
     if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
     if ( dsLinks.tblSubject.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblSubject.");
     if ( dsLinks.tblRelatedStructure.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblRelatedStructure.");
     if ( dsLinks.tblMarkerGen2.Count != 0 ) throw new ArgumentException("There should be zero rows in tblMarkerGen2.");
     _dsLinks = dsLinks;
     //_itemYearCount = new ItemYearCount(_dsLinks);
     _itemIDsString = CommonCalculations.ConvertItemsToString(_items);
 }
コード例 #11
0
 public static LinksDataSet.tblRelatedStructureRow Retrieve( LinksDataSet ds, RelationshipPath relationshipPath, Int32 subject1Tag, Int32 subject2Tag )
 {
     if ( ds.tblRelatedStructure.Count <= 0 ) throw new ArgumentException("tblRelatedStructure should have more than one row.", "ds");
     string sql = string.Format("{0}={1} AND {2}={3} AND {4}={5}",
         (byte)relationshipPath, ds.tblRelatedStructure.RelationshipPathColumn.ColumnName,
         subject1Tag, ds.tblRelatedStructure.SubjectTag_S1Column.ColumnName,
         subject2Tag, ds.tblRelatedStructure.SubjectTag_S2Column.ColumnName);
     LinksDataSet.tblRelatedStructureRow[] drs = (LinksDataSet.tblRelatedStructureRow[])ds.tblRelatedStructure.Select(sql);
     Trace.Assert(drs.Length == 1, "There should be exactly one row retrieved.");
     return drs[0];
 }
コード例 #12
0
        private float? _rPeek = null; //float.NaN;

        #endregion Fields

        #region Constructors

        public RGen1Pass2( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft, LinksDataSet.tblRelatedStructureRow drRight )
        {
            if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
            if ( drLeft == null ) throw new ArgumentNullException("drLeft");
            if ( drRight == null ) throw new ArgumentNullException("drRight");
            if ( dsLinks.tblRelatedValues.Count == 0 ) throw new InvalidOperationException("tblRelatedValues must be empty before updating rows for it.");
            if ( dsLinks.tblMzManual.Count == 0 ) throw new InvalidOperationException("tblMzManual must NOT be empty before assigning R values from it.");
            if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it.");
            if ( dsLinks.tblSubjectDetails.Count == 0 ) throw new InvalidOperationException("tblSubjectDetails must NOT be empty before assigning R values from it.");
            if ( dsLinks.tblMarkerGen1.Count == 0 ) throw new InvalidOperationException("tblMarkerGen1 must NOT be empty before assigning R values from it.");
            _dsLinks = dsLinks;
            _drLeft = drLeft;
            _drRight = drRight;
            _idRelatedLeft = _drLeft.ID;
            _idRelatedRight = _drRight.ID;
            _drSubjectDetails1 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S1);
            _drSubjectDetails2 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S2);
            _extendedID = _drLeft.tblSubjectRowByFK_tblRelatedStructure_tblSubject_Subject1.ExtendedID;

            if ( _drSubjectDetails1.BirthOrderInNls <= _drSubjectDetails2.BirthOrderInNls ) {//This is the way it usually is.  Recall twins were assigned tied birth orders
                _idRelatedOlderAboutYounger = _idRelatedLeft; //_idRelatedYoungerAboutOlder = _idRelatedRight;
            }
            else if ( _drSubjectDetails1.BirthOrderInNls > _drSubjectDetails2.BirthOrderInNls ) {
                _idRelatedOlderAboutYounger = _idRelatedRight;
            }

            _drValue = _dsLinks.tblRelatedValues.FindByID(_idRelatedLeft);
            _dtMarkersGen1 = MarkerGen1.PairRelevantMarkerRows(_idRelatedLeft, _idRelatedRight, _dsLinks, _extendedID);

            Tristate explicitShareBiomom = AddressExplicitBiomom();
            Tristate explicitShareBiodad = AddressExplicitBiodad();

            Tristate implicitShareBiomom = AddressImplicitBiomom();
            Tristate implicitShareBiodad = AddressImplicitBiodad();

            _rExplicit = CommonFunctions.TranslateToR(shareBiomom: explicitShareBiomom, shareBiodad: explicitShareBiodad, mustDecide: true);
            _rImplicit = CommonFunctions.TranslateToR(shareBiomom: implicitShareBiomom, shareBiodad: implicitShareBiodad, mustDecide: false);//Possibly 'true' later one

            //_rFull = RGen1Pass1.CalculateRFull(shareBiomom: shareBiomom, shareBiodad: shareBiodad,
            //   multiple: (MultipleBirth)_drValue.MultipleBirthIfSameSex, isMZ: (Tristate)_drValue.IsMz, isRelatedInMZManual: (Tristate)_drValue.IsRelatedInMzManual,
            //   idRelated: _idRelatedLeft, dtRoster: _dsLinks.tblRosterGen1);

            if ( !_drValue.IsRPass1Null() ) {
                _rFull = (float)_drValue.RPass1;
            }
            else { //Don't do the expensive interpolation unless it will be used
                Tristate shareBiomom = AddressBiomom(explicitShareBiomom, implicitShareBiomom);
                Tristate shareBiodad = AddressBiodad(explicitShareBiodad, implicitShareBiodad);
                _rFull = CommonFunctions.TranslateToR(shareBiomom: shareBiomom, shareBiodad: shareBiodad, mustDecide: true);
            }

            LinksDataSet.tblRosterGen1Row drRoster = _dsLinks.tblRosterGen1.FindByRelatedID(_drValue.ID);
            _r = CalculateR(_rFull, (Tristate)drRoster.SameGeneration);
        }
コード例 #13
0
 public void LastTwoDigitsOfGen2SubjectIDTest22( )
 {
     LinksDataSet ds = new LinksDataSet();
     LinksDataSet.tblSubjectRow dr = ds.tblSubject.NewtblSubjectRow();
     dr.ExtendedID = 4000;
     dr.SubjectID = 400122;
     dr.Generation = (byte)Generation.Gen2;
     dr.Gender = (byte)Gender.Male;
     Int32 expected = 22;
     Int32 actual = CommonFunctions.LastTwoDigitsOfGen2SubjectID(dr);
     Assert.AreEqual(expected, actual);
 }
コード例 #14
0
 public RelatedValues( ImportDataSet dsImport, LinksDataSet dsLinks )
 {
     if ( dsImport == null ) throw new ArgumentNullException("dsImport");
     if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
     if ( dsLinks.tblRelatedStructure.Count <= 0 ) throw new ArgumentException("There should NOT be zero rows in tblRelatedStructure.");
     if ( dsLinks.tblMarkerGen1.Count <= 0 ) throw new ArgumentException("There should NOT be zero rows in tblMarkerGen1.");
     if ( dsLinks.tblMarkerGen2.Count <= 0 ) throw new ArgumentException("There should NOT be zero rows in tblMarkerGen2.");
     if ( dsLinks.vewSurveyTimeMostRecent.Count <= 0 ) throw new ArgumentException("There should NOT be zero rows in vewSurveyTimeMostRecent.");
     if ( dsLinks.tblRelatedValues.Count != 0 ) throw new ArgumentException("There should be zero rows in tblRelatedValues.");
     _dsImport = dsImport;
     _dsLinks = dsLinks;
 }
コード例 #15
0
        internal static MarkerGen1Summary RetrieveSummary( Int32 relatedIDLeft, LinksDataSet.tblRosterGen1DataTable dtRoster )
        {
            if ( dtRoster == null ) throw new ArgumentNullException("dtRoster");
            LinksDataSet.tblRosterGen1Row dr = dtRoster.FindByRelatedID(relatedIDLeft);

            MarkerEvidence sameGeneration = Assign.EvidenceGen1.RosterSameGeneration((Tristate)dr.SameGeneration);
            MarkerEvidence shareBiodad = Assign.EvidenceGen1.RosterShareBioParentOrGrandparent((Tristate)dr.ShareBiodad);
            MarkerEvidence shareBiomom = Assign.EvidenceGen1.RosterShareBioParentOrGrandparent((Tristate)dr.ShareBiomom);
            MarkerEvidence shareBiograndparent = Assign.EvidenceGen1.RosterShareBioParentOrGrandparent((Tristate)dr.ShareBiograndparent);

            return new MarkerGen1Summary(sameGeneration, shareBiomom, shareBiodad, shareBiograndparent);
        }
コード例 #16
0
 public MarkerGen1( LinksDataSet dsLinks, ImportDataSet dsImport )
 {
     if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
     if ( dsLinks.tblSubject.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblSubject.");
     if ( dsLinks.tblRelatedStructure.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblRelatedStructure.");
     if ( dsLinks.tblRosterGen1.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblRosterGen1.");
     if ( dsLinks.tblParentsOfGen1Current.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblParentsOfGen1Current.");
     if ( dsLinks.tblParentsOfGen1Retro.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblParentsOfGen1Retro.");
     if ( dsImport.tblGeocodeSanitized.Count <= 0 ) throw new ArgumentException("There shouldn't be zero rows in tblGeocodeSanitized.");
     if ( dsLinks.tblMarkerGen1.Count != 0 ) throw new ArgumentException("There should be zero rows in tblMarkerGen1.");
     _dsLinks = dsLinks;
     _dsImport = dsImport;
     _itemIDsString = CommonCalculations.ConvertItemsToString(_items);
 }
コード例 #17
0
 internal static byte? MotherLoopIndexForChildTag( Int32 motherTag, LinksDataSet.tblSubjectRow drChild, LinksDataSet.tblResponseDataTable dtResponse )
 {
     byte childTwoDigitID = CommonFunctions.LastTwoDigitsOfGen2SubjectID(drChild);
     const Item item = Item.Gen1ChildsIDByBirthOrder;
     string select = string.Format("{0}={1} AND {2}={3} AND {4}={5}",
         motherTag, dtResponse.SubjectTagColumn.ColumnName,
         (Int16)item, dtResponse.ItemColumn.ColumnName,
         childTwoDigitID, dtResponse.ValueColumn.ColumnName);
     LinksDataSet.tblResponseRow[] drs = (LinksDataSet.tblResponseRow[])dtResponse.Select(select);
     Trace.Assert(drs.Length <= 1, "At most one row should be returned.");
     if ( drs.Length == 0 )
         return null;
     else
         return Convert.ToByte(drs[0].Value);
 }
コード例 #18
0
        public static LinksDataSet.tblParentsOfGen1RetroDataTable RetrieveRows( Int32 extendedID, LinksDataSet.tblParentsOfGen1RetroDataTable dtRetro )
        {
            if ( dtRetro == null ) throw new ArgumentNullException("dsLinks");
               if ( dtRetro.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblParentsOfGen1Retro.");

               string select = string.Format("{0}={1}", extendedID, dtRetro.ExtendedIDColumn.ColumnName);
               LinksDataSet.tblParentsOfGen1RetroRow[] drs = (LinksDataSet.tblParentsOfGen1RetroRow[])dtRetro.Select(select);
               Trace.Assert(drs.Length >= 1, "There should be at least one row.");

               LinksDataSet.tblParentsOfGen1RetroDataTable dt = new LinksDataSet.tblParentsOfGen1RetroDataTable();
               foreach ( LinksDataSet.tblParentsOfGen1RetroRow dr in drs ) {
              dt.ImportRow(dr);
               }
               return dt;
        }
コード例 #19
0
        internal static LinksDataSet.tblResponseDataTable ExtendedFamilyRelevantResponseRows( Int32 extendedFamilyID, string itemIDsString, Int32 minRowCount, LinksDataSet.tblResponseDataTable dtResponse )
        {
            string select = string.Format("{0}={1} AND {2} in ({3})",
                extendedFamilyID, dtResponse.ExtendedIDColumn.ColumnName,
                dtResponse.ItemColumn.ColumnName, itemIDsString);
            LinksDataSet.tblResponseRow[] drs = (LinksDataSet.tblResponseRow[])dtResponse.Select(select);

            Trace.Assert(drs.Length >= 0, "There should be at least " + minRowCount + "  row(s) returned.");

            LinksDataSet.tblResponseDataTable dt = new LinksDataSet.tblResponseDataTable();
            foreach ( LinksDataSet.tblResponseRow dr in drs ) {
                dt.ImportRow(dr);
            }
            return dt;
        }
コード例 #20
0
 public Response( ImportDataSet dsImport, LinksDataSet dsLinks )
 {
     if ( dsImport == null ) throw new ArgumentNullException("dsImport");
     if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
     if ( dsLinks.tblResponse.Count != 0 ) throw new InvalidOperationException("tblResponse must be empty before creating rows for it.");
     if ( dsImport.tblGen1Links.Count == 0 ) throw new InvalidOperationException("tblGen1Links must NOT be empty before reading responses from it.");
     if ( dsImport.tblGen2Links.Count == 0 ) throw new InvalidOperationException("tblGen2Links must NOT be empty before reading responses from it.");
     if ( dsImport.tblGen2LinksFromGen1.Count == 0 ) throw new InvalidOperationException("tblGen2LinksFromGen1 must NOT be empty before reading responses from it.");
     if ( dsImport.tblGen2ImplicitFather.Count == 0 ) throw new InvalidOperationException("tblGen2ImplicitFather must NOT be empty before reading responses from it.");
     if( dsImport.tblGen1Outcomes.Count == 0 ) throw new InvalidOperationException("tblGen1Outcomes must NOT be empty before reading responses from it.");
     if( dsImport.tblGen2OutcomesHeight.Count == 0 ) throw new InvalidOperationException("tblGen2OutcomesHeight must NOT be empty before reading responses from it.");
     if( dsImport.tblGen2OutcomesWeight.Count == 0 ) throw new InvalidOperationException("tblGen2OutcomesWeight must NOT be empty before reading responses from it.");
     if( dsImport.tblGen2OutcomesMath.Count == 0 ) throw new InvalidOperationException("tblGen2OutcomesMath must NOT be empty before reading responses from it.");
     _dsImport = dsImport;
     _dsLinks = dsLinks;
 }
コード例 #21
0
        public RGen2Pass2( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft, LinksDataSet.tblRelatedStructureRow drRight )
        {
            //ImportDataSet dsImport,
            if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
            if ( drLeft == null ) throw new ArgumentNullException("drLeft");
            if ( drRight == null ) throw new ArgumentNullException("drRight");
            if ( dsLinks.tblRelatedValues.Count == 0 ) throw new InvalidOperationException("tblRelatedValues must be empty before updating rows for it.");
            if ( dsLinks.tblMzManual.Count == 0 ) throw new InvalidOperationException("tblMzManual must NOT be empty before assigning R values from it.");
            if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it.");
            if ( dsLinks.tblSubjectDetails.Count == 0 ) throw new InvalidOperationException("tblSubjectDetails must NOT be empty before assigning R values from it.");
            if ( dsLinks.tblMarkerGen2.Count == 0 ) throw new InvalidOperationException("tblMarkerGen2 must NOT be empty before assigning R values from it.");
            _dsLinks = dsLinks;
            _drLeft = drLeft;
            _drRight = drRight;
            _idRelatedLeft = _drLeft.ID;
            _idRelatedRight = _drRight.ID;
            _drSubjectDetails1 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S1);
            _drSubjectDetails2 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S2);
            _extendedID = _drLeft.tblSubjectRowByFK_tblRelatedStructure_tblSubject_Subject1.ExtendedID;

            if ( _drSubjectDetails1.BirthOrderInNls <= _drSubjectDetails2.BirthOrderInNls ) {//This is the way it usually is.  Recall twins were assigned tied birth orders
                _idRelatedOlderAboutYounger = _idRelatedLeft;
            }
            else if ( _drSubjectDetails1.BirthOrderInNls > _drSubjectDetails2.BirthOrderInNls ) {
                _idRelatedOlderAboutYounger = _idRelatedRight;
            }

            _drValue = _dsLinks.tblRelatedValues.FindByID(_idRelatedLeft);
            _dtMarkersGen2 = MarkerGen2.PairRelevantMarkerRows(_idRelatedLeft, _idRelatedRight, _dsLinks, _extendedID);

            MarkerEvidence babyDaddyDeathDate = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyDeathDate, _dtMarkersGen2);
            MarkerEvidence babyDaddyAlive = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyAlive, _dtMarkersGen2);
            MarkerEvidence babyDaddyInHH = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyInHH, _dtMarkersGen2);
            MarkerEvidence babyDaddyLeftHHDate = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyLeftHHDate, _dtMarkersGen2);
            MarkerEvidence babyDaddyDistanceFromHH = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyDistanceFromHH, _dtMarkersGen2);

            MarkerEvidence fatherAlive = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.Gen2CFatherAlive, _dtMarkersGen2);
            MarkerEvidence fatherInHH = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.Gen2CFatherInHH, _dtMarkersGen2);
            MarkerEvidence fatherDistanceFromHH = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.Gen2CFatherDistanceFromHH, _dtMarkersGen2);

            _rImplicitMother = CalculateRImplicitMother(babyDaddyDeathDate, babyDaddyAlive, babyDaddyInHH, babyDaddyLeftHHDate, babyDaddyDistanceFromHH);
            _rImplicitSubject = CalculateRImplicitSubject(fatherAlive, fatherInHH, fatherDistanceFromHH);
            _rImplicit = CalculateRImplicit(_rImplicitMother, _rImplicitSubject);
            _rExplicit = CalculateRExplicit();
            _rFull = CalculateRFull();
            _rPeek = CalculateRPeek();
        }
コード例 #22
0
        public static string CreateSubject( ImportDataSet dsImport, LinksDataSet dsLinks )
        {
            if ( dsImport == null ) throw new ArgumentNullException("dsImport");
            if ( dsImport.tblGen1Links.Rows.Count != Constants.Gen1Count ) throw new ArgumentException("There should be exactly " + Constants.Gen1Count + " Gen1 subject rows, but instead there are " + dsImport.tblGen1Links.Rows.Count + ".");
            if ( dsImport.tblGen2Links.Rows.Count != Constants.Gen2Count ) throw new ArgumentException("There should be exactly " + Constants.Gen2Count + " Gen2 subject rows, but instead there are " + dsImport.tblGen2Links.Rows.Count + ".");
            if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
            if ( dsLinks.tblSubject.Count != 0 ) throw new InvalidOperationException("tblSubject must be empty before creating rows for it.");
            Stopwatch sw = new Stopwatch();
            sw.Start();

            Int32 subjectRecordsAddedCount = 0;
            foreach ( ImportDataSet.tblGen1LinksRow drGen1 in dsImport.tblGen1Links ) {
                LinksDataSet.tblSubjectRow drBare = dsLinks.tblSubject.NewtblSubjectRow();
                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.Gender = Convert.ToByte(drGen1[Constants.Gen1GenderColumn]);
                dsLinks.tblSubject.AddtblSubjectRow(drBare);
                subjectRecordsAddedCount += 1;
            }
            Trace.Assert(subjectRecordsAddedCount == Constants.Gen1Count, "The number of added Gen1 subjects should be correct.");

            foreach ( ImportDataSet.tblGen2LinksRow drGen2 in dsImport.tblGen2Links ) {
                LinksDataSet.tblSubjectRow drBare = dsLinks.tblSubject.NewtblSubjectRow();
                drBare.SubjectID = drGen2.C0000100;
                drBare.SubjectTag = drBare.SubjectID;
                Int32 motherID = drGen2.C0000200;
                drBare.ExtendedID = RetrieveExtendedFamilyIDFromGenMotherID(dsImport, motherID);
                drBare.Generation = (byte)Generation.Gen2;

                Int32 genderTemp = drGen2.C0005400;
                if ( genderTemp == -3 ) genderTemp = (byte)Gender.InvalidSkipGen2;
                drBare.Gender = (byte)genderTemp;

                dsLinks.tblSubject.AddtblSubjectRow(drBare);
                subjectRecordsAddedCount += 1;
            }
            Trace.Assert(subjectRecordsAddedCount == Constants.Gen1Count+ Constants.Gen2Count, "The number of added Gen2 subjects should be correct.");

            sw.Stop();
            Int32 expectedRowCount = dsImport.tblGen1Links.Rows.Count + dsImport.tblGen2Links.Rows.Count;
            Trace.Assert(expectedRowCount == subjectRecordsAddedCount, "The correct number of subjects should be added.");
            return string.Format("{0:N0} Subject records were enumerated.\nElapsed time: {1}", subjectRecordsAddedCount, sw.Elapsed.ToString());
        }
コード例 #23
0
        public static DateTime?[] RetrieveDeathDates( Int32 subjectTag, Int16[] surveyYears, LinksDataSet.tblBabyDaddyDataTable dtInput )
        {
            if ( dtInput == null ) throw new ArgumentNullException("dtInput");
            if ( surveyYears == null ) throw new ArgumentNullException("surveyYears");
            if ( dtInput.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblBabyDaddy.");

            DateTime?[] dates = new DateTime?[surveyYears.Length];
            for ( Int32 i = 0; i < dates.Length; i++ ) {
                LinksDataSet.tblBabyDaddyRow dr = RetrieveRow(subjectTag, surveyYears, dtInput, i);
                if ( dr == null )
                    dates[i] = null;
                else if ( dr.IsBiodadDeathDateNull() )
                    dates[i] = null;
                else
                    dates[i] = dr.BiodadDeathDate;
            }
            return dates;
        }
コード例 #24
0
        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 ) {
                return RelationshipPath.Gen1Housemates;
            }
            else if ( drSubject1.Generation == (byte)Generation.Gen2 && drSubject2.Generation == (byte)Generation.Gen2 ) {
                if ( CommonCalculations.Gen2SubjectsHaveCommonMother(drSubject1.SubjectID, drSubject2.SubjectID) ) return RelationshipPath.Gen2Siblings;
                else return RelationshipPath.Gen2Cousins;
            }
            else {
                Int32 olderSubjectID = Math.Min(drSubject1.SubjectID, drSubject2.SubjectID);
                Int32 youngerSubjectID = Math.Max(drSubject1.SubjectID, drSubject2.SubjectID);

                Int32 motherOfYoungerSubjectID = CommonCalculations.MotherIDOfGen2Subject(youngerSubjectID);
                if ( olderSubjectID == motherOfYoungerSubjectID ) return RelationshipPath.ParentChild;
                else return RelationshipPath.AuntNiece;
            }
        }
コード例 #25
0
        public static Int16?[] RetrieveDistanceFromHH( Int32 subjectTag, Int16[] surveyYears, LinksDataSet.tblFatherOfGen2DataTable dtInput )
        {
            if ( dtInput == null ) throw new ArgumentNullException("dtInput");
            if ( surveyYears == null ) throw new ArgumentNullException("surveyYears");
            if ( dtInput.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblFatherOfGen2.");

            Int16?[] distances = new Int16?[surveyYears.Length];
            for ( Int32 i = 0; i < distances.Length; i++ ) {
                LinksDataSet.tblFatherOfGen2Row dr = RetrieveRow(subjectTag, surveyYears[i], dtInput);
                if ( dr == null )
                    distances[i] = null;
                else if ( dr.IsBiodadDistanceFromHHNull() )
                    distances[i] = null;
                else if ( (YesNo)dr.BiodadDistanceFromHH == YesNo.InvalidSkip )
                    distances[i] = null;
                else
                    distances[i] = dr.BiodadDistanceFromHH;
            }
            return distances;
        }
コード例 #26
0
        public static DateTime? RetrieveSubjectSurveyDate( Int32 subjectTag, Int16 surveyYear, LinksDataSet dsLinks )
        {
            if ( dsLinks == null ) throw new ArgumentNullException("dsLinks");
            if ( dsLinks.tblSurveyTime.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblSurveyTime.");

            string select = string.Format("{0}={1} AND {2}={3}", // AND {4}>0",
                subjectTag, dsLinks.tblSurveyTime.SubjectTagColumn.ColumnName,
                surveyYear, dsLinks.tblSurveyTime.SurveyYearColumn.ColumnName); //dsLinks.tblSurveyTime.SurveySourceColumn.ColumnName
            LinksDataSet.tblSurveyTimeRow[] drs = (LinksDataSet.tblSurveyTimeRow[])dsLinks.tblSurveyTime.Select(select);
            Trace.Assert(drs.Length == 1, "There should be exactly one row returned.");

            if( drs[0].IsSurveyDateNull() ) {
                Trace.Assert(drs[0].SurveySource == 0, "If the Survey Date is null, the Survey Source should be zero.");
                return null;
            }
            else {
                Trace.Assert(drs[0].SurveySource > 0, "If the Survey Date is not null, the Survey Source should be nonzero.");
                return drs[0].SurveyDate;
            }
        }
コード例 #27
0
        public static Int16?[] RetrieveIsAlive( Int32 subjectTag, Int16[] surveyYears, LinksDataSet.tblFatherOfGen2DataTable dtInput )
        {
            if ( dtInput == null ) throw new ArgumentNullException("dtInput");
            if ( surveyYears == null ) throw new ArgumentNullException("surveyYears");
            if ( dtInput.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblFatherOfGen2.");

            Int16?[] values = new Int16?[surveyYears.Length];
            for ( Int32 i = 0; i < values.Length; i++ ) {
                LinksDataSet.tblFatherOfGen2Row dr = RetrieveRow(subjectTag, surveyYears[i], dtInput);
                if ( dr == null )
                    values[i] = null;
                else if ( (YesNo)dr.BiodadAlive == YesNo.ValidSkipOrNoInterviewOrNotInSurvey )
                    values[i] = null;
                else if ( (YesNo)dr.BiodadAlive == YesNo.InvalidSkip )
                    values[i] = null;
                else
                    values[i] = dr.BiodadAlive;
            }
            return values;
        }
コード例 #28
0
        public Outcome( LinksDataSet ds )
        {
            if( ds == null ) throw new ArgumentNullException("ds");
            if( ds.tblSubject.Count <= 0 ) throw new InvalidOperationException("tblSubject must NOT be empty.");
            if( ds.tblResponse.Count <= 0 ) throw new InvalidOperationException("tblResponse must NOT be empty.");
            if( ds.tblSurveyTime.Count <= 0 ) throw new InvalidOperationException("tblSurveyTime must NOT be empty.");
            if( ds.tblOutcome.Count != 0 ) throw new InvalidOperationException("tblOutcome must be empty before creating rows for it.");
            _ds = ds;

            //_items = new Item[_itemsGen1.Length + _itemsGen2.Length];
            //_itemsGen1.CopyTo(_items, 0);
            //_itemsGen2.CopyTo(_items, _itemsGen1.Length);
            //CommonCalculations.ConvertItemsToString(_items);

            _itemIDsStringGen1     = CommonCalculations.ConvertItemsToString(_itemsGen1);
            _itemIDsStringGen2 = CommonCalculations.ConvertItemsToString(_itemsGen2);
            _itemIDsString = _itemIDsStringGen1 + ", " + _itemIDsStringGen2;

            //_outcomeItemsGen1 = BuildOutcomeYearsGen1();
            //_outcomeYearsGen2 = BuildOutcomeYearsGen2();
        }
コード例 #29
0
ファイル: Mob.cs プロジェクト: LiveOak/NlsyLinksDetermination
        internal static DateTime? Retrieve( LinksDataSet.tblSubjectRow drSubject, LinksDataSet.tblResponseDataTable dt )
        {
            if ( dt == null ) throw new ArgumentNullException("dt");
            if ( drSubject == null ) throw new ArgumentNullException("drSubject");

            const Int32 maxRows = 1;
            switch ( (Generation)drSubject.Generation ) {
                case Generation.Gen1:
                    const SurveySource sourceGen1 = SurveySource.Gen1;
                    Int32? monthGen1 = Nls.BaseAssembly.Retrieve.ResponseNullPossible(Constants.Gen1MobSurveyYearPreferred, Item.DateOfBirthMonth, sourceGen1, drSubject.SubjectTag, maxRows, dt);
                    Int32 yearGen1 = Int32.MinValue;
                    if ( monthGen1.HasValue && monthGen1.Value > 0 ) {
                        yearGen1 = Nls.BaseAssembly.Retrieve.Response(Constants.Gen1MobSurveyYearPreferred, Item.DateOfBirthYearGen1, drSubject.SubjectTag, maxRows, dt);
                        Trace.Assert(yearGen1 > 0, "If month isn't missing, neither should year.");
                    }
                    else {
                        monthGen1 = Nls.BaseAssembly.Retrieve.Response(Constants.Gen1MobSurveyYearBackup, Item.DateOfBirthMonth, drSubject.SubjectTag, maxRows, dt);
                        yearGen1 = Nls.BaseAssembly.Retrieve.Response(Constants.Gen1MobSurveyYearBackup, Item.DateOfBirthYearGen1, drSubject.SubjectTag, maxRows, dt);
                    }
                    return CalculateMobForGen1(monthGen1.Value, yearGen1);
                case Generation.Gen2:
                    if ( OverridesGen2.MissingMobInvalidSkip.Contains(drSubject.SubjectID) ) return null;

                    const SurveySource sourceGen2 = SurveySource.Gen2C;
                    Int32? monthGen2 = Nls.BaseAssembly.Retrieve.ResponseNullPossible(Item.DateOfBirthMonth, sourceGen2, drSubject.SubjectTag, maxRows, dt);
                    Int32? yearGen2 = Nls.BaseAssembly.Retrieve.ResponseNullPossible(Item.DateOfBirthYearGen2, sourceGen2, drSubject.SubjectTag, maxRows, dt);//There's only three who don't have both year & month, so moving it won't increase speed.
                    if ( !yearGen2.HasValue ) {
                        Trace.Assert(OverridesGen2.MissingMobInvalidSkip.Contains(drSubject.SubjectID), "Only pre-identified Gen2 subjects can have an invalid skip Mob value.");
                        return null;
                    }
                    else if ( monthGen2 < 0 ) {
                        Trace.Assert(OverridesGen2.MissingMobRefusedMonth.Contains(drSubject.SubjectID), "Only pre-identified Gen2 subjects can have a refused Mob value.");
                        monthGen2 = Constants.DefaultMonthOfYear;
                    }
                    return CalculateMobForGen2(monthGen2.Value, yearGen2.Value);
                default:
                    Trace.Fail("The Generation value is not recognized.");
                    return null;
            }
        }
コード例 #30
0
        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 ( dcPass1 == null ) throw new ArgumentNullException("dcPass1");
            switch ( dcPass1.ColumnName ) {
                case "ImplicitShareBiomomPass1":
                case "ImplicitShareBiodadPass1":
                case "ExplicitShareBiomomPass1":
                case "ExplicitShareBiodadPass1":
                case "ShareBiomomPass1":
                case "ShareBiodadPass1":
                    break;
                default:
                    throw new ArgumentOutOfRangeException("dcPass1", dcPass1, "The column wasn't recognized as a valid 'Pass1' column.");
            }

            if ( ds == null ) throw new ArgumentNullException("ds");
            string select = string.Format("{0}={1} AND {2}={3} AND ({4}={5} OR {6}={7} OR {6}={5} OR {4}={7}) AND {5}<{7}",
                extendedID, ds.tblRelatedStructure.ExtendedIDColumn.ColumnName,
                (byte)RelationshipPath.Gen1Housemates, ds.tblRelatedStructure.RelationshipPathColumn.ColumnName,
                subjectTag1, ds.tblRelatedStructure.SubjectTag_S1Column.ColumnName,
                subjectTag2, ds.tblRelatedStructure.SubjectTag_S2Column.ColumnName);
            LinksDataSet.tblRelatedStructureRow[] drsStructure = (LinksDataSet.tblRelatedStructureRow[])ds.tblRelatedStructure.Select(select);
            Trace.Assert(drsStructure.Length >= 1, "At least one record should be returned.");

            PairShare[] pairs = new PairShare[drsStructure.Length];
            for ( Int32 i = 0; i < drsStructure.Length; i++ ) {
                LinksDataSet.tblRelatedStructureRow dr = drsStructure[i];
                Int32 relatedID = dr.ID;
                LinksDataSet.tblRelatedValuesRow drValue = ds.tblRelatedValues.FindByID(relatedID);
                Tristate pass1;
                if ( DBNull.Value.Equals(drValue[dcPass1]) )//if ( drValue.IsRImplicitPass1Null() )
                    pass1 = Tristate.DoNotKnow;
                else
                    pass1 = (Tristate)(drValue[dcPass1]);//pass1 = (float)drValue.RImplicitPass1;
                pairs[i] = new PairShare(dr.SubjectTag_S1, dr.SubjectTag_S2, relatedID, pass1);
            }
            return pairs;
        }