Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions app/logo.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
api_logo = """\
██████╗ ██████╗ ██████╗ █████╗ ██████╗ ██╗
██╔══██╗██╔══██╗██╔════╝ ██╔══██╗██╔══██╗██║
██████╔╝██████╔╝██║ █████╗ ███████║██████╔╝██║
██╔══██╗██╔══██╗██║ ╚════╝ ██╔══██║██╔═══╝ ██║
██║ ██║██████╔╝╚██████╗ ██║ ██║██║ ██║
╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝\
▄▄▄▄ ▄▄▄▄ ▄▄▄▄ ▄▄▄ ▄▄▄▄ ▄▄
██▄█▄ ██▄██ ██▀▀▀ ▄▄▄ ██▀██ ██▄█▀ ██
██ ██ ██▄█▀ ▀████ ██▀██ ██ ██ \
"""


cli_logo = """\
██████╗ ██████╗ ██████╗ ██████╗██╗ ██╗
██╔══██╗██╔══██╗██╔════╝ ██╔════╝██║ ██║
██████╔╝██████╔╝██║ █████╗ ██║ ██║ ██║
██╔══██╗██╔══██╗██║ ╚════╝ ██║ ██║ ██║
██║ ██║██████╔╝╚██████╗ ╚██████╗███████╗██║
╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝╚══════╝╚═╝\
▄▄▄▄ ▄▄▄▄ ▄▄▄▄ ▄▄▄▄ ▄▄ ▄▄
██▄█▄ ██▄██ ██▀▀▀ ▄▄▄ ██▀▀▀ ██ ██
██ ██ ██▄█▀ ▀████ ▀████ ██▄▄▄ ██ \
"""


Expand Down
98 changes: 48 additions & 50 deletions app/schema/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
title: Blind Charging API
description: |
This API lets an application communicate with the CPL Blind Charging module via an HTTP REST API.
version: 0.8.1
version: 0.9.0
contact:
name: Joe Nudell
email: jnudell@hks.harvard.edu
Expand Down Expand Up @@ -702,6 +702,49 @@ components:
TEXT: "#/components/schemas/DocumentText"
BASE64: "#/components/schemas/DocumentContent"

UnidentifiedDocumentLink:
type: object
description: |
Link-based input without a caller-provided document ID.
required:
- attachmentType
- url
properties:
attachmentType:
type: string
enum:
- LINK
url:
type: string
format: uri

UnidentifiedDocumentContent:
type: object
description: |
Base64 input without a caller-provided document ID.
required:
- attachmentType
- content
properties:
attachmentType:
type: string
enum:
- BASE64
content:
type: string

UnidentifiedInputDocument:
description: |
Document input that omits `documentId`. Supports URL and base64 payloads.
oneOf:
- $ref: "#/components/schemas/UnidentifiedDocumentLink"
- $ref: "#/components/schemas/UnidentifiedDocumentContent"
discriminator:
propertyName: attachmentType
mapping:
LINK: "#/components/schemas/UnidentifiedDocumentLink"
BASE64: "#/components/schemas/UnidentifiedDocumentContent"

BlindReviewInfo:
type: object
required:
Expand Down Expand Up @@ -1179,61 +1222,16 @@ components:

# --- Extraction schemas ---

ExtractionDocumentLink:
type: object
description: |
PDF document supplied by URL for extraction. Unlike `DocumentLink`,
`documentId` is omitted because the document identifier is not known
until after extraction is accepted.
required:
- attachmentType
- url
properties:
attachmentType:
type: string
enum:
- LINK
url:
type: string
format: uri

ExtractionDocumentContent:
type: object
description: |
PDF document supplied as base64 for extraction. Unlike `DocumentContent`,
`documentId` is omitted because the document identifier is not known
until after extraction is accepted.
required:
- attachmentType
- content
properties:
attachmentType:
type: string
enum:
- BASE64
content:
type: string

ExtractionInputDocument:
description: |
An input document for extraction. Only PDF documents are supported,
provided either as a URL or base64-encoded content.
oneOf:
- $ref: "#/components/schemas/ExtractionDocumentLink"
- $ref: "#/components/schemas/ExtractionDocumentContent"
discriminator:
propertyName: attachmentType
mapping:
LINK: "#/components/schemas/ExtractionDocumentLink"
BASE64: "#/components/schemas/ExtractionDocumentContent"

ExtractionTarget:
type: object
required:
- document
properties:
document:
$ref: "#/components/schemas/ExtractionInputDocument"
description: |
Input document to extract from, without requiring a caller-supplied
`documentId`.
$ref: "#/components/schemas/UnidentifiedInputDocument"
callbackUrl:
type: string
format: uri
Expand Down
6 changes: 2 additions & 4 deletions app/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ All of the code in `./generated` is generated from code in `./schema`.

To run code generation, make sure you have the `fastapi-codegen` repo cloned.

**Note 1** [Joe's fork of the repo](https://github.com/jnu/fastapi-code-generator)
**Note** [Joe's fork of the repo](https://github.com/jnu/fastapi-code-generator)
still has a couple more useful features that haven't been merged into upstream branch.

**Note 2** FastAPI code gen uses `poetry` for package management, so you will need to install that and use it to run the code generator.

```zsh
# Set this to the path where this repo is checked out.
BCAPI_ROOT=../../comppolicylab/blind-charging-api
poetry run python -m fastapi_code_generator -i "$BCAPI_ROOT/app/schema/openapi.yaml" -o "$BCAPI_ROOT/app/server/generated" -r -t "$BCAPI_ROOT/app/schema/templates" -d pydantic_v2.BaseModel -p 3.13
uv run python -m fastapi_code_generator -i "$BCAPI_ROOT/app/schema/openapi.yaml" -o "$BCAPI_ROOT/app/server/generated" -r -t "$BCAPI_ROOT/app/schema/templates" -d pydantic_v2.BaseModel -p 3.13
```

### Implementations
Expand Down
Loading
Loading