Quellcode dieses Indikators. Sammler: job_ads_indicator.py (Cron auf heissa, täglich), Seiten: index.php, api.php, rss.php. Zugangsdaten liegen getrennt und werden nicht angezeigt.
<?php
// jobindex/api.php - machine-readable JSON API of the AI early indicator (for programs and AI agents).
// GET api.php self-description (endpoints, fields, sources)
// GET api.php?q=summary latest values, METR trend, correlation, hypothesis
// GET api.php?q=indicator[&from=YYYY-MM-DD][&to=...][&freq=day|week|month] group indices and ratio
// GET api.php?q=projection METR trend and ratio projection until today + 5 years
// GET api.php?q=sectors Indeed sectors with group and change since the year before ChatGPT
// GET api.php?q=models[&suite=...] METR 50 % time horizons of all models
// GET api.php?q=ba[&scope=all|svp] official BA statistics: reported vacancies Germany, full-time/part-time, monthly since 2019
// GET api.php?q=newspaper local newspaper job ads per month and group
// GET api.php?q=hypothesis the pre-registered hypothesis and its result
declare(strict_types=1);
require __DIR__ . '/lib.php';
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Cache-Control: public, max-age=3600');
function out(array $data, int $code = 200): never {
http_response_code($code);
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_PRESERVE_ZERO_FRACTION), "\n";
exit;
}
function num($v, int $d = 3) { return $v === null ? null : round((float)$v, $d); }
$base = 'https://' . ($_SERVER['HTTP_HOST'] ?? 'web2.heissa.de') . dirname($_SERVER['SCRIPT_NAME']) . '/';
$q = $_GET['q'] ?? '';
$META = [
'name' => 'AI early indicator: job ads for AI-exposed knowledge work vs. trades (Germany)',
'question' => 'Do job ads for AI-exposed knowledge work fall relative to trades while the METR time horizon of AI models grows exponentially?',
'sources' => [
['name' => 'Indeed Hiring Lab Job Postings Index DE by sector', 'url' => 'https://github.com/hiring-lab/job_postings_tracker', 'license' => 'CC BY 4.0'],
['name' => 'METR time horizons', 'url' => 'https://metr.org/time-horizons/'],
['name' => 'Statistik der Bundesagentur für Arbeit: Gemeldete Arbeitsstellen Deutschland (Monatszahlen), tables 1.1/1.2', 'url' => 'https://statistik.arbeitsagentur.de/',
'note' => 'own calculation: full-time = total - part-time'],
['name' => 'Tölzer Kurier job ads (own archive, local sample)'],
],
'definitions' => [
'knowledge_idx' => 'geometric mean of 13 AI-exposed Indeed sectors (new postings, seasonally adjusted), 2020-02-01 = 100',
'trades_idx' => 'geometric mean of Construction, Installation & Maintenance, Cleaning & Sanitation, 2020-02-01 = 100',
'ratio' => 'knowledge_idx / trades_idx, mean of the year before ChatGPT (2021-12-01..2022-11-30) = 100',
'ratio_365' => 'trailing 365-day geometric mean of ratio (removes seasonality), same base',
'metr_h50_min' => '50 % time horizon in minutes: exponential trend over the frontier models of the newest METR main suite',
],
'updated' => 'weekly (Indeed refreshes weekly); projections are recomputed on every request',
'html' => $base, 'rss' => $base . 'rss.php', 'llms_txt' => $base . 'llms.txt',
];
$D = jobindex_data($pdo);
switch ($q) {
case '':
out($META + ['endpoints' => [
'summary' => $base . 'api.php?q=summary',
'indicator' => $base . 'api.php?q=indicator&freq=week&from=2022-01-01',
'projection' => $base . 'api.php?q=projection',
'sectors' => $base . 'api.php?q=sectors',
'models' => $base . 'api.php?q=models',
'newspaper' => $base . 'api.php?q=newspaper',
'ba' => $base . 'api.php?q=ba',
'hypothesis' => $base . 'api.php?q=hypothesis',
]]);
case 'summary':
$l = $D['last'];
$h = $D['hyp'];
out(['data_until' => $l['day'], 'projection_until' => $D['end'],
'knowledge_idx' => num($l['k']), 'trades_idx' => num($l['t']), 'ratio' => num($l['r']), 'ratio_365' => num($l['r365']),
'ratio_365_trend_pct_per_year' => num($D['ratioPerYear'], 2),
'metr' => ['fit_suite' => $D['fitSuite'], 'doubling_months' => num($D['doubling'], 2), 'h50_today_trend_min' => num($D['metrNow'], 1),
'strongest_model' => $D['strongest'] ? ['model' => $D['strongest']['model'], 'released' => $D['strongest']['released'],
'h50_min' => num($D['strongest']['h50_min'], 1)] : null],
'correlation_ratio365_vs_log_metr' => ['r' => num($D['corr'], 3), 'months' => count($D['corrPts']),
'note' => 'both series trend; correlation alone is no proof, see hypothesis'],
'hypothesis' => $h ? ['check_day' => $h['check_day'], 'baseline' => num($h['baseline_value']), 'threshold_value' => num($h['baseline_value'] * $h['threshold']),
'result' => $h['result_text']] : null]);
case 'indicator':
$from = $_GET['from'] ?? '2020-01-01'; $to = $_GET['to'] ?? '9999-12-31'; $freq = $_GET['freq'] ?? 'week';
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $from) || !preg_match('/^\d{4}-\d{2}-\d{2}$/', $to) || !in_array($freq, ['day', 'week', 'month'], true))
out(['error' => 'from/to must be YYYY-MM-DD, freq day|week|month'], 400);
$rows = []; $n = count($D['ind']);
foreach ($D['ind'] as $i => $r) {
if ($r['day'] < $from || $r['day'] > $to) continue;
if ($freq === 'week' && $i % 7 !== 0 && $i !== $n - 1) continue;
if ($freq === 'month' && substr($r['day'], 8, 2) !== '01' && $i !== $n - 1) continue;
$rows[] = ['day' => $r['day'], 'knowledge_idx' => num($r['k']), 'trades_idx' => num($r['t']), 'ratio' => num($r['r']), 'ratio_365' => num($r['r365'])];
}
out(['freq' => $freq, 'count' => count($rows), 'definitions' => $META['definitions'], 'rows' => $rows]);
case 'projection':
out(['note' => 'trend extrapolations, not forecasts; METR measures reliably only up to the longest task of a suite (TH1.1+TH2: 200 h)',
'metr_trend' => array_map(fn($p) => ['day' => $p['x'], 'h50_min' => $p['y'], 'projected' => $p['proj']], $D['metrTrend']),
'ratio_365_projection' => array_map(fn($p) => ['day' => $p['x'], 'ratio_365' => $p['y']], $D['ratioProj'])]);
case 'sectors':
out(['base' => 'mean of new postings 2021-12-01..2022-11-30', 'rows' => array_map(fn($s) => ['sector' => $s['sector'], 'group' => $s['grp'],
'idx_latest' => num($s['last_idx']), 'idx_base_year' => num($s['base_idx']),
'change_pct' => $s['base_idx'] ? num(($s['last_idx'] / $s['base_idx'] - 1) * 100, 2) : null], $D['sectors'])]);
case 'models':
$suite = $_GET['suite'] ?? null;
$rows = array_values(array_filter($D['pts'], fn($p) => $suite === null || $p['suite'] === $suite));
out(['fit_suite' => $D['fitSuite'], 'count' => count($rows), 'rows' => array_map(fn($p) => ['model' => $p['model'], 'suite' => $p['suite'],
'released' => $p['released'], 'frontier' => (bool)$p['frontier'], 'h50_min' => num($p['h50_min'], 2),
'h50_low95_min' => num($p['h50_low'], 2), 'h50_high95_min' => num($p['h50_high'], 2)], $rows)]);
case 'newspaper':
out(['range' => $D['npRange'], 'monthly' => array_map(fn($r) => ['month' => $r['m'], 'group' => $r['grp'], 'count' => (int)$r['n']], $D['npMonthly'])]);
case 'ba':
$scope = $_GET['scope'] ?? 'all';
if (!in_array($scope, ['all', 'svp'], true)) out(['error' => 'scope must be all|svp'], 400);
$rows = [];
foreach ($D['ba'] as $r) if ($r['scope'] === $scope)
$rows[$r['m']][$r['measure']] = ['total' => (int)$r['total'], 'part_time' => (int)$r['part_time'], 'full_time' => (int)$r['full_time']];
out(['source' => 'Statistik der Bundesagentur für Arbeit, Gemeldete Arbeitsstellen Deutschland (Monatszahlen); own calculation full_time = total - part_time',
'scope' => $scope === 'all' ? 'all reported vacancies' : 'vacancies subject to social insurance (svp)',
'definitions' => ['stock' => 'open reported vacancies on the counting day', 'inflow' => 'vacancies newly reported in the month, not seasonally adjusted'],
'annual_means_all' => array_map(fn($y) => ['year' => (int)$y['yr'], 'months' => (int)$y['months'], 'full_time_stock' => num($y['ft_stock'], 0),
'part_time_stock' => num($y['pt_stock'], 0), 'full_time_inflow_per_month' => num($y['ft_inflow'], 0), 'part_time_share_pct' => num($y['pt_share'], 1)], $D['baYears']),
'monthly' => array_map(fn($m, $v) => ['month' => $m] + $v, array_keys($rows), array_values($rows))]);
case 'hypothesis':
out(['hypothesis' => $D['hyp']]);
default:
out(['error' => 'unknown q', 'see' => $base . 'api.php'], 404);
}