Collect lyDATA Tables Interactively#
Submodule to collect data interactively using a simple web interface.
With the simple command
lyscripts data collect
One can start a very basic web server that serves an interactive UI at
http://localhost:8000/. There, one can enter patient, tumor, and lymphatic
involvement data one by one. When completed, the “submit” button will parse, validate,
and convert the data to serve a downloadable CSV file.
The resulting CSV file is in the correct format to be used in LyProX and for inference using our lymph-model library.
- lyscripts.data.collect.serve_index_html() HTMLResponse[source]#
Serve the
index.htmlfile at the URL’s root.
- lyscripts.data.collect.serve_schema() dict[str, Any][source]#
Serve the JSON schema for the patient and tumor records.
- lyscripts.data.collect.serve_collector_js() FileResponse[source]#
Serve the
collector.jsfile under"http://{host}:{port}/collector.js".This frontend JavaScript file loads the JSON-Editor library and initializes it using the schema returned by the
serve_schema()function.
- async lyscripts.data.collect.process(data: RootModel) StreamingResponse[source]#
Process the submitted data to a DataFrame.
FastAPI will automatically parse the received JSON data into the list of instances of he pydantic type defined by the
lydata.schema.create_full_record_model()function.From this list, we create a pandas DataFrame and return it as a downloadable CSV file.
- pydantic settings lyscripts.data.collect.CollectorCLI[source]#
Bases:
BaseCLIServe a FastAPI web app for collecting involvement patterns as CSV files.
Show JSON schema
{ "title": "CollectorCLI", "description": "Serve a FastAPI web app for collecting involvement patterns as CSV files.", "type": "object", "properties": { "configs": { "default": [ "config.yaml" ], "description": "Path to the YAML file(s) that contain the configuration(s). Configs from YAML files may be overwritten by command line arguments. When multiple files are specified, the configs are merged in the order they are given. Note that every config file must have a `version: 1` key in it.", "items": { "format": "path", "type": "string" }, "title": "Configs", "type": "array" }, "hostname": { "default": "localhost", "description": "Hostname to run the FastAPI app on.", "title": "Hostname", "type": "string" }, "port": { "default": 8000, "description": "Port to run the FastAPI app on.", "title": "Port", "type": "integer" } } }
Command Help#
Usage: lyscripts data collect [-h] [--configs list[Path]] [--hostname str]
[--port int]
Serve a FastAPI web app for collecting involvement patterns as CSV files.
Options:
-h, --help show this help message and exit
--configs list[Path] Path to the YAML file(s) that contain the
configuration(s). Configs from YAML files may be
overwritten by command line arguments. When multiple
files are specified, the configs are merged in the
order they are given. Note that every config file must
have a `version: 1` key in it. (default:
['config.yaml'])
--hostname str Hostname to run the FastAPI app on. (default:
localhost)
--port int Port to run the FastAPI app on. (default: 8000)