Skip to content

Commit

Permalink
Merge pull request #8 from tomo-oga/refactor_with_base
Browse files Browse the repository at this point in the history
Refactoring Trialsynth with Base Module
  • Loading branch information
bgyori authored Aug 13, 2024
2 parents 0c82a90 + 7f9ee31 commit 2c15cc6
Show file tree
Hide file tree
Showing 56 changed files with 2,789 additions and 2,946 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/stability_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
push:
branches: [main]
paths:
- ".github/workflows/stability_tests.yml"
- "src/*"
- .github/workflows/stability_tests.yml
- src/*
pull_request:
paths:
- ".github/workflows/stability_tests.yml"
- "src/*"
- .github/workflows/stability_tests.yml
- src/*
workflow_dispatch:

jobs:
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Install Cython dependencies
run: sudo apt update && sudo apt install -y gcc build-essential python3-dev curl

- name: Install poetry
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 -

- name: Install python dependencies
Expand Down
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ sphinx:
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
install:
- requirements: doc/requirements.txt

41 changes: 41 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.2
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.6.1
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- [email protected]
- [email protected]
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
actions:
disabled:
- trunk-announce
enabled:
- trunk-upgrade-available
- trunk-fmt-pre-commit
- trunk-check-pre-push
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

Interpretation and integration of clinical trials data from multiple registries in a computable form


## Adding registries and processors

Getting data of each registry happens via a corresponding `Processor` object, its components, and relevant methods and functions.
Users create a `Processor` by composition; some require different work than others.

Some common components include:

- Fetcher: get raw data from a source (e.g. a REST API)
- Transformer: change the data into a desired format for downstream use
- Storer: save the data to some location(s)
Expand All @@ -19,46 +19,44 @@ Some common components include:
![Processor with common components](./composition.svg)

A user can add a registry and `Processor` by test-driven development. A pattern for doing this looks like:

- Get a sample response from the API and save it to a file
- Write the test for API stability
- This can detect unexpected API behavior (e.g. changes or outages)
- This can detect unexpected API behavior (e.g. changes or outages)
- Add the file to the imposter to use as a stubbed response
- Add a new port for the stubbed service to the imposter and compose files
- Add a new port for the stubbed service to the imposter and compose files
- Write the test for the processor's end-to-end behaviors
- The input is the sample response
- The input is the sample response
- Write the components and functions to make the test pass
- Set the `url` environment variable for the `Processor` to the stub's port

- Set the `url` environment variable for the `Processor` to the stub's port

## Installation

Run the following to install this repository's package in editable mode:

```
```bash
$ git clone https://github.com/gyorilab/trialsynth
$ cd trialsynth
$ pip install -e
```


## Local run

Users can run all system components on their computers via the compose stack, wrapped by a shell script:
```

```bash
./run_e2e.sh
```


## Testing

Users can run all the suite of full system tests on their computers via the compose stack, wrapped by a shell script:
```

```bash
./test_e2e.sh
```


## References

[Test-driven development](https://tidyfirst.substack.com/p/canon-tdd)
[Mountebank](https://www.mbtest.org/)

2 changes: 1 addition & 1 deletion composition.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 8 additions & 9 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@
import os
import sys

sys.path.insert(0, os.path.join(os.path.abspath('..'), 'src'))
sys.path.insert(0, os.path.join(os.path.abspath(".."), "src"))

project = 'trialsynth'
copyright = '2024, Gyori lab'
author = 'Gyori lab'
project = "trialsynth"
copyright = "2024, Gyori lab"
author = "Gyori lab"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx.ext.autodoc"]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
Loading

0 comments on commit 2c15cc6

Please sign in to comment.