-
-
Notifications
You must be signed in to change notification settings - Fork 148
Add Trademark Trial and Appeal Board scraper #1851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f59f32f
feat(ttab): add TTAB Reading Room scraper for precedential opinions
anseljh 339e045
Update CHANGES.md
anseljh 0ee18de
Update TTAB scraper and tests
anseljh 9a8d0e4
Update days_interval in TTAB scrapre
anseljh 64b7e25
Remove unnecessary line in TTAB scraper
anseljh be66b7e
Add author key & another misc. fix to TTAB scraper
anseljh bb07a56
Update test data for TTAB scraper
anseljh 756222c
Fix update to TTAB test data
anseljh 0d9332f
Merge branch 'main' into master
grossir 1689906
Merge branch 'main' into master
grossir 569d59b
Async updates to TTAB scraper
anseljh fd576f0
Merge branch 'main' into master
anseljh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -5,4 +5,5 @@ | |
| "mspb_p", | ||
| "mspb_u", | ||
| "olc", | ||
| "ttab", | ||
| ] | ||
99 changes: 99 additions & 0 deletions
99
juriscraper/opinions/united_states/administrative_agency/ttab.py
This file contains hidden or 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,99 @@ | ||
| """Scraper for Trademark Trial and Appeal Board (TTAB) Reading Room | ||
| CourtID: ttab | ||
| Court Short Name: TTAB | ||
| Author: Ansel Halliburton | ||
| Type: Precedential | ||
| """ | ||
|
|
||
| import json | ||
| from datetime import date, datetime | ||
|
|
||
| from juriscraper.AbstractSite import logger | ||
| from juriscraper.OpinionSiteLinear import OpinionSiteLinear | ||
|
|
||
|
|
||
| class Site(OpinionSiteLinear): | ||
| first_opinion_date = datetime(1986, 12, 23) | ||
| days_interval = 365 | ||
| TTAB_RR_BASE = "https://ttab-reading-room.uspto.gov" | ||
| TTAB_RR_API = f"{TTAB_RR_BASE}/ttab-efoia-api/decision/search" | ||
| TTAB_RR_PDF_BASE = f"{TTAB_RR_BASE}/cms/rest" | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.court_id = self.__module__ | ||
| self.url = self.TTAB_RR_API | ||
| self.method = "POST" | ||
| self.status = "Published" | ||
| self.should_have_results = True | ||
| self._search_payload = { | ||
| "dateRangeData": {}, | ||
| "facetData": {}, | ||
| "parameterData": {"precedentCitableIndicator": "Y"}, | ||
| "searchText": "", | ||
| "sortDataBag": [{"issueDate": "desc"}], | ||
| "recordStartNumber": 0, | ||
| } | ||
| self.make_backscrape_iterable(kwargs) | ||
|
|
||
| def _download(self, request_dict=None): | ||
| if self.test_mode_enabled(): | ||
| return super()._download(request_dict) | ||
| self.downloader_executed = True | ||
| response = self.request["session"].post( | ||
| self.TTAB_RR_API, | ||
| json=self._search_payload, | ||
| headers=self.request["headers"], | ||
| verify=self.request["verify"], | ||
| ) | ||
| response.raise_for_status() | ||
| self.request["response"] = response | ||
| return response.json() | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| def _process_html(self): | ||
| if self.test_mode_enabled(): | ||
| with open(self.url) as f: | ||
| data = json.load(f) | ||
| else: | ||
| data = self.html | ||
|
|
||
| results = data.get("results", []) | ||
| seen_docs = set() | ||
| for r in results: | ||
| doc_id = r.get("documentId", "") | ||
| if not doc_id or doc_id in seen_docs: | ||
| continue | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| seen_docs.add(doc_id) | ||
| self.cases.append( | ||
| { | ||
| "name": r.get("partyName", "").strip(), | ||
| "url": f"{self.TTAB_RR_PDF_BASE}{doc_id}", | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "date": r.get("issueDateStr", ""), | ||
| "docket": r.get("proceedingNumberDisplay", ""), | ||
| "judge": r.get("panelMember", "").replace(";", ", "), | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "disposition": r.get("decision", ""), | ||
| "summary": r.get("issue", ""), | ||
grossir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "status": "Published", | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ) | ||
|
|
||
| def _download_backwards(self, dates: tuple[date, date]) -> None: | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| logger.info("Backscraping for range %s %s", *dates) | ||
| self._search_payload["dateRangeData"] = { | ||
| "decisionDate": { | ||
| "from": dates[0].strftime("%Y-%m-%d"), | ||
| "to": dates[1].strftime("%Y-%m-%d"), | ||
| } | ||
| } | ||
| self._search_payload["recordStartNumber"] = 0 | ||
| self.html = self._download() | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| total = self.html.get("recordTotalQuantity", 0) | ||
| self._process_html() | ||
|
|
||
| page_size = 25 | ||
| start = page_size | ||
| while start < total: | ||
| self._search_payload["recordStartNumber"] = start | ||
| self.html = self._download() | ||
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self._process_html() | ||
| start += page_size | ||
28 changes: 28 additions & 0 deletions
28
tests/examples/opinions/united_states/ttab_example.compare.json
anseljh marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,28 @@ | ||
| [ | ||
| { | ||
| "case_dates": "2026-01-27", | ||
| "case_names": "ACME Corp.", | ||
| "download_urls": "https://ttab-reading-room.uspto.gov/cms/rest/ttab-documents/2026/01/123456.pdf", | ||
| "precedential_statuses": "Published", | ||
| "blocked_statuses": false, | ||
| "date_filed_is_approximate": false, | ||
| "dispositions": "Sustained", | ||
| "docket_numbers": "91234567", | ||
| "judges": "Judge Smith, Judge Jones, Judge Brown", | ||
| "summaries": "Likelihood of confusion", | ||
| "case_name_shorts": "ACME Corp." | ||
| }, | ||
| { | ||
| "case_dates": "2025-11-15", | ||
| "case_names": "Widgets Inc.", | ||
| "download_urls": "https://ttab-reading-room.uspto.gov/cms/rest/ttab-documents/2025/11/789012.pdf", | ||
| "precedential_statuses": "Published", | ||
| "blocked_statuses": false, | ||
| "date_filed_is_approximate": false, | ||
| "dispositions": "Dismissed", | ||
| "docket_numbers": "91234568", | ||
| "judges": "Judge Adams, Judge Baker", | ||
| "summaries": "Descriptiveness", | ||
| "case_name_shorts": "Widgets Inc." | ||
| } | ||
| ] |
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
anseljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or 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,29 @@ | ||
| { | ||
| "recordTotalQuantity": 2, | ||
| "results": [ | ||
| { | ||
| "id": 12345, | ||
| "documentId": "/ttab-documents/2026/01/123456.pdf", | ||
| "partyName": "ACME Corp.", | ||
| "proceedingNumberDisplay": "91234567", | ||
| "issueDateStr": "27-JAN-2026", | ||
| "issueDate": 1738022400000, | ||
| "decision": "Sustained", | ||
| "panelMember": "Judge Smith;Judge Jones;Judge Brown", | ||
| "issue": "Likelihood of confusion", | ||
| "precedentCitableIndicator": "Y" | ||
| }, | ||
| { | ||
| "id": 12346, | ||
| "documentId": "/ttab-documents/2025/11/789012.pdf", | ||
| "partyName": "Widgets Inc.", | ||
| "proceedingNumberDisplay": "91234568", | ||
| "issueDateStr": "15-NOV-2025", | ||
| "issueDate": 1731628800000, | ||
| "decision": "Dismissed", | ||
| "panelMember": "Judge Adams;Judge Baker", | ||
| "issue": "Descriptiveness", | ||
| "precedentCitableIndicator": "Y" | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.