Пример #1
0
        private ScotusVoteTotal parseVote(ScotusVoteTotal voteTotal, ScotusRow vote)
        {
            if (vote.majority == 1)
            {
                voteTotal.MinorityVotes.Add(vote.justice);
            }
            else if (vote.majority == 2)
            {
                voteTotal.MajorityVotes.Add(vote.justice);
            }

            return(voteTotal);
        }
Пример #2
0
        private ObservableCollection <Case> SortOutScotusData(List <ScotusRow> rawData)
        {
            Dictionary <string, Case> allCases = new Dictionary <string, Case>();

            foreach (ScotusRow sr in rawData)
            {
                // if it doesn't have this case yet, populate the case
                if (!allCases.ContainsKey(sr.caseId))
                {
                    var newCase = new Case()
                    {
                        CaseId           = sr.caseId,
                        Court            = sr.chief,
                        DecisionDate     = sr.dateDecision,
                        ArgumentDate     = sr.dateArgument,
                        Term             = sr.term,
                        CaseName         = sr.caseName,
                        OpinionWriterId  = sr.majOpinWriter,
                        PartisanDecision = sr.decisionDirection
                    };
                    var voteDetail = new ScotusVoteTotal()
                    {
                        CaseId        = sr.caseId,
                        MajorityCount = sr.majVotes,
                        MinorityCount = sr.minVotes,
                        IsEqualVote   = sr.minVotes == sr.majVotes
                    };
                    newCase.VoteDetails = voteDetail;
                    newCase.Dockets.Add(sr.docketId);
                    allCases.Add(sr.caseId, newCase);
                }

                if (allCases[sr.caseId].Dockets[0] == sr.docketId)
                {
                    if (sr.majority == 2)
                    {
                        allCases[sr.caseId].VoteDetails.MajorityVotes.Add(sr.justice);
                    }
                    else if (sr.majority == 1)
                    {
                        allCases[sr.caseId].VoteDetails.MinorityVotes.Add(sr.justice);
                    }
                }
                else if (allCases[sr.caseId].Dockets.FirstOrDefault(d => d == sr.docketId) == null)
                {
                    allCases[sr.caseId].Dockets.Add(sr.docketId);
                }
            }
            var casesAsList   = new ObservableCollection <Case>();
            int typicalSplit  = 0;
            int atypicalSplit = 0;

            foreach (KeyValuePair <string, Case> kvp in allCases)
            {
                kvp.Value.VoteDetails.ParseVotes();
                if (kvp.Value.VoteDetails.MajorityCount <= 9)
                {
                    if (kvp.Value.Court == "Roberts")
                    {
                        kvp.Value.VoteSplit = Case.EvalSplit(kvp.Value.VoteDetails);
                        if (kvp.Value.VoteSplit == VoteResult.TypicalSplit)
                        {
                            typicalSplit++;
                        }
                        if (kvp.Value.VoteSplit == VoteResult.NonTypicalSplit)
                        {
                            atypicalSplit++;
                        }
                        casesAsList.Add(kvp.Value);
                    }

                    //casesAsList.Add(kvp.Value);
                }
            }

            Debug.WriteLine("Typical Split Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.TypicalSplit));
            Debug.WriteLine("ATypical Split Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.NonTypicalSplit));
            Debug.WriteLine("Unanimous Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.Unanimous));
            Debug.WriteLine("Mixed Minority Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.MixedMinority));
            Debug.WriteLine("Con Minority Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.ConMinority));
            Debug.WriteLine("Lib Minority Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.LibMinority));
            Debug.WriteLine("Single Dissent Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.SingleDissent));


            return(casesAsList);
        }