Citations API Icon Citations API

Edge Functions serving as middleware for the Case-Explorer application. These functions handle communication between the front-end and various data sources, providing a secure and efficient way to process requests for legal case citations and network analysis.

Features

API Documentation

POST /api/network

Fetches nodes (cases) and edges (citations) based on search criteria.

Required Arguments:

Optional Arguments:

Example: Fetch a Single Case

{
    "arguments": {
        "engine": "OS",
        "eclis": ["ECLI:NL:RVS:2010:BO0794"],
        "dataSources": ["RS"],
        "degreesSource": 0,
        "degreesTarget": 0,
        "attributesToFetch": "ALL"
    }
}

Example: Keyword Search

{
    "arguments": {
        "engine": "OS",
        "keywords": "wraking",
        "dataSources": ["RS"],
        "dateStart": "2020-01-01",
        "dateEnd": "2023-12-31",
        "degreesSource": 1,
        "degreesTarget": 1,
        "docTypes": ["DEC"],
        "domains": ["STR"],
        "instances": ["Rechtbank Gelderland"],
        "attributesToFetch": "ALL"
    }
}

Response Format:

{
    "nodes": [
        {
            "id": "ECLI:NL:...",
            "data": {
                "summary": "Case summary",
                "instance": "Court name",
                "url_publication": "http://...",
                "domains": ["Legal domain"],
                "source": "Rechtspraak",
                "date_decision": "2020-05-19",
                "document_type": "Uitspraak",
                "procedure_type": "Eerste aanleg",
                "jurisdiction_country": "NL",
                "legal_provisions": ["Artikel 6"],
                "isResult": "True"
            }
        }
    ],
    "edges": [
        {
            "source": "ECLI:NL:...",
            "target": "ECLI:NL:..."
        }
    ],
    "message": "Query limit reached! Only partial result displayed."
}

POST /api/statistics

Calculates network statistics for a given set of nodes and edges.

Request Body:

{
  "nodes": [
    {
      "id": "ECLI:NL:...",
      "data": {}
    }
  ],
  "edges": [
    {
      "id": "source_target",
      "source": "ECLI:NL:...",
      "target": "ECLI:NL:..."
    }
  ]
}

Response:

{
  "ECLI:NL:...": {
    "parent": "ECLI:NL:...",
    "degree": 5,
    "in-degree": 2,
    "out-degree": 3,
    "degree centrality": 0.125,
    "in-degree centrality": 0.05,
    "out-degree centrality": 0.075,
    "relative in-degree": 0.4,
    "pageRank": 0.0234,
    "betweenness centrality": 0.0156,
    "closeness centrality": 0.3456,
    "community": 1,
    "year": 2020
  }
}

Development Documentation

Setup

  1. Clone the repository
  2. Install dependencies:
    pip install -r requirements.txt
    pip install -r requirements-dev.txt
    npm install
  3. Configure environment variables:

Testing

Run the test suite:

pytest

Deployment

Deploy to Vercel:

vercel deploy

Architecture

The project uses:

Limitations

Related Projects