-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rebecca Drabenstott
committed
Jul 23, 2024
1 parent
d80208b
commit c886744
Showing
11 changed files
with
137 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from .utils import catch_parse_error | ||
|
||
|
||
@catch_parse_error | ||
def parse_process_served_date(soup): | ||
""" | ||
Parse process served date | ||
Sample HTML: | ||
<div data-rem-class="roa-event-row" ng-class="::{'roa-text-strike':event.Event.IsDeleted}" class="ng-scope"> | ||
<div class="roa-inline roa-align-top roa-event-date-col ng-scope" ng-if="::!minuteEvent" style="min-width:11rem"> | ||
<div ng-transclude="" ng-class="::{'roa-text-strike': event.Event.IsDeleted}"> | ||
<span class="ng-binding ng-scope">08/12/1988</span> | ||
</div> | ||
</div> | ||
<div data-rem-class="roa-event-content" class="roa-inline roa-align-top" style="min-width:calc(100% - 24rem)"> | ||
<div> | ||
<div> | ||
<roa-documents></roa-documents> | ||
<div class="roa-data ng-isolate-scope" label="Legacy Process Served Date"> | ||
<div class="roa-label roa-inline roa-align-top ng-binding ng-scope" ng-if="::label" ng-bind="::label">Legacy Process Served Date</div> | ||
<div class="roa-value roa-inline roa-indent" ng-transclude=""></div> | ||
</div> | ||
</div> | ||
<div ng-if="::data.Options.IncludeChargeDescriptions == '1'" class="ng-scope"> | ||
<div class="roa-indent"> | ||
<table class="roa-table"> | ||
<tbody></tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<div ng-if="::data.Options.ShowTimestampCreate == '1'" class="roa-indent-2 ng-scope"> | ||
<div class="roa-data ng-isolate-scope" label="Created:"> | ||
<div class="roa-label roa-inline roa-align-top ng-binding ng-scope" ng-if="::label" ng-bind="::label">Created:</div> | ||
<div class="roa-value roa-inline roa-indent" ng-transclude=""> | ||
<span class="ng-binding ng-scope">08/12/1988 12:00 AM</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div ng-class="::$scope.checkEventDiffPriorsClass(event, 0)" data-rem-class="roa-event-content-2" class="roa-inline roa-align-top" style="min-width:11rem"></div> | ||
</div> | ||
""" # noqa | ||
|
||
# Find the div with the label 'Legacy Process Served Date'. Return None if not found. | ||
div_process_served_date = soup.find('div', {'label': 'Legacy Process Served Date'}) | ||
if not div_process_served_date: | ||
return None | ||
|
||
# Navigate up 4 parents | ||
parent_div = div_process_served_date | ||
for _ in range(4): | ||
parent_div = parent_div.find_parent() | ||
|
||
# Find the date div and extract the date value | ||
date_div = parent_div.find('div', class_='roa-event-date-col') | ||
date_span = date_div.find('span', class_='ng-binding ng-scope') | ||
date_value = date_span.text.strip() | ||
|
||
# Return date value | ||
return date_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from dear_petition.portal.etl.parsers import case_events | ||
|
||
|
||
class TestCaseEventsFullRecord: | ||
def test_parse_process_served_date(self, soup): | ||
assert case_events.parse_process_served_date(soup) == "01/03/2001" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters