Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.31 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.31 KB

OpenSAFELY SQL Runner

SQL Runner allows a platform developer to run SQL against a backend, for data development projects. Its use is governed by the OpenSAFELY Data Access Policy.

Type One Opt Out data

Unless your data development project has permission to use Type One Opt Out (T1OO) data, you should either exclude these data or explain why you haven't excluded them in a comment. Until L4 filesync is turned off and replaced by Airlock, ALL SQL Runner queries must exclude T1OO data.

To exclude T1OO data, for example:

SELECT <select_list>
FROM Patient
WHERE Patient_ID IN (SELECT Patient_ID FROM AllowedPatientsWithTypeOneDissent)
GROUP BY <group_by_clause>
ORDER BY <order_by_expression>

To explain why T1OO data haven't been excluded, for example:

-- This query is for a data development project that must include T1OO data.
-- Consequently, this query doesn't reference the AllowedPatientsWithTypeOneDissent table.
SELECT <select_list>
FROM Patient
GROUP BY <group_by_clause>
ORDER BY <order_by_expression>

Note that the table has its name for historical reasons, and reads slightly oddly: it should be interpreted as "allowed patients with regard to type one dissents".

Notes for developers

Please see DEVELOPERS.md.