How do you modify the entry data before the template is rendered? I am using a pattern library which expects a different data structure to what is in entry. Is there a way to parse the entry through a transformer class before the template is rendered?

Currently I have created a Twig function to run: {% set job = single(entry) %} which returns the mapped data for each different entry type. 

I would like to hook into Craft to do this before the template is rendered and remove any mapping logic from the templates. Is this possible/practical?
Definitely possible; you'd need to write a plugin or module in PHP to do it though. Probably it could listen to for the View::EVENT_BEGIN_PAGE event, and get the injected element via $element = Craft::$app-&gt;urlManager-&gt;getMatchedElement()

Something sorta like this:

use craft\web\View;

// ...

    $request = Craft::$app-&gt;getRequest();
    if ($request-&gt;getIsSiteRequest()) {
        // Handler: View::EVENT_BEGIN_PAGE
        Event::on(
            View::class,
            View::EVENT_BEGIN_PAGE,
            function () {
                Craft::debug(
                    'View::EVENT_BEGIN_PAGE',
                    __METHOD__
                );
                $element = Craft::$app-&gt;urlManager-&gt;getMatchedElement();
                if ($element !== null &amp;&amp; ...) {
                    // ...do something
                }
            }
        );
    }


To make things clean, rather than modifying the element itself, I'd probably inject a new Twig variable, something like entryTransformed or something that your templating code could access.