Opinion pages and publishing
The opinion-page application gives the public one place to find, read, cite, and download legal opinions. It also presents court dockets and source documents, provides selected courts with publishing portals, and exposes docket updates through feeds. Its pages connect case records with search, citation, source, and document services. The case-law-data page gives the wider data model; citation-analysis and opinion-ingestion cover related systems.
Opinion records
An opinion record groups case information with one or more written opinions. The public case page shows the court, case name, date, docket number, status, judges, author, citations, and available opinion text.
The main route is /opinion/<id>/<slug>/. The ID selects the record. The slug makes the link readable. Old links can move to a replacement record when a record was deleted. A sealed replacement returns a gone response. A missing replacement stays unavailable.
The page shows structured case data before the opinions in display order. It uses the best available text and can fall back to scanned XML or plain text. The PDF view presents available files, including separate lead, concurrence, and dissent files when the record has them. Superseded opinion versions do not replace the current downloadable version. References: cl/…/decorators.py• L16-59, cl/…/utils.py• L181-213, cl/…/utils.py• L770-786, cl/…/utils.py• L940-989, cl/…/views.py• L1189-1228, cl/…/tests.py• L181-215, cl/…/tests.py• L440-489
Opinion routes
Opinion routes expose the main record and focused views of related legal information. Each view keeps the same case ID and readable slug so users can move between views without losing case context.
| Route purpose | Public use |
|---|---|
| Opinion | Read case text and front matter. |
| Authorities | Review authorities cited by the opinion. |
| Cited By | Find opinions that cite the case. |
| Summaries | Read grouped parenthetical summaries from other cases. |
| Similar Cases | Explore cases with similar text. |
| View or download available opinion files. |
The tab bar can load counts and availability after the main page. Authorities and summaries use stored case relations. Cited-by and similar-case views use indexed opinion data and can be limited by feature flags, cache state, or search timeouts. A direct tab route still defines the page when a tab has no results. References: cl/…/views.py• L1118-1185, cl/…/views.py• L1231-1360, cl/…/utils.py• L982-1066, cl/…/utils.py• L1096-1400, cl/…/tests.py• L217-305, cl/…/tests.py• L350-437
The following diagram shows how one case request becomes a public record or a related view.
flowchart LR
Request[Case request] --> Record[Opinion record]
Record --> Context[Shared case context]
Context --> Text[Opinion text]
Context --> Tabs[Related views and counts]
Tabs --> Authorities[Authorities]
Tabs --> CitedBy[Cited By]
Tabs --> Summaries[Summaries]
Tabs --> Similar[Similar Cases]
Tabs --> PDF[PDF]
Opinion discovery
Court pages help users find recent decisions for selected courts. They send the request to the broader opinion search experience and show results from the last 28 days in newest-first order. A paired court page can show both Tennessee workers' compensation courts.
The same pages can offer an approved court partner a path to publish a decision. Court seals and court-specific text explain which court the page represents and who can use its publishing path. References: cl/…/views.py• L137-199
Publishing forms
The publishing portal lets an approved court user submit a decision and its core case data. The shared form asks for a case title, docket number, publication date, and opinion PDF. Court-specific forms add metadata for each partner, such as judges, author, panel, disposition, summary, neutral citation, or a source download link.
The portal treats a submission as direct court input. After validation, it creates the public case record and starts content extraction so the opinion can appear on its case page.
The publishing flow is:
- An authorized user opens a court portal.
- The user submits case data and a PDF.
- The form checks the file and court-specific data.
- The application creates the docket, opinion record, opinion, and citation data.
- Content extraction makes the new opinion ready for public display.
The form accepts only a valid PDF within the size limit. It rejects duplicate files and duplicate neutral citations. It removes HTML from free-text fields before the data becomes public. Access is limited to staff, superusers, or the uploader group for the selected court. The form contract also allows court panels with fewer than the usual number of judges. References: cl/…/forms.py• L163-233, cl/…/forms.py• L441-590, cl/…/forms.py• L593-877, cl/…/views.py• L202-299, cl/…/tests.py• L2695-3147
Docket pages
A docket page presents the filings and documents for a case. It combines case metadata with a source-specific entry list, document actions, related tabs, alerts, notes, and CSV export.
The main route is /docket/<id>/<slug>/. Users can filter by entry number or filed date and sort in either direction. The page shows 100 entries at a time. Each entry can link to a local CourtListener file or to the source system when no local file exists.
Related docket views appear when their data exists:
- Parties and Attorneys
- FJC Integrated Database
- Authorities
- Individual docket documents and their authorities
The shared docket context keeps the tab list, metadata, source controls, alerts, and notes consistent across every docket tab. The Cotton presentation shows the same context with responsive desktop tabs and a mobile section selector. A design flag can select the newer docket and party presentations while legacy pages remain available during the transition. The Parties and Attorneys tab groups parties by type and presents attorneys, firms, roles, termination dates, and criminal case data when present. It pages 1,000 party-type records at a time. References: cl/…/utils.py• L706-973, cl/…/utils.py• L1017-1137, cl/…/views.py• L374-471, cl/…/views.py• L482-562, cl/…/docket_page.html• L240-277, cl/…/v2_docket_parties.html• L22-134, cl/…/tests.py• L1703-1825, cl/…/tests.py• L4445-4856
Docket-entry sources
DocketEntrySource is the source contract for a docket. It tells the presentation layer how to find, order, label, link, and describe entries and documents. The shared docket flow uses RECAP/PACER by default and uses a separate source for Supreme Court records.
| Source | Public presentation |
|---|---|
| RECAP | Shows RECAP entries and documents. Local files download from CourtListener. Missing files can link to PACER, and the page explains that RECAP data may not be current. |
| SCOTUS | Shows Supreme Court entries and non-placeholder documents. Missing files can link to the Supreme Court site. The page identifies the source as real time and does not offer PACER payment actions. |
The source choice also controls empty-state text, metadata, document actions, the representative document in a feed, and the page components used to render an entry. Internal document detail links stay on CourtListener. External source links are checked before they reach the public page. Source assignments cover every court listed by the search sources, without overlapping source ownership. This lets one docket experience support different data coverage and access rules. References: cl/…/utils.py• L842-932, cl/…/views.py• L356-369, cl/…/views.py• L723-871, cl/…/tests.py• L1828-2061, cl/…/tests.py• L2163-2348, cl/…/tests.py• L4348-4417
Docket feeds
Each docket has an Atom feed at /docket/<id>/feed/. The feed publishes the 30 most recent dated entries in descending order and links each item to its row on the docket page.
An item uses its entry number when one exists. Otherwise it identifies a minute entry by date. Its description comes from the entry or its representative document. A numbered entry can include a local PDF enclosure. When no local file exists, the enclosure can use the source's external document URL. Minute entries and entries without a representative document have no enclosure. The feed is cached for five minutes and ignores unrelated query parameters when it selects a cached response. References: cl/…/feeds.py• L17-128, cl/…/views.py• L473-479, cl/…/tests.py• L3823-4049, cl/…/tests.py• L4051-4107
Public templates
Opinion and docket templates turn shared page data into readable public records. They provide page titles, descriptions, canonical links, social metadata, source attribution, direct links, and accessible alternatives when a browser cannot display a file.
Opinion pages focus on the case caption and text. Docket pages focus on the case name, court, metadata, entry timeline, and source-specific actions. Local CourtListener links remain distinct from external source links so users can see where a file is hosted and which access rules apply. The Cotton docket presentation also exposes alerts, CSV export, oral-argument recordings, and responsive tab navigation. The newer parties presentation keeps party, attorney, and criminal-charge blocks as named accessible groups, decodes stored HTML entities once, and shows edit links only for users with matching permissions. The newer docket presentation keeps copyable case values, source metadata, and view-count behavior consistent with the legacy page. References: cl/…/utils.py• L121-284, cl/…/utils.py• L780-901, cl/…/docket_page.html• L17-204, cl/…/v2_docket_parties.html• L23-133, cl/…/tests.py• L3323-3524, cl/…/tests.py• L4862-5059, cl/…/tests.py• L5062-5244
Change checklist
When these files or sections are changed, remember to consider these:
- Keep opinion routes, replacement redirects, canonical links, and tab links aligned.
- Keep each court portal's fields aligned with the metadata used to create a public opinion record.
- Keep upload permissions aligned with the court pages and the court-specific form map.
- Keep source ordering, representative-document rules, feed enclosures, and docket-row anchors aligned.
- Keep internal document links separate from validated external source links.
- Keep shared docket context and tab state aligned across the legacy, Cotton, and newer party presentations.
- Keep party-group data, pagination, accessible labels, and permission-gated edit links aligned between party view data and both party templates.
- Keep source-specific document behavior aligned across docket rows, document pages, and feeds.
- Keep the docket feed cache behavior aligned with its URL and freshness contract.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A deleted opinion has a sealed replacement or no replacement. | The old link can return the wrong status or expose stale data. | Use the cluster redirection record and preserve the sealed-record response. |
| A portal accepts a non-PDF, duplicate file, or duplicate neutral citation. | The public record can be invalid or repeated. | Validate PDF content, size, file hash, and citation uniqueness before save. |
| A docket source has no representative document for an entry. | The entry has no download action or feed enclosure. | Keep the entry visible and omit the action or enclosure when no document exists. |
| A source uses an external URL as a local document detail link. | A docket row can expose an unchecked third-party URL as a CourtListener link. | Build internal detail links locally and validate external source links. |
| Related-case search is disabled or times out. | Counts or result lists can be empty even when indexed data exists. | Use the feature flag and cache-aware result state, then present the view as search-dependent. |
| The Supreme Court page flag is off. | Supreme Court docket and document pages are unavailable. | Apply the shared source access check to every related docket view. |
| The party view data and one presentation template diverge. | Parties, attorneys, criminal data, or edit controls can disappear in one design. | Keep normalized party groups and both legacy and v2 templates covered by the presentation contract. |
| A feed URL changes without its cache key or invalidation rules changing. | A stale feed can persist or cache entries can be missed. | Keep the feed route, cache decorator, and cache-key behavior under one contract. |
Key files
| File | Why to read it |
|---|---|
| cl/…/views.py | Shows how requests become court, opinion, docket, document, feed, citation, and publishing responses. |
| cl/…/decorators.py | Defines replacement redirects and gone responses for deleted or sealed opinion records. |
| cl/…/forms.py | Defines citation lookup, docket filters, and court-specific publishing contracts. |
| cl/…/utils.py | Builds shared opinion and docket context, metadata, party groups, tabs, downloads, and related-search results. |
| cl/…/docket_entry_sources.py | Defines source rules shared by docket pages, document pages, and feeds. |
| cl/…/feeds.py | Defines the public Atom representation of docket updates. |
| cl/…/opinions.html | Shows the public opinion record shell and case metadata. |
| cl/…/docket_page.html | Shows the responsive docket header, actions, metadata, recordings, and tabs. |
| cl/…/docket_parties.html | Shows the legacy Parties and Attorneys presentation. |
| cl/…/v2_docket_parties.html | Shows the newer accessible Parties and Attorneys presentation. |
| cl/…/de_list.html | Shows how docket entries and documents become public rows and actions. |
| cl/…/publish.html | Shows the court upload portal and validation feedback. |
| cl/…/tests.py | Verifies routes, source-specific document behavior, publishing validation, feeds, party data, cache behavior, and presentation contracts. |