Skip to content

Commit af68077

Browse files
committed
SourceAt is Nullable
1 parent adc3293 commit af68077

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

RegalyticsRegulatoryArticle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class RegalyticsRegulatoryArticle : BaseData
7979
public DateTime? RuleEffectiveDate { get; set; }
8080

8181
[JsonProperty(PropertyName = "sourced_at")]
82-
public DateTime SourcedAt { get; set; }
82+
public DateTime? SourcedAt { get; set; }
8383

8484
[JsonProperty(PropertyName = "latest_update")]
8585
public DateTime LatestUpdate { get; set; }

process.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
article['in_federal_register'] = 'yes' in article['in_federal_register'].lower()
5252
# State -> Dictionary<string, List<string>>
5353
states = {}
54-
for agency in article.get('agencies', []):
54+
agencies = article.get('agencies', [])
55+
if not agencies:
56+
agencies = []
57+
for agency in agencies:
5558
state = agency.get('state')
5659
if not state:
5760
continue
@@ -68,7 +71,7 @@
6871
country_states.extend([x['name'] for x in state])
6972

7073
article['states'] = states
71-
article['agencies'] = [agency['name'] for agency in article['agencies']]
74+
article['agencies'] = [agency['name'] for agency in agencies]
7275

7376
# search using `created_at` returns all with UTC time between 00:00-23:59 in a single day,
7477
# so it include some articles created at 20:00-00:00 in EST of the "previous day" (-04:00).

tests/RegalyticsRegulatoryArticleTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public void CloneCollection()
6060
public void BackwardCompatibilityToV2()
6161
{
6262
// The Id is a number in v2
63-
var line = "{\"id\": 2051381, \"title\": \"House of Representatives Study Bill HSB692: A bill for an act relating to school security, including by modifying provisions related to the issuance of school bonds, requiring schools to conduct school safety reviews and have access to the statewide interoperable communications system, establishing the school emergency radio access grant program and the firearm detection software grant program within the department of homeland security and emergency management, requiring the department of public (I)\", \"summary\": \"Introduced on 2024-02-12. House Study Bill 692 is a piece of legislation in Iowa that focuses on school security. It includes provisions related to the issuance of school bonds, requires schools to conduct safety reviews and have access to a statewide communications system, establishes grant programs for school emergency radio access and firearm detection software, and requires the Department of Public Safety to convene a task force on school safety standards. The bill also appropriates funds for these programs and specifies that the state cost of compliance with the legislation will be paid by school districts from state school foundation aid. The bill takes effect upon enactment. (99IA202320242022HSB692)\", \"status\": \"New\", \"classification\": \"State\", \"filing_type\": \"Single\", \"in_federal_register\": false, \"federal_register_number\": null, \"regalytics_alert_id\": \"99IA2022HSB69225120240212\", \"proposed_comments_due_date\": null, \"original_publication_date\": \"2024-02-12\", \"federal_register_publication_date\": null, \"rule_effective_date\": null, \"latest_update\": \"2024-02-12\", \"alert_type\": \"Study Bill\", \"docket_file_number\": \"\", \"order_notice\": \"\", \"sec_release_number\": \"\", \"agencies\": [\"Iowa House of Representatives\"], \"sector_type\": [{\"name\": \"Financial\"}], \"tags\": [{\"name\": \"All State and Federal Legislatures\"}, {\"name\": \"Introduced Bill\"}], \"subtype_classification\": [{\"name\": \"House of Representatives Study Bill\", \"higher_order_alert_classification\": {\"name\": \"Rule\"}}], \"pdf_url\": \"https://www.legis.iowa.gov/legislation/BillBook?ga=90&ba=HSB692\", \"created_at\": \"2024-02-12T22:31:40.567008\", \"states\": {\"United States\": [\"Iowa\"]}}";
63+
var line = "{\"id\": 2051381, \"title\": \"House of Representatives Study Bill HSB692: A bill for an act relating to school security, including by modifying provisions related to the issuance of school bonds, requiring schools to conduct school safety reviews and have access to the statewide interoperable communications system, establishing the school emergency radio access grant program and the firearm detection software grant program within the department of homeland security and emergency management, requiring the department of public (I)\", \"summary\": \"Introduced on 2024-02-12. House Study Bill 692 is a piece of legislation in Iowa that focuses on school security. It includes provisions related to the issuance of school bonds, requires schools to conduct safety reviews and have access to a statewide communications system, establishes grant programs for school emergency radio access and firearm detection software, and requires the Department of Public Safety to convene a task force on school safety standards. The bill also appropriates funds for these programs and specifies that the state cost of compliance with the legislation will be paid by school districts from state school foundation aid. The bill takes effect upon enactment. (99IA202320242022HSB692)\", \"status\": \"New\", \"classification\": \"State\", \"filing_type\": \"Single\", \"in_federal_register\": false, \"federal_register_number\": null, \"regalytics_alert_id\": \"99IA2022HSB69225120240212\", \"proposed_comments_due_date\": null, \"original_publication_date\": \"2024-02-12\", \"federal_register_publication_date\": null, \"rule_effective_date\": null, \"latest_update\": \"2024-02-12\", \"alert_type\": \"Study Bill\", \"docket_file_number\": \"\", \"order_notice\": \"\", \"sec_release_number\": \"\", \"agencies\": [\"Iowa House of Representatives\"], \"sector_type\": [{\"name\": \"Financial\"}], \"tags\": [{\"name\": \"All State and Federal Legislatures\"}, {\"name\": \"Introduced Bill\"}], \"subtype_classification\": [{\"name\": \"House of Representatives Study Bill\", \"higher_order_alert_classification\": {\"name\": \"Rule\"}}], \"pdf_url\": \"https://www.legis.iowa.gov/legislation/BillBook?ga=90&ba=HSB692\", \"created_at\": \"2024-02-12T22:31:40.567008\", \"sourced_at\": null, \"states\": {\"United States\": [\"Iowa\"]}}";
6464
var instance = new RegalyticsRegulatoryArticle();
6565
var config = new SubscriptionDataConfig(instance.GetType(), Symbol.None, Resolution.Daily, TimeZones.Utc, TimeZones.Utc, false, false, false);
6666
var data = instance.Reader(config, line, new DateTime(2024, 2, 12), false) as RegalyticsRegulatoryArticle;
6767
Assert.AreEqual("2051381", data.Id);
68-
Assert.AreEqual(DateTime.MinValue, data.SourcedAt);
68+
Assert.IsNull(data.SourcedAt);
6969
}
7070

7171
private void AssertAreEqual(object expected, object result, bool filterByCustomAttributes = false)

0 commit comments

Comments
 (0)