Skip to content

Commit

Permalink
Added member comparison endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
babelshift committed Feb 16, 2017
1 parent 4c06a41 commit 7317789
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 43 deletions.
5 changes: 5 additions & 0 deletions ProPublicaCongressAPI/AutoMapperConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public static void Initialize()
return dateTimeVoted;
}));
x.CreateMap<InternalModels.MemberVotesContainer, Contracts.MemberVotesContainer>();

x.CreateMap<InternalModels.MemberVoteComparison, Contracts.MemberVoteComparison>();

x.CreateMap<InternalModels.MemberBillSponsorshipComparison, Contracts.MemberBillSponsorshipComparison>();
x.CreateMap<InternalModels.MemberBillSponsorshipComparisonContainer, Contracts.MemberBillSponsorshipComparisonContainer>();
});

}
Expand Down
29 changes: 29 additions & 0 deletions ProPublicaCongressAPI/Contracts/MemberBillSponsorshipComparison.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

namespace ProPublicaCongressAPI.Contracts
{
public class MemberBillSponsorshipComparison
{
public string Number { get; set; }

public string BillDetailUrl { get; set; }

public string Title { get; set; }

public string SponsorMemberDetailUrl { get; set; }

public DateTime DateIntroduced { get; set; }

public int CosponsorCount { get; set; }

public string Committees { get; set; }

public DateTime DateLatestMajorAction { get; set; }

public string LatestMajorAction { get; set; }

public DateTime DateFirstMember { get; set; }

public DateTime DateSecondMember { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;

namespace ProPublicaCongressAPI.Contracts
{
public class MemberBillSponsorshipComparisonContainer
{
public string FirstMemberDetailUrl { get; set; }

public string SecondMemberDetailUrl { get; set; }

public string Chamber { get; set; }

public int Congress { get; set; }

public int CommonBillCount { get; set; }

public IReadOnlyCollection<MemberBillSponsorshipComparison> Bills { get; set; }
}
}
25 changes: 25 additions & 0 deletions ProPublicaCongressAPI/Contracts/MemberVoteComparison.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace ProPublicaCongressAPI.Contracts
{
public class MemberVoteComparison
{
public string FirstMemberId { get; set; }

public string FirstMemberDetailUrl { get; set; }

public string SecondMemberId { get; set; }

public string SecondMemberDetailUrl { get; set; }

public int Congress { get; set; }

public string Chamber { get; set; }

public int AgreeVoteCount { get; set; }

public int DisagreeVoteCount { get; set; }

public double AgreeVotePercent { get; set; }

public double DisagreeVotePercent { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Newtonsoft.Json;
using System;

namespace ProPublicaCongressAPI.InternalModels
{
public class MemberBillSponsorshipComparison
{
[JsonProperty("number")]
public string Number { get; set; }

[JsonProperty("api_uri")]
public string BillDetailUrl { get; set; }

[JsonProperty("title")]
public string Title { get; set; }

[JsonProperty("sponsor_uri")]
public string SponsorMemberDetailUrl { get; set; }

[JsonProperty("introduced_date")]
public DateTime DateIntroduced { get; set; }

[JsonProperty("cosponsors")]
public int CosponsorCount { get; set; }

[JsonProperty("committees")]
public string Committees { get; set; }

[JsonProperty("latest_major_action_date")]
public DateTime DateLatestMajorAction { get; set; }

[JsonProperty("latest_major_action")]
public string LatestMajorAction { get; set; }

[JsonProperty("first_member_date")]
public DateTime DateFirstMember { get; set; }

[JsonProperty("second_member_date")]
public DateTime DateSecondMember { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace ProPublicaCongressAPI.InternalModels
{
internal class MemberBillSponsorshipComparisonContainer
{
[JsonProperty("first_member_api_uri")]
public string FirstMemberDetailUrl { get; set; }

[JsonProperty("second_member_api_uri")]
public string SecondMemberDetailUrl { get; set; }

[JsonProperty("chamber")]
public string Chamber { get; set; }

[JsonProperty("congress")]
public int Congress { get; set; }

[JsonProperty("common_bills")]
public int CommonBillCount { get; set; }

[JsonProperty("bills")]
public IReadOnlyCollection<MemberBillSponsorshipComparison> Bills { get; set; }
}
}
37 changes: 37 additions & 0 deletions ProPublicaCongressAPI/InternalModels/MemberVoteComparison.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Newtonsoft.Json;

namespace ProPublicaCongressAPI.InternalModels
{
internal class MemberVoteComparison
{
[JsonProperty("first_member_id")]
public string FirstMemberId { get; set; }

[JsonProperty("first_member_api_uri")]
public string FirstMemberDetailUrl { get; set; }

[JsonProperty("second_member_id")]
public string SecondMemberId { get; set; }

[JsonProperty("second_member_api_uri")]
public string SecondMemberDetailUrl { get; set; }

[JsonProperty("congress")]
public int Congress { get; set; }

[JsonProperty("chamber")]
public string Chamber { get; set; }

[JsonProperty("common_votes")]
public int AgreeVoteCount { get; set; }

[JsonProperty("disagree_votes")]
public int DisagreeVoteCount { get; set; }

[JsonProperty("agree_percent")]
public double AgreeVotePercent { get; set; }

[JsonProperty("disagree_percent")]
public double DisagreeVotePercent { get; set; }
}
}
6 changes: 6 additions & 0 deletions ProPublicaCongressAPI/ProPublicaCongressAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@
<Compile Include="AutoMapperConfiguration.cs" />
<Compile Include="Contracts\Chamber.cs" />
<Compile Include="Contracts\CurrentMember.cs" />
<Compile Include="Contracts\MemberBillSponsorshipComparison.cs" />
<Compile Include="Contracts\MemberBillSponsorshipComparisonContainer.cs" />
<Compile Include="Contracts\MemberVote.cs" />
<Compile Include="Contracts\MemberVoteBill.cs" />
<Compile Include="Contracts\MemberVoteComparison.cs" />
<Compile Include="Contracts\MemberVotesContainer.cs" />
<Compile Include="Contracts\NewMember.cs" />
<Compile Include="Contracts\NewMembersContainer.cs" />
<Compile Include="InternalModels\CurrentMember.cs" />
<Compile Include="InternalModels\MemberBillSponsorshipComparison.cs" />
<Compile Include="InternalModels\MemberBillSponsorshipComparisonContainer.cs" />
<Compile Include="InternalModels\MemberVote.cs" />
<Compile Include="InternalModels\MemberVoteBill.cs" />
<Compile Include="InternalModels\MemberVoteComparison.cs" />
<Compile Include="InternalModels\MemberVotesContainer.cs" />
<Compile Include="InternalModels\NewMember.cs" />
<Compile Include="InternalModels\NewMembersContainer.cs" />
Expand Down
Loading

0 comments on commit 7317789

Please sign in to comment.