Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun committed May 7, 2024
0 parents commit 1673873
Show file tree
Hide file tree
Showing 18 changed files with 571 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: build

on:
push:
branches: [main]
pull_request:
branches: [main, staging]

jobs:
build:
runs-on: ubuntu-22.04
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: laminlabs/lndocs
ssh-key: ${{ secrets.READ_LNDOCS }}
path: lndocs
ref: main

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- run: pip install -U laminci
- run: sudo apt-get -y install graphviz

- uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- run: nox -s lint
- run: nox -s build

- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- uses: nwtgck/[email protected]
with:
publish-dir: "_build/html"
production-deploy: ${{ github.event_name == 'push' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
2 changes: 2 additions & 0 deletions .github/workflows/latest-changes.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{pr.title}} | [{{pr.number}}]({{pr.html_url}}) | [{{pr.user.login}}]({{pr.user.html_url}}) | {{pr.closed_at.date().isoformat()}} |

25 changes: 25 additions & 0 deletions .github/workflows/latest-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: latest-changes

on:
pull_request_target:
branches:
- main
types:
- closed
workflow_dispatch:
inputs:
number:
description: PR number
required: true

jobs:
latest-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://tiangolo/latest-changes:0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
latest_changes_file: docs/changelog.md
latest_changes_header: '--- \| --- \| --- \| --- \| ---\n'
template_file: ./.github/workflows/latest-changes.jinja2
108 changes: 108 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# macOS
.DS_Store
.AppleDouble
.LSOverride

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# mypy
.mypy_cache/

# IDE settings
.vscode/
.idea/

# Lamin
_build
docs/omop.*
lamin_sphinx
docs/conf.py
_docs_tmp*
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
minimum_pre_commit_version: 2.12.0
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.4
hooks:
- id: prettier
exclude: |
(?x)(
docs/changelog.md
)
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
exclude: |
(?x)(
docs/examples/|
docs/notes/
)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: detect-private-key
- id: check-ast
- id: end-of-file-fixer
exclude: |
(?x)(
.github/workflows/latest-changes.jinja2
)
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies:
["types-pkg-resources", "types-requests", "types-attrs"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OMOP: OMOP Common Data Model

## Contributing

Please run `pre-commit install` and `gitmoji -i` on the CLI before starting to work on this repository!
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

<!-- prettier-ignore -->
Name | PR | Developer | Date | Version
--- | --- | --- | --- | ---
7 changes: 7 additions & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Guide

```{toctree}
:maxdepth: 1
quickstart
```
13 changes: 13 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```{include} ../README.md
:start-line: 0
:end-line: 1
```

```{toctree}
:maxdepth: 1
:hidden:
guide
reference
changelog
```
73 changes: 73 additions & 0 deletions docs/quickstart.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "7f26a335-cf1c-4e69-be3b-0c26b154606a",
"metadata": {},
"source": [
"# Quickstart"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a51faaf3-ee27-43c6-b48d-13be1adb5c46",
"metadata": {},
"outputs": [],
"source": [
"from omop import ExampleClass, example_function"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fa758625-efb0-4047-9a03-aa534bf6f78e",
"metadata": {},
"outputs": [],
"source": [
"example_function(\"A\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ad22eec0-8f75-4e0b-a132-8a43ccb09b37",
"metadata": {},
"outputs": [],
"source": [
"ex = ExampleClass(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8bf01623-742e-425a-973d-132fc61c3d9c",
"metadata": {},
"outputs": [],
"source": [
"assert ex.bar() == \"hello\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
5 changes: 5 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Reference

```{eval-rst}
.. automodule:: omop
```
5 changes: 5 additions & 0 deletions lamin-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project_name: OMOP
description: OMOP Common Data Model
project_slug: omop
repository_name: omop
package_name: omop
21 changes: 21 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import nox
from laminci.nox import build_docs, login_testuser1, run_pre_commit, run_pytest

# we'd like to aggregate coverage information across sessions
# and for this the code needs to be located in the same
# directory in every github action runner
# this also allows to break out an installation section
nox.options.default_venv_backend = "none"


@nox.session
def lint(session: nox.Session) -> None:
run_pre_commit(session)


@nox.session()
def build(session):
session.run(*"uv pip install --system -e .[dev]".split())
login_testuser1(session)
run_pytest(session)
build_docs(session, strict=True)
Loading

0 comments on commit 1673873

Please sign in to comment.