> For the complete documentation index, see [llms.txt](https://iddynamics.gitbook.io/flepimop/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://iddynamics.gitbook.io/flepimop/more/setting-up-the-model-and-post-processing/create-a-post-processing-script.md).

# Create a post-processing script

Some information to consider if you'd like your script to be run automatically after an inference run ;

* Most R/python packages are installed already installed. Try to run your script on the conda environment defined on the [submission page](/flepimop/how-to-run/advanced-run-guides/running-on-a-hpc-with-slurm.md) (or easier if you are not set up on MARCC, ask me)
* There will be some variables set in the environment. These variables are:
  * `$CONFIG_PATH` the path to the configuration fil ;
  * `$FLEPI_RUN_INDEX` the run id for this run (e.g \``CH_R3_highVE_pesImm_2022_Jan29`\`
  * `$JOB_NAME` this job name (e.g `USA-20230130T163847_inference_med`)
  * `$FS_RESULTS_PATH` the path where lies the model results. It's a folder that contains the model\_ouput/ as a subfolder
  * `$FLEPI_PATH` path of the flepiMoP repository.
  * `$PROJECT_PATH` path of the Data directory (e.g Flu\_USA or COVID19\_USA).
  * Anything you ask can theoretically be provided here.
* The script must run without any user intervention.
* The script is run from $PROJECT\_PATH.
* Your script lies in the flepiMoP directory (preferably) or it's ok if it is in a data directory if it makes sense ;
* It is run on a 64Gb of RAM multicore machine. All scripts combined must complete under 4 hours, and you can use multiprocessing (48 cores)
* Outputs (pdf, csv, html, txt, png ...) must be saved in a directory named `pplot/` (you can assume that it exists) in order to be sent to slack by FlepiBot 🤖 after the run.
* an example postprocessing script (in python) is [here](https://github.com/HopkinsIDD/COVIDScenarioPipeline/blob/main-flu-subfix2/scripts/postprocess_auto.py).
* You can test your script on MARCC on a run that is already saved in `/data/struelo1/flepimop-runs` or I can do it for you.
* Once your script works, add (or ask to add) the command line to run in file `batch/postprocessing_scripts.sh` [(here)](https://github.com/HopkinsIDD/COVIDScenarioPipeline/blob/main-flu-subfix2/batch/postprocessing-scripts.sh) between the START and END lines, with a little comment about what your script does.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://iddynamics.gitbook.io/flepimop/more/setting-up-the-model-and-post-processing/create-a-post-processing-script.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
