# Validate PoPy

Before using PoPy for an important analysis it is best to run the validation process. This verifies that the outputs of your PoPy installation agree with the outputs obtained by the developers of PoPy.

## Check the PoPy Configuration

To see the current configuration, Open a PoPy Command Prompt and type:-

    popy info

and you should see something like this:-

    INFO - In a PoPy Binary environment
    INFO - popy_flavour=binary
    INFO - popy_python_path=C:\PoPy\
    INFO - popy_release=<X.Y.Z>
    INFO - popy_version=academic
    INFO - python_version=3.8.6
    INFO - windows_version=('10', '10.0.17134', 'SP0', 'Multiprocessor Free')
    INFO - machine_name=mickey
    INFO - product_key=<XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX>
    status=Product key is activated and within licence period
    Licence has been running for 3613 days
    Licence needs renewing in 1868 days
    INFO - name=Phil Tresadern
    INFO - email=phil@popypkpd.com
    INFO - company=Wright Dose Ltd
    INFO - licence_start_date=2009-02-12 00:00:00
    INFO - licence_end_date=2024-02-16 00:00:00
    INFO - should_run=True

showing the paths used by PoPy, a few internal variables, and details about the licence (if you have run popy activate).

## Run the Validator

Because computers vary in their architecture, it is possible that running the same code and the same script could give different results on different installations. We therefore bundle a tool, popy validate, that runs PoPy on a suite of examples and compares the results you compute locally to some reference results generated at Wright Dose Ltd.

These Validation Examples are largely drawn from the DDMoRe repository and cover models with different features, e.g. inter-occasion variability.

To run this suite of examples Open a PoPy Command Prompt and type:-

    popy validate

Some of the examples take a few minutes to run, the full validation takes about 20 minutes, but you should only need to run the validation once.

If the validation is successful, you should get output on the command line as the validation examples are processed. The end of the output should look like:-

    INFO -
    INFO - Validation results: 4 passed; 0 failed.
    INFO - Passes:
    INFO -   ddmore0061
    INFO -   ddmore0093
    INFO -   ddmore0215
    INFO -   ddmore0238
    INFO -

        VALIDATION RESULT: PASS

    INFO -
    INFO -  time to complete val  = 915.338s
    INFO - Main script val completed.
    INFO -  time to complete main + sub scripts = 916.993s
    Finished: SUCCESS

which will also be written to the log file ‘validation_script.pyml.run.main.log’ in the ‘validation’ subdirectory of your PoPy installation, which is normally located at `c:\PoPy\validation\validation_script.pyml.run.main.log`.

This log file can be used as a form of verification for a validation report, if PoPy is to be used in a commercial setting.

## Validation Examples

The validation examples are often taken from the publicly available DDMoRe repository. Typically these are a Nonmem control file and Nonmem data file that together illustrate fitting a PK/PD model.

You can see the validation examples supplied with PoPy in the `c:\PoPy\validation` folder.

Each subdirectory contains a ‘readme.txt’ file that gives a brief overview of the example and how it was created from the DDMoRe equivalent.

Table 59 lists each of the models in this folder:-

Table 59 Validation Models
Name | Summary | Link | Citation
--- | --- | --- | ---
ddmore0061 | Combined bolus + infusion PK model. | DDMoRe: 0061 | [Harling2015]
ddmore0093 | Circadian function with covariates. | DDMoRe: 0093 | [Cheung2015]
ddmore0215 | Markov and dropout hazard. | DDMoRe: 0215 | [Girard2012]
ddmore0238 | PopPK with infusion dosing + IOV. | DDMoRe: 0238 | [Germovsek2017]

## Troubleshoot

If the validation fails for any reason, please contact the PoPy developers at info@popypkpd.com.