viewof naisd_reg = {
const insee_csv_zipped = "https://www.insee.fr/fr/statistiques/fichier/1893255/base-naissances-2019_CSV.zip" ;
const tb_naiss = aq.fromCSV( await fetch_txtfile_from_zip(insee_csv_zipped,
null, {proxy: 'sofetch'}),
{delimiter: ";", parse: {CODGEO: String}} ) ;
const n_dep = await fetch("https://www.data.gouv.fr/fr/datasets/r/d77bb584-932b-4eae-a84b-8117f2a18ddb")
.then(buf => buf.text())
.then(buf => aq.fromCSV(buf, {delimiter: ";", autoType: false})) ;
const n_reg = await fetch("https://www.data.gouv.fr/fr/datasets/r/bfc0ec12-8a80-4225-a361-fe6ce14a9a6c")
.then(buf => buf.text())
.then(buf => aq.fromCSV(buf, {delimiter: ";", autoType: false})) ;
return tb_naiss.fold(aq.startswith('NAISD'), {as: ['AN','NAISD']})
.derive({AN: d => '20' + op.substring(d.AN, 5),
DEP: d => op.substring(d.CODGEO, 0, d.CODGEO < '97' ? 2 : 3) })
.lookup(n_dep, ['DEP','codgeo'], 'reg')
.groupby('reg','AN').rollup({NAISD: op.sum('NAISD')})
.lookup(n_reg, ['reg','codgeo'], 'libgeo')
.orderby('reg', 'AN')
.select({'reg': 'REG'}, {'libgeo': 'LIBREG'}, 'AN', 'NAISD')
.view() ;
}