Skip to content

Extend the citation lookup page to use the features of the API #24

Open
@mlissner

Description

Our new citation lookup API is really neat. It takes a blob of text, looks up the citations, and tells you what it finds:

image

Unfortunately, a member of our board, upon seeing it, had a good idea:

The API is cool, but we should eat our own dog food and make a user-friendly page where you paste any blob of text into the text box and it spits out everything that looked citation-like and either provides a normalized version (linking to our copy) or says CITATION NOT FOUND.

So this issue is to jot down some notes about it. Here's how the tool currently looks:

image

A few changes:

  1. This should now be a textarea to encourage people to paste more.

  2. At the bottom, it should get a second button that says "Analyze Citations"

  3. The text at the top currently says:

    If you have a citation you want to look up, put it in here, and we'll look it up.

    That can change to:

    Look up a citation by pasting it in or analyze all the citations in a block of text.

If somebody clicks "Look it Up" we do. Just like now.

If somebody clicks "Analyze Citations" we basically just run it against the API, either internally or via an API call if that seems worth it (I'm doubtful!).

When the response comes back, we show a page that sort of mirrors the current API response. It'll show a list of citations along with:

  1. Was it found or was there an error? If there's an error, what was it?
  2. What clusters were matched up to it? (Show them as nice links.)

Here's an API response I put together by hand that kind of shows the types of responses we can expect:

[
  {
    "citation": "576 U.S. 644",
    "normalized_citations": [
      "576 U.S. 644"
    ],
    "start_index": 22,
    "end_index": 34,
    "status": 200,
    "error_message": "",
    "clusters": [...one large cluster object here...]
  },
  {
    "citation": "1 U.S. 200",
    "normalized_citations": [
      "1 U.S. 200"
    ],
    "start_index": 0,
    "end_index": 10,
    "status": 404,
    "error_message": "Citation not found: '1 U.S. 200'",
    "clusters": []
  },
    ...250 citations would appear here, then the 251st and subsequent citations would be...
  {
    "citation": "576 U.S. 644",
    "normalized_citations": [
      "576 U.S. 644"
    ],
    "start_index": 10002,
    "end_index": 10013,
    "status": 429,
    "error_message": "Too many citations requested.",
    "clusters": []
  },
  {
    "citation": "576 US 644",
    "normalized_citations": [
      "576 U.S. 644"
    ],
    "start_index": 1,
    "end_index": 11,
    "status": 200,
    "error_message": "",
    "clusters": [...one cluster here...]
  },
  {
    "citation": "1 H. 150",
    "normalized_citations": [
      "1 Handy 150",
      "1 Haw. 150",
      "1 Hill 150"
    ],
    "start_index": 0,
    "end_index": 8,
    "status": 300,
    "clusters": [...two clusters here...]
  }
]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions