API Reference

Contents

API Reference#

Props#

class port.api.props.PropsUIDataSubmissionButtons(donate_question: Translatable | None = None, donate_button: Translatable | None = None, waiting: bool = False)#

Buttons for data submission actions

donate_question#

Optional question text above buttons

Type:

port.api.props.Translatable | None

donate_button#

Optional text for donate button

Type:

port.api.props.Translatable | None

waiting#

Whether the data submission is in progress

Type:

bool

class port.api.props.PropsUIFooter(progressPercentage: float)#

Page footer

progressPercentage#

float indicating the progress in the flow

Type:

float

class port.api.props.PropsUIHeader(title: Translatable)#

Page header

title#

title of the page

Type:

port.api.props.Translatable

class port.api.props.PropsUIPageDataSubmission(platform: str, header: PropsUIHeader, body: PropsUIPromptRadioInput | PropsUIPromptConsentForm | PropsUIPromptFileInput | PropsUIPromptConfirm | PropsUIPromptProgress | PropsUIPromptHelloWorld | PropsUIPromptConsentFormTable | PropsUIDataSubmissionButtons | list | Any)#

A multi-purpose page that gets shown to the user

platform#

the platform name the user is curently in the process of donating data from

Type:

str

header#

page header

Type:

port.api.props.PropsUIHeader

body#

main body of the page, see the individual classes for an explanation

Type:

port.api.props.PropsUIPromptRadioInput | port.api.props.PropsUIPromptConsentForm | port.api.props.PropsUIPromptFileInput | port.api.props.PropsUIPromptConfirm | port.api.props.PropsUIPromptProgress | port.api.props.PropsUIPromptHelloWorld | port.api.props.PropsUIPromptConsentFormTable | port.api.props.PropsUIDataSubmissionButtons | list | Any

class port.api.props.PropsUIPageError(message: str)#

An error page to show when something goes wrong

class port.api.props.PropsUIPromptConfirm(text: Translatable, ok: Translatable, cancel: Translatable)#

Retry submitting a file page

Prompt the user if they want to submit a new file. This can be used in case a file could not be processed.

text#

message to display

Type:

port.api.props.Translatable

ok#

message to display if the user wants to try again

Type:

port.api.props.Translatable

cancel#

message to display if the user wants to continue regardless

Type:

port.api.props.Translatable

class port.api.props.PropsUIPromptConsentForm(tables: list[PropsUIPromptConsentFormTable], description: Translatable | None = None, donate_question: Translatable | None = None, donate_button: Translatable | None = None)#

Tables to be shown to the participant prior to data submission

tables#

a list of tables, including both editable and read-only tables

Type:

list[port.api.props.PropsUIPromptConsentFormTable]

description#

Optional description text

Type:

port.api.props.Translatable | None

donate_question#

Optional question text for data submission button

Type:

port.api.props.Translatable | None

donate_button#

Optional text for data submission button

Type:

port.api.props.Translatable | None

class port.api.props.PropsUIPromptConsentFormTable(id: str, number: int, title: Translatable, description: Translatable, data_frame: pandas.DataFrame, data_frame_max_size: int = 10000, headers: dict[str, Translatable] | None = None)#

Table to be shown to the participant prior to data_submission

It is truncated to a maximum number of rows to avoid overloading the UI.

id#

a unique string to itentify the table after donation

Type:

str

number#

the number of table in the list of tables

Type:

int

title#

title of the table

Type:

port.api.props.Translatable

description#

description of the table

Type:

port.api.props.Translatable

data_frame#

table to be shown

Type:

pandas.DataFrame

data_frame_max_size#

maximum size of the table (in rows)

Type:

int

headers#

optional headers for the table columns

Type:

dict[str, port.api.props.Translatable] | None

class port.api.props.PropsUIPromptFileInput(description: Translatable, extensions: str)#

Prompt the user to submit a file

description#

text with an explanation

Type:

port.api.props.Translatable

extensions#

accepted mime types, example: “application/zip, text/plain”

Type:

str

class port.api.props.PropsUIPromptHelloWorld(text: Translatable)#

Hello world component to welcome users

text#

welcome message to display

Type:

port.api.props.Translatable

class port.api.props.PropsUIPromptProgress(description: Translatable, message: str, percentage: int | None = None)#

Prompt the user information during the extraction

description#

text with an explanation

Type:

port.api.props.Translatable

message#

can be used to show extraction progress

Type:

str

class port.api.props.PropsUIPromptRadioInput(title: Translatable, description: Translatable, items: list[RadioItem])#

Radio group

This radio group can be used get a mutiple choice answer from a user

title#

title of the radio group

Type:

port.api.props.Translatable

description#

short description of the radio group

Type:

port.api.props.Translatable

items#

a list of radio buttons

Type:

list[port.api.props.RadioItem]

class port.api.props.PropsUIPromptText(text: Translatable, title: Translatable | None = None)#

Text block to display information to the user

title#

optional title for the text block

Type:

port.api.props.Translatable | None

text#

main text content to display

Type:

port.api.props.Translatable

class port.api.props.RadioItem#

Radio button

id#

id of radio button

Type:

int

value#

text to be displayed

Type:

str

class port.api.props.Translatable(translations: Translations)#

Wrapper class for Translations

class port.api.props.Translations#

Typed dict containing text displayed in a specific language.

en and nl are required. Additional languages are optional. The feldspar Translator falls back gracefully for missing locales.

en#

English string to display

Type:

str

nl#

Dutch string to display

Type:

str

es#

Spanish string to display (optional)

Type:

str

Extraction helpers#

Port helpers#

Validation#

FlowBuilder#

Upload safety#