Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
markdrussell committed Aug 19, 2024
0 parents commit 5087992
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Devcontainer Configuration

This folder contains configuration files required for Codespaces/devcontainers.
Please do not modify its contents unless you know what you are doing and there
is a specific change to the devcontainer configuration you need to make.

If you believe you have a broken configuration or are unsure if you have the
latest version of the configuration, please follow the
[instructions to add codespaces to your project](https://docs.opensafely.org/getting-started/how-to/add-github-codespaces-to-your-project/).
55 changes: 55 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "OpenSAFELY",
"image": "ghcr.io/opensafely-core/research-template:v0",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"postCreateCommand": "/bin/bash /opt/devcontainer/postCreate.sh ${containerWorkspaceFolder}",
"postAttachCommand": "/bin/bash /opt/devcontainer/postAttach.sh",
"forwardPorts": [
8787
],
"portsAttributes": {
"8787": {
"label": "RStudio IDE"
}
},
// Configure tool-specific properties.
"customizations": {
"codespaces": {
"repositories": {
"opensafely/server-instructions": {
"permissions": {
"contents": "read"
}
}
}
},
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-renderers"
],
"settings": {
"extensions.ignoreRecommendations": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"git.autofetch": true,
"python.analysis.extraPaths": [".devcontainer/ehrql-main/"],
"python.defaultInterpreterPath": "/opt/venv/bin/python",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.terminal.activateEnvironment": true,
"window.autoDetectColorScheme": true
}
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"remoteEnv": {
"MAX_WORKERS": "2"
}
}
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# ensure unix line endings on windows for files that need them.
*.sh eol=lf
codelists/* eol=lf
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
17 changes: 17 additions & 0 deletions .github/workflows/test_runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test that the project is runnable

on: [push, workflow_dispatch]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_RO_TOKEN: ${{ secrets.DOCKER_RO_TOKEN }}
STATA_LICENSE: ${{ secrets.STATA_LICENSE }}
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }}
jobs:
test:
runs-on: ubuntu-latest
name: Test the project can run, using dummy data
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test that the project is runnable
uses: opensafely-core/research-action@v2
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*~
model.log
*/input.csv
__pycache__
.python-version
/output/*
metadata/*
venv/
.DS_Store
.Rhistory
.Rproj.user/
.devcontainer/ehrql-main/
25 changes: 25 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "OpenSAFELY run project",
"type": "shell",
"command": "opensafely run run_all -f",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "new",
"showReuseMessage": false,
"clear": true,
}
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) {{organisation}}

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# disease_incidence

[View on OpenSAFELY](https://jobs.opensafely.org/repo/https%253A%252F%252Fgithub.com%252Fopensafely%252Fdisease_incidence)

Details of the purpose and any published outputs from this project can be found at the link above.

The contents of this repository MUST NOT be considered an accurate or valid representation of the study or its purpose.
This repository may reflect an incomplete or incorrect analysis with no further ongoing work.
The content has ONLY been made public to support the OpenSAFELY [open science and transparency principles](https://www.opensafely.org/about/#contributing-to-best-practice-around-open-science) and to support the sharing of re-usable code for other subsequent users.
No clinical, policy or safety conclusions must be drawn from the contents of this repository.

# About the OpenSAFELY framework

The OpenSAFELY framework is a Trusted Research Environment (TRE) for electronic
health records research in the NHS, with a focus on public accountability and
research quality.

Read more at [OpenSAFELY.org](https://opensafely.org).

# Licences
As standard, research projects have a MIT license.
14 changes: 14 additions & 0 deletions analysis/dataset_definition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from ehrql import create_dataset
from ehrql.tables.tpp import patients, practice_registrations

dataset = create_dataset()

index_date = "2020-03-31"

has_registration = practice_registrations.for_patient_on(
index_date
).exists_for_patient()

dataset.define_population(has_registration)

dataset.sex = patients.sex
3 changes: 3 additions & 0 deletions codelists/codelists.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"files": {}
}
Empty file added codelists/codelists.txt
Empty file.
1 change: 1 addition & 0 deletions docs/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file added logs/.gitkeep
Empty file.
Empty file added output/.gitkeep
Empty file.
12 changes: 12 additions & 0 deletions project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.0'

# Ignore this`expectation` block. It is required but not used, and will be removed in future versions.
expectations:
population_size: 1000

actions:
generate_dataset:
run: ehrql:v1 generate-dataset analysis/dataset_definition.py --output output/dataset.csv.gz
outputs:
highly_sensitive:
dataset: output/dataset.csv.gz

0 comments on commit 5087992

Please sign in to comment.