Be Demonstrably Correct {#demonstrably_correct}

(ref:demonstrablycorrect-intro)

You Must - (ref:demonstrablycorrect-must)

You Should - (ref:demonstrablycorrect-should)

You Could - (ref:demonstrablycorrect-could)

|Related Areas: | Version Control
Be Reproducible | |--------------- |------------------------------------------------------------|

Quality Assurance Applies to Code {#qa_code_too}

Just because you have written code rather then making a spreadsheet doesnt mean your analysis is correct. Code is not exempt from Quality Assurance processes. As with any other analysis you need to record evidence that your code is:

You should refer to the Analytical Modelling Oversight Committee (AMOC) Quality Assurance (QA) materials which contain useful prompts and frameworks for quality assuring analysis of different size, importance and complexity.

Testing Frameworks {#unit_tests}

Your code and analysis will grow and evolve. You wont have time to QA every version, and it can be tricky to keep track of which bits of QA have been made obsolete due to new or changed code.

There are frameworks which help you construct and run tests on units of your code. These can be a good way to demonstrate that code is working correctly as you update it.

See R at DHSC and Python at DHSC for more details.

Version Control Integration

Having unit tests, and QA is good. Ideally however you can tie a particular result to a particular version of the QA'd and tested code. You could do this manually, by keeping the code for each set of outputs.

Using git for version control makes this process easy. You can:

Reproducible Analytical Pipelines {#rap_demonstrable}

Once you have some QA'd, version controlled and test covered code, the biggest source of error will be the manual steps performed by the analyst running it. You can eliminate a lot of this, see Reproducible Analytical Pipelines.



DataS-DHSC/coding_principles_book documentation built on March 11, 2020, 4:13 a.m.