To do compliance as code, the aim is to define your compliance policies such that they can be written as tests. Any software that you plan to put into production has to pass those tests.
The purpose of treating these policies as code is not just to capture policies as software and data, but to automate compliance for consistent application across the enterprise and apply software engineering practices to them — for instance, keeping the code under version control, and observing and monitoring policy operation.
It is a continual process, achieved by running software to automate the implementation, verify, remediate, monitor and perform compliance status reporting.