Skip to contents

Parse a SIU director's-report HTML page (pure-R)

Usage

morie_siu_parse_html(html, drid = NA_integer_, source_url = NULL)

Arguments

html

Raw HTML response body.

drid

Optional integer drid from the request URL – useful when the page itself doesn't echo it.

source_url

Optional canonical URL – used to derive drid and recorded as source_url_report.

Value

A list with every SIU_COLUMNS key (NAs for unfound fields).

Examples

html <- paste0(
  "<html><body><h1>Director's Report</h1>",
  "<p>Case Number: 22-OCI-123</p>",
  "<p>Police Service: Toronto Police Service</p>",
  "<p>Date of Incident: March 5, 2022</p>",
  "<p>The Investigation</p>",
  "<p>A 35-year-old man was involved in an incident.</p>",
  "</body></html>")
r <- morie_siu_parse_html(html, drid = 1234L,
                          source_url = "https://example/foo.php?drid=1234")
r$case_number
#> [1] "22-OCI-123"