feat: Ajout des données P4Pillon
This commit is contained in:
parent
db020a2e78
commit
bec1b4aa82
14
.drone.yml
14
.drone.yml
|
@ -24,6 +24,15 @@ steps:
|
||||||
- (cd scripts && python3 finess-clean.py)
|
- (cd scripts && python3 finess-clean.py)
|
||||||
- (cd scripts && python3 finess-sisa.py)
|
- (cd scripts && python3 finess-sisa.py)
|
||||||
|
|
||||||
|
- name: install npm
|
||||||
|
image: node:current-alpine
|
||||||
|
volumes:
|
||||||
|
- name: node_modules
|
||||||
|
path: /drone/src/scripts/import-from-directus/node_modules
|
||||||
|
commands:
|
||||||
|
- (cd scripts/import-from-directus && npm i)
|
||||||
|
- (cd scripts/import-from-directus && node index.js)
|
||||||
|
|
||||||
- name: build website
|
- name: build website
|
||||||
image: klakegg/hugo:0.101.0-ext-debian-ci
|
image: klakegg/hugo:0.101.0-ext-debian-ci
|
||||||
commands:
|
commands:
|
||||||
|
@ -49,3 +58,8 @@ steps:
|
||||||
from_secret: MATRIX_ACCESSTOKEN
|
from_secret: MATRIX_ACCESSTOKEN
|
||||||
when:
|
when:
|
||||||
status: [ failure ]
|
status: [ failure ]
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: node_modules
|
||||||
|
host:
|
||||||
|
path: /tmp/drone/cache/P4Pillon/annuaire/scripts/import-from-directus/node_modules
|
||||||
|
|
|
@ -3,3 +3,5 @@ resources
|
||||||
.hugo_build.lock
|
.hugo_build.lock
|
||||||
scripts/*.csv
|
scripts/*.csv
|
||||||
static/data.json
|
static/data.json
|
||||||
|
static/data_p4pillon.json
|
||||||
|
node_modules
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div id="map" style="width: 100%; height: 100%;"></div>
|
<div id="map" style="width: 100%; height: 100%;"></div>
|
||||||
<script>
|
<script type="module">
|
||||||
var mappos = L.Permalink.getMapLocation();
|
var mappos = L.Permalink.getMapLocation();
|
||||||
var map = L.map('map').setView(mappos.center || [46.55886, 3.21924], mappos.zoom || 6);
|
var map = L.map('map').setView(mappos.center || [46.55886, 3.21924], mappos.zoom || 6);
|
||||||
L.Permalink.setup(map);
|
L.Permalink.setup(map);
|
||||||
|
@ -43,30 +43,52 @@
|
||||||
name: 1,
|
name: 1,
|
||||||
name_long: 2,
|
name_long: 2,
|
||||||
dep: 3,
|
dep: 3,
|
||||||
tel: 4,
|
adresse: 4,
|
||||||
siret: 5,
|
tel: 5,
|
||||||
x: 6,
|
siret: 6,
|
||||||
y: 7,
|
x: 7,
|
||||||
|
y: 8,
|
||||||
}
|
}
|
||||||
var json = fetch('./data.json').then(response => {
|
|
||||||
return response.json();
|
async function getDataP4Pillon() {
|
||||||
})
|
const data = await fetch('./data_p4pillon.json')
|
||||||
.then(jsondata => {
|
return data.json()
|
||||||
|
}
|
||||||
|
async function getData() {
|
||||||
|
const data = await fetch('./data.json')
|
||||||
|
return data.json()
|
||||||
|
}
|
||||||
|
function getPopup(msp, dataP4Pillon) {
|
||||||
|
console.log(dataP4Pillon)
|
||||||
|
|
||||||
|
const nom = dataP4Pillon ? dataP4Pillon[0] : (msp[columns.name_long] ? msp[columns.name_long] : msp[columns.name])
|
||||||
|
const dep = msp[columns.dep]
|
||||||
|
const adresse = msp[columns.adresse]
|
||||||
|
|
||||||
|
return nom + " (" + dep + ")" +
|
||||||
|
"<br>Établissement FINESS N°" + msp[columns.finessET] +
|
||||||
|
(msp[columns.siret] != null ? "<br>SIREN : <a rel='noreferrer' target='_blank' href='https://data.inpi.fr/entreprises/" + msp[columns.siret].substring(0, 9) + "'>" + msp[columns.siret].substring(0, 9) + "</a>" : "") +
|
||||||
|
(msp[columns.tel] != null ? "<br><a href='tel:" + msp[columns.tel] + "'>" + msp[columns.tel] + "</a>" : "") +
|
||||||
|
(dataP4Pillon ? "<br>" +
|
||||||
|
(dataP4Pillon[1] || dataP4Pillon[2] ? "<br>Leader : " + dataP4Pillon[1] + " " + dataP4Pillon[2] : "") +
|
||||||
|
(dataP4Pillon[3] ? "<br>Adhérent à l'association AVEC Santé : ✅" : "") +
|
||||||
|
(dataP4Pillon[4] ? "<br>Accord conventionnel interprofessionnel : ✅" : "")
|
||||||
|
: "")
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await getData()
|
||||||
|
var dataP4Pillon = await getDataP4Pillon()
|
||||||
var markersCluster = new L.MarkerClusterGroup();
|
var markersCluster = new L.MarkerClusterGroup();
|
||||||
for (const msp of jsondata) {
|
|
||||||
|
for (const msp of data) {
|
||||||
const marker = L
|
const marker = L
|
||||||
.marker([msp[columns.x], msp[columns.y]])
|
.marker([msp[columns.x], msp[columns.y]])
|
||||||
.bindPopup(
|
.bindPopup(
|
||||||
(msp[columns.name_long] ? msp[columns.name_long] : msp[columns.name]) + " (" + msp[columns.dep] + ")<br>" +
|
getPopup(msp, dataP4Pillon[msp[columns.finessET]])
|
||||||
"Établissement FINESS N°" + msp[columns.finessET] + "<br>" +
|
|
||||||
(msp[columns.siret] != null ? "SIREN : <a rel='noreferrer' target='_blank' href='https://data.inpi.fr/entreprises/" + msp[columns.siret].substring(0, 9) + "'>" + msp[columns.siret].substring(0, 9) + "</a><br>" : "") +
|
|
||||||
(msp[columns.tel] != null ? "<a href='tel:" + msp[columns.tel] + "'>" + msp[columns.tel] + "</a>" : "")
|
|
||||||
);
|
);
|
||||||
markersCluster.addLayer(marker);
|
markersCluster.addLayer(marker);
|
||||||
}
|
}
|
||||||
map.addLayer(markersCluster);
|
map.addLayer(markersCluster);
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -67,7 +67,7 @@ header_drop = [
|
||||||
'commune',
|
'commune',
|
||||||
#'departement',
|
#'departement',
|
||||||
'libdepartement',
|
'libdepartement',
|
||||||
'ligneacheminement',
|
#'ligneacheminement',
|
||||||
#'telephone',
|
#'telephone',
|
||||||
'telecopie',
|
'telecopie',
|
||||||
'categetab',
|
'categetab',
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { Directus } from '@directus/sdk';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
const directus_url = "https://formulaire.p4pillon.org"
|
||||||
|
const directus = new Directus(directus_url);
|
||||||
|
|
||||||
|
async function getMspInfo() {
|
||||||
|
const response = await directus.items('MSP_INFO').readByQuery({ sort: ['nofinesset']});
|
||||||
|
|
||||||
|
return response.data
|
||||||
|
}
|
||||||
|
|
||||||
|
const mspInfo = await getMspInfo();
|
||||||
|
const data = {}
|
||||||
|
for (const msp of mspInfo) {
|
||||||
|
const nofinesset = msp.nofinesset
|
||||||
|
const info = msp
|
||||||
|
delete msp.nofinesset
|
||||||
|
data[nofinesset] = [
|
||||||
|
msp.nom,
|
||||||
|
msp.prenom_leader,
|
||||||
|
msp.nom_leader,
|
||||||
|
msp.avec_sante,
|
||||||
|
msp.accord_conventionnel_interprofessionnel,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
fs.writeFileSync('../../static/data_p4pillon.json', JSON.stringify(data, null, 2) , 'utf-8');
|
|
@ -0,0 +1,178 @@
|
||||||
|
{
|
||||||
|
"name": "directus-to-markdown",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "directus-to-markdown",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@directus/sdk": "^10.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"../../themes/hugo-theme-lowtech/node_modules/@resilien/directus-to-markdown": {
|
||||||
|
"extraneous": true
|
||||||
|
},
|
||||||
|
"../../themes/hugo-theme-lowtech/node_modules/url-slug": {
|
||||||
|
"extraneous": true
|
||||||
|
},
|
||||||
|
"node_modules/@directus/sdk": {
|
||||||
|
"version": "10.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@directus/sdk/-/sdk-10.3.1.tgz",
|
||||||
|
"integrity": "sha512-+FUs1kQ27dmrHbAxO+FmCmmAHZrzyyZn+cXZMCtixkeBD8KYBFM7sUKtesQskSmsp5wUksrq2L9Cm+Z93G/ONg==",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "0.27.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||||
|
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.14.9",
|
||||||
|
"form-data": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||||
|
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@directus/sdk": {
|
||||||
|
"version": "10.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@directus/sdk/-/sdk-10.3.1.tgz",
|
||||||
|
"integrity": "sha512-+FUs1kQ27dmrHbAxO+FmCmmAHZrzyyZn+cXZMCtixkeBD8KYBFM7sUKtesQskSmsp5wUksrq2L9Cm+Z93G/ONg==",
|
||||||
|
"requires": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"axios": {
|
||||||
|
"version": "0.27.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||||
|
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "^1.14.9",
|
||||||
|
"form-data": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"requires": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||||
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.15.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||||
|
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
|
||||||
|
},
|
||||||
|
"form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
|
||||||
|
},
|
||||||
|
"mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"requires": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "annuaire-p4pillon",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Import Directus.io to gohugo.io",
|
||||||
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"@directus/sdk": "^10.3.1"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue