feat: Enhance CSV import process and data cleanup
- Added support for importing 'periodes' data and adjusted related SQL scripts. - Introduced a new SQL preparation script to set up the import schema. - Updated the import_all_csv.sh script to handle new CSV files and tables. - Implemented checks for required SQL files and improved error handling. - Modified data types and structures in the import process for better consistency. - Created a new remove-import-data.sql script to clean up imported data effectively. - Enhanced the handling of postal codes and addresses in the import logic. - Added comments and structured the SQL scripts for better readability and maintainability.
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
title,addressRequired,availableForUsers,contactData,defaultFor,editableByUsers
|
||||||
|
Mairie / Commune,,,,,
|
||||||
|
Guichet d’accueil,,,,,
|
||||||
|
Domicile de l’usager,,,,,
|
||||||
|
épicerie sociale,,,,,
|
||||||
|
Ecole,,,,,
|
||||||
|
Lycée,,,,,
|
||||||
|
Université,,,,,
|
||||||
|
Ambassade,,,,,
|
||||||
|
Consulat,,,,,
|
||||||
|
Tribunal,,,,,
|
||||||
|
Ministère,,,,,
|
||||||
|
Banque,,,,,
|
||||||
|
Prison,,,,,
|
||||||
|
Centre de rétention,,,,,
|
||||||
|
Foyer ONA,,,,,
|
||||||
|
Hébergement d'urgence,,,,,
|
||||||
|
WAK,,,,,
|
||||||
|
ASTI,,,,,
|
||||||
|
Office social,,,,,
|
||||||
|
Hôpital,,,,,
|
||||||
|
Services Logement,,,,,
|
||||||
|
Centre thérapeutique,,,,,
|
||||||
|
Administration,,,,,
|
||||||
|
@@ -0,0 +1,146 @@
|
|||||||
|
closingmotive,origin,acp_scopes,job,referrer,parent,enfant,acp_social_issues,work_social_action,street,extra,streetnumber,postcode,country
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,Orienter vers une structure compétente,,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,vérifier droits d'accès,,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,affiliation volontaire,,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,Orienter vers OS (pour prise en charge de l'affiliation volontaire et/ou tiers payant),,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,projet CUSS,,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,Prévention et Sensibilisation,,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,"Rédaction recours (CNS, Médecin contrôle,...)",,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,prise en charge de facture médicale ou autre,,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,"Réorienter chez médecin gratuit (Médecins du Monde, Stëmm vun der Strooss)",,,,,
|
||||||
|
,,,,,Santé,Accès aux soins,Santé > Accès aux soins,Demande assistance dépendance,,,,,
|
||||||
|
,,,,,Santé,Santé mentale,Santé > Santé mentale,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Santé,Santé mentale,Santé > Santé mentale,Prise de rendez-vous médicaux,,,,,
|
||||||
|
,,,,,Santé,Santé mentale,Santé > Santé mentale,Réorientation service compétent,,,,,
|
||||||
|
,,,,,Santé,Consultation médicale – Stëmm,Santé > Consultation médicale – Stëmm,enquête Dr Stëmm,,,,,
|
||||||
|
,,,,,Santé,Consultation médicale – Stëmm,Santé > Consultation médicale – Stëmm,"établir une prise en charge pour spécialiste, laboratoire, radiologie,...",,,,,
|
||||||
|
,,,,,Santé,Consultation médicale – Stëmm,Santé > Consultation médicale – Stëmm,établir un bon pharmacie,,,,,
|
||||||
|
,,,,,Santé,Consultation médicale – Stëmm,Santé > Consultation médicale – Stëmm,prise en charge de facture médicale ou autre,,,,,
|
||||||
|
,,,,,Santé,Handicap,Santé > Handicap,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Santé,Handicap,Santé > Handicap,Prise de rendez-vous médicaux,,,,,
|
||||||
|
,,,,,Santé,Handicap,Santé > Handicap,Réorientation service compétent,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Enquête sociale,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Préparation de la demande,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Transmission de la demande au Ministère de la Santé,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),"Echange avec MISA, CCSS, CNS",,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Entretien régulier,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Prise de rendez-vous médicaux,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Demande assistance dépéndance,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Accompagnement physique au rendez-vous,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Suivi social,,,,,
|
||||||
|
,,,,,Santé,CUSS (Couverture Universelle des Soins de Santé),Santé > CUSS (Couverture Universelle des Soins de Santé),Art. 32,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,Enquête sociale,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,Vérifier les possibilités d'accès aux droits,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,aide à la constitution d'un dossier pour l'OS ou autre,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,Vérifier possibilité d'une adresse,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,Vérifier si autorisation de travailler,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,"Informer, conseiller, expliquer",,,,,
|
||||||
|
,,,,,Justice,Accès aux droits,Justice > Accès aux droits,Orienter vers réseau (bas seuil ou spécialisé dans la problématique),,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Enquête sociale,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Vérifier les possibilités d'accès aux droits,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Vérifier possibilité d'une adresse,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Vérifier si autorisation de travailler,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,"Informer, conseiller",,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,"Orienter vers réseau (ASTI, CLAE, HUT, LISKO, ONA...)",,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,(Renouvellement) titre de séjour,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Actualisation documents d'identité,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Contacter MAI,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Contacter MAE,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Assistance judiciaire (recours),,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Centre de rétention/Maison retour,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Retour volontaire (IOM),,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Migration,Justice > Accès aux droits – Migration,Regroupement familial,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,Demande d'assistance judiciaire,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,Réorientation permanence judiciaire gratuite,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,"recherche de renseignements concernant l'affaire (police, avocat, parquet,..)",,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,Ombudsman/OKAJU,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,"Demande renseignement service spécialisé (Mieterschutz, UCL, Syndicats,...)",,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,Explication courrier,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,Rédaction recours,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,Echange services pénitentiaires,,,,,
|
||||||
|
,,,,,Justice,Accès aux droits – Juridique,Justice > Accès aux droits – Juridique,"Contact service compétent (avocat, huissier, créanciers,...)",,,,,
|
||||||
|
,,,,,Justice,Protection Adulte,Justice > Protection Adulte,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Justice,Protection Adulte,Justice > Protection Adulte,"Prise de contact service compétent (violence.lu, SCAS,...)",,,,,
|
||||||
|
,,,,,Justice,Protection Adulte,Justice > Protection Adulte,"Réorientation service compétent (violence.lu, SCAS,...)",,,,,
|
||||||
|
,,,,,Justice,Protection Adulte,Justice > Protection Adulte,Réorientation Police (Plainte),,,,,
|
||||||
|
,,,,,Justice,Protection Adulte,Justice > Protection Adulte,Réorientation Service Info Traite,,,,,
|
||||||
|
,,,,,Justice,Protection Adulte,Justice > Protection Adulte,Demande d'assistance judiciaire,,,,,
|
||||||
|
,,,,,Justice,Protection Adulte – besoins spécifiques,Justice > Protection Adulte – besoins spécifiques,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Justice,Protection Adulte – besoins spécifiques,Justice > Protection Adulte – besoins spécifiques,"Réorientation service compétent (TACS, Avocat,...)",,,,,
|
||||||
|
,,,,,Justice,Protection Adulte – besoins spécifiques,Justice > Protection Adulte – besoins spécifiques,Faire une demande tutelle/curatelle,,,,,
|
||||||
|
,,,,,Emploi,Sans emploi,Emploi > Sans emploi,"Informer, conseiller, expliquer",,,,,
|
||||||
|
,,,,,Emploi,Sans emploi,Emploi > Sans emploi,Rédaction de CV,,,,,
|
||||||
|
,,,,,Emploi,Sans emploi,Emploi > Sans emploi,Rédaction de LM,,,,,
|
||||||
|
,,,,,Emploi,Sans emploi,Emploi > Sans emploi,Réorientation vers ACT ou similaire,,,,,
|
||||||
|
,,,,,Emploi,Sans emploi,Emploi > Sans emploi,Intérim,,,,,
|
||||||
|
,,,,,Emploi,Sans emploi,Emploi > Sans emploi,Inscription Adem,,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,Echange employeur,,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,Echange ONIS,,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,Echange ARIS,,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,Contact ITM,,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,Rédaction courrier,,,,,
|
||||||
|
,,,,,Emploi,problèmes,Emploi > problèmes,Réorientation Service Info Traite,,,,,
|
||||||
|
,,,,,Emploi,ISP (TUC où autre),Emploi > ISP (TUC où autre),Echange avec ADEM,,,,,
|
||||||
|
,,,,,Emploi,ISP (TUC où autre),Emploi > ISP (TUC où autre),Echange avec employeur,,,,,
|
||||||
|
,,,,,Emploi,ISP (TUC où autre),Emploi > ISP (TUC où autre),Réorienter vers l'ONIS,,,,,
|
||||||
|
,,,,,Emploi,ISP (TUC où autre),Emploi > ISP (TUC où autre),Echanger avec l'ARIS,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Signer la procuration,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Signer la dénonciation de procuration,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Faire un bilan de la situation financière,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Etablir un plan budgétaire ou d'apurement,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Réévaluation en cas de besoin,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,"Contacter les créanciers, huissiers,...",,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,aide à la constitution d'un dossier pour l'OS,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Ouvrir un compte bancaire,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Clôturer un compte bancaire,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Effectuer un virement,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Donner de l'argent liquide,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,Accès aide alimentaire,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,mise en place d'ordres permanents,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,faire une avance,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,"vérifier les possibilités d'accès (Revis, Rpgh, chômage, pension, invalidité,allocations familiales...)",,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,entamer les démarches requises,,,,,
|
||||||
|
,,,,,Finance,Guidance budgétaire,Finance > Guidance budgétaire,"rédiger un recours (ADEM, FNS,...)",,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,Faire demande RENLA,,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,Faire une demande de subvention loyer,,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,Faire une demande d'aide pour garanti locative de l'état,,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,Orienter vers OS pour garantie locative,,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,Faire un recours en cas de notification de déguerpissement,,,,,
|
||||||
|
,,,,,Logement,Accès au logement,Logement > Accès au logement,Orienter vers logement d'urgence,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,Réorientation vers office social,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,Demande d'adresse de référence,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,Demande RENLA,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,Demande logements sociaux,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,Orientation pour adresse courrier,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,Orientation structure d'urgence,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,faire une demande pour maison de repos \ maison de soins,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,actualisation annuelle de la demande logement social,,,,,
|
||||||
|
,,,,,Logement,perte/absence,Logement > perte/absence,actualisation subvention loyer,,,,,
|
||||||
|
,,,,,Logement,Adresse de référence,Logement > Adresse de référence,Enquête sociale (vérifier les conditions d'accès),,,,,
|
||||||
|
,,,,,Logement,Adresse de référence,Logement > Adresse de référence,Instruction de la demande,,,,,
|
||||||
|
,,,,,Logement,Adresse de référence,Logement > Adresse de référence,Réorientation vers service compétent,,,,,
|
||||||
|
,,,,,Logement,Adresse de référence,Logement > Adresse de référence,Accompagnement social,,,,,
|
||||||
|
,,,,,Logement,Adresse de référence,Logement > Adresse de référence,Clôture de la demande,,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,Entretien d'évaluation (avant déménagement),,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,Rédiger contrat avec objectifs à atteindre,,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,Visites régulières,,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,"Aides démarches (administratives, quotidiens, etc)",,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,Si objectifs atteint -> sortie logement,,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,échange avec bailleur social,,,,,
|
||||||
|
,,,,,Logement,Logement Encadré,Logement > Logement Encadré,compléter révision annuelle du loyer,,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,"Ecouter, informer, conseiller",,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,Chercher le dialogue avec le bailleur,,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,Echange Mairie,,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,Echange centre d'hébergement,,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,Procédure d'insalubrité,,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,Rédaction de recours,,,,,
|
||||||
|
,,,,,Logement,Insalubrité,Logement > Insalubrité,Echange avocat,,,,,
|
||||||
|
,,,,,Logement,médiation,Logement > médiation,Echange avec Bailleur,,,,,
|
||||||
|
,,,,,Logement,médiation,Logement > médiation,Echange Mairie,,,,,
|
||||||
|
,,,,,Logement,médiation,Logement > médiation,Echange centre d'hébergement,,,,,
|
||||||
|
@@ -0,0 +1,59 @@
|
|||||||
|
acronym,nom,categorie
|
||||||
|
CHL,Centre Hospitalier de Luxembourg,hopital
|
||||||
|
CHEM,Centre Hospitalier Emile Mayrisch,hopital
|
||||||
|
HRS,Les Hopitaux Robert Schuman - Hopital Kirchberg,hopital
|
||||||
|
CHNP,Centre Hospitalier Neuro-Psychiatrique,hopital
|
||||||
|
CHDN,Centre hospitalier du Nord,hopital
|
||||||
|
Police,Police Grand-Ducal,sécurité
|
||||||
|
CGDIS,Corps Grand-Ducal d'incendie et de Secours,sécurité
|
||||||
|
CIGL,Centre Initiative et de Gestion Locale,emploi
|
||||||
|
SCAS,Service Central d'Assistance Sociale,justice
|
||||||
|
ONE,Office National de l'Enfance,enfance
|
||||||
|
ONA,Office National de l'Accueil,immigration
|
||||||
|
Lisko,Letzebuerger Integratiouns - a sozialkohäsiounszenter,immigration
|
||||||
|
Aris,Agents régionaux d'inclusion sociale,emploi
|
||||||
|
ONIS,Office National d'inclusion sociale,emploi
|
||||||
|
ADEM,Agence pour le développement de l'emploi,emploi
|
||||||
|
FNS,Fonds National de Solidarité,aide sociale
|
||||||
|
CCSS,Centre Commun de la Sécurité Sociale,Santé
|
||||||
|
CNS,Centre National de la Santé,Santé
|
||||||
|
MiSa,Ministère de la Santé et de la Sécurité Sociale,Ministère
|
||||||
|
MAI,Ministère des Affaires Intérieures,Ministère
|
||||||
|
MAE,Ministère des Affaires Etrangères et Européennes,Ministère
|
||||||
|
CLAE,Comité de Liaison des Associations d'Etranger,immigration
|
||||||
|
ASTI,Association de Soutien aux Travailleurs Immigrés,immigration
|
||||||
|
Croix-rouge luxembourgeoise,Croix-rouge luxembourgeoise,aide sociale
|
||||||
|
HUT asbl,Hëllef Um Terrain ,aide sociale
|
||||||
|
Inter-actions,Inter-actions,aide sociale
|
||||||
|
Office sociaux,Office sociaux,aide sociale
|
||||||
|
MdM,Médecins du Monde,Santé
|
||||||
|
JDH,Jügend- an Drogenhellef,toxicologie
|
||||||
|
Maison Escale,Maison Escale,Santé
|
||||||
|
CNDS,Comité National de Défense Sociale,aide sociale
|
||||||
|
Streetwork,Streetwork,aide sociale
|
||||||
|
SePAS,Service Psycho-social et d'accompagnements scolaires,enfance
|
||||||
|
WAK,Wanteraktioun,aide sociale
|
||||||
|
Aide au logement,Aide au logement,logement
|
||||||
|
Fonds du Logement,Fonds du Logement,logement
|
||||||
|
SNHBM,Société National des Habitations à Bon Marché,logement
|
||||||
|
Service logement communal,Service logement communal,logement
|
||||||
|
Ennerdach asbl,Ennerdach asbl,logement
|
||||||
|
Arcus,Arcus,aide sociale
|
||||||
|
Quai57,Quai57,toxicologie
|
||||||
|
AIS,Agence Immobilière Sociale,logement
|
||||||
|
AIS-Kordall,Agence immobilière Sociale - Kordall,logement
|
||||||
|
Log-IN,Log-IN,aide sociale
|
||||||
|
Ombudsman,Ombudsman,justice
|
||||||
|
OKAJU,Ombudsman fir Kanner a JugenIecher,justice
|
||||||
|
Gutt Wunnen,Gutt Wunnen,logement
|
||||||
|
Abrigado,Abrigado,toxicologie
|
||||||
|
Life asbl,Life asbl,logement
|
||||||
|
MiLo,Ministère du Logement et de l'aménagement du territoire ,Ministère
|
||||||
|
FDL,Fond du Logement,logement
|
||||||
|
Barreau de Luxembourg,Barreau de Luxembourg,justice
|
||||||
|
Consulat,Consulat,Consulat
|
||||||
|
Ambassade,Ambassade,Ambassade
|
||||||
|
Administration de contribution directe,Administration de contribution directe,fiscalité
|
||||||
|
SNAS,Service National D'Action Sociale,Ministère
|
||||||
|
Alan - Maladies Rares Luxembourg,Alan - Maladies Rares Luxembourg,Santé
|
||||||
|
Oméga 90,Oméga 90,Santé
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
civility,lastname,firstname,gender,gendercomment,nationality,memo,birthdate,place_of_birth,countryofbirth,deathdate,email,phonenumber,mobilenumber,contactinfo,street,extra,streetnumber,postcode,country
|
||||||
|
Monsieur,Barbosa De Freitas,Jorge,Homme,,Portugal,,27/02/1974,,,,,691823643,,,Avenue Parc Sports,2ème étage,47,L-4671,Luxembourg
|
||||||
|
Monsieur,Clement,Patrick,Homme,,Luxembourg,,09/01/1980,,,,,661326035,,,rue Jean Gallion,2ème étage,53,L-4569,Luxembourg
|
||||||
|
Monsieur,Bifsa,Alexanter,Homme,,Grèce,,27/10/1968,,,,,691568014,,,rue des Etats-Unis,2ème étage,40,L-1477,Luxembourg
|
||||||
|
Monsieur,Schanen,Patrick,Homme,,Luxembourg,,18/01/1965,,,,,691237244,,,rue des Etats-Unis,2ème étage,40,L-1477,Luxembourg
|
||||||
|
Monsieur,Ramalho Flores,Alexandre,Homme,,Portugal,,10/08/1983,,,,,661838358,,,rue de Merl,3ème étage,83,L-2146,Luxembourg
|
||||||
|
Madame,Debesay Ghebreyesus,Kesanet,Femme,,Erythrée,,01/01/1995,,,,,661351725,,,rue Gare-Usine,1er étage,44,L-3481,Luxembourg
|
||||||
|
Monsieur,Castro e Sousa Coelho Da Rocha,Joao Henriques,Homme,,Portugal,,18/11/1964,,,,,691893614,,,rue Gare-Usine,rez-de-chaussée,44,L-3481,Luxembourg
|
||||||
|
Monsieur,Fettes,André,Homme,,Luxembourg,,11/04/1983,,,,,691584045,,,rue de l'Ecole,3ème étage,27,L-4103,Luxembourg
|
||||||
|
Madame,Thibault,Véronique,Femme,,France,,19/06/1974,,,,,661798327,,,place Saint Michel,3ème étage,9,L-4242,Luxembourg
|
||||||
|
Monsieur,Ramdedovic,Muslija,Homme,,Monténégro,,01/10/1971,,,,,691573447,,,rue Jean-Pierre Theisen,rez-de-chaussée,1,L-4331,Luxembourg
|
||||||
|
Monsieur,De Pina Fortes,Carlos,Homme,,Luxembourg,Portugal,06/12/1978,,,,,691781278,,,rue Saint Vincent,rez-de-chaussée,13,L-4344,Luxembourg
|
||||||
|
Madame,Da Cruz Monteiro,Laise Telma,Femme,,Luxembourg,,10/10/1992,,,,,691594836,,,rue de la fenderie,rez-de-chaussée,1B,L-3734,Luxembourg
|
||||||
|
Madame,Ratinet,Magali,Femme,,France,,09/05/1973,,,,,661389224,,,rue de la fenderie,rez-de-chaussée,1A,L-3734,Luxembourg
|
||||||
|
Monsieur,Wahl,Claude,Homme,,Luxembourg,,19/08/1961,,,,,621476607,,,op der Nuddelsfabrik,1er étage,5,L-3424,Luxembourg
|
||||||
|
Monsieur,Cantarella,David,Homme,,Belge,,26/05/1973,,,,,691300834,,,rue du Clopp,1er étage,2B,L-4810,Luxembourg
|
||||||
|
Monsieur,Muno,Patrick,Homme,,Luxembourg,,27/01/1970,,,,,691197050,,,route d'Esch,1er étage,32,L-4450,Luxembourg
|
||||||
|
Monsieur,Oliveira Rodrigues,Nelson,Homme,,Cap-Vert,,29/12/1976,,,,,621635212,,,route d'Esch,2ème étage,32,L-4450,Luxembourg
|
||||||
|
Monsieur,Taborda Ribeiro,Daniel,Homme,,Portugal,,23/04/1963,,,,,691595218,,,route d'Esch,2ème étage,32,L-4450,Luxembourg
|
||||||
|
Madame,Monteiro,Ana Maria,Femme,,Portugal,,20/12/1961,,,,,621644070,,,rue Jean Schortgen,1er étage (arrière),2,L-3787,Luxembourg
|
||||||
|
Monsieur,Cordovado,Daniel,Homme,,Luxembourg,,24/01/1972,,,,,621561597,,,rue Jean Schortgen,1er étage (avant),2,L-3787,Luxembourg
|
||||||
|
Monsieur,Hasan,Hashim Abdullah Hasan,Homme,,Irak,,01/06/1985,,,,,661474629,,,rue Jean Schortgen,2ème étage (arrière),2,L-3787,Luxembourg
|
||||||
|
Madame,Marques Da Costa,Maria Isaura,Femme,,Portugal,,24/12/1957,,,,,621528040,,,rue Jean Schortgen,2ème étage (avant),2,L-3787,Luxembourg
|
||||||
|
Monsieur,De Oilveira Campos Pereira,Antonio Carlos,Homme,,Portugal,,01/10/1958,,,,,661718315,,,rue Jean Schortgen,3ème étage,2,L-3787,Luxembourg
|
||||||
|
Madame,Stoffel,Marie-Jeanne,Femme,,Luxembourg,,12/03/1961,,,,,621764613,,,rue de Mâcon,1er étage,81,L-4230,Luxembourg
|
||||||
|
Monsieur,Brack,Francis,Homme,,Luxembourg,,28/05/1980,,,,,621573872,,,op der Léier,1er étage,4,L-4240,Luxembourg
|
||||||
|
Monsieur,Moreira Soares,José Augusto,Homme,,Portugal,,17/10/1968,,,,,621765741,,,op der Léier,rez-de-chaussée,5,L-4240,Luxembourg
|
||||||
|
Madame,Oskan,Laila,Femme,,Luxembourg,,03/02/1990,,,,,621599566,,,rue de l'Avenir,rez-de-chaussée,38,L-1147,Luxembourg
|
||||||
|
Monsieur,Benamtar,Ilies-Saïd,Homme,,Algérie,,09/05/1988,,,,,691225092,,,rue de l'Ecole,1er étage,6,L-7410,Luxembourg
|
||||||
|
@@ -0,0 +1,146 @@
|
|||||||
|
id,nom,openingdate,closingdate,closingmotive,origin,remark,intensity,referrer,job,acp_scopes,address,personlocation,addresslocation,acp_socialissues,work_socialaction,comment1_content,comment2_content,comment3_content,comment4_content,comment5_content
|
||||||
|
1,Periode 1,,,,,,,,,,,,,Santé > Accès aux soins,"Ecouter, informer, conseiller",,,,,
|
||||||
|
2,Periode 2,,,,,,,,,,,,,Santé > Accès aux soins,Orienter vers une structure compétente,,,,,
|
||||||
|
3,Periode 3,,,,,,,,,,,,,Santé > Accès aux soins,vérifier droits d'accès,,,,,
|
||||||
|
4,Periode 4,,,,,,,,,,,,,Santé > Accès aux soins,affiliation volontaire,,,,,
|
||||||
|
5,Periode 5,,,,,,,,,,,,,Santé > Accès aux soins,Orienter vers OS (pour prise en charge de l'affiliation volontaire et/ou tiers payant),,,,,
|
||||||
|
6,Periode 6,,,,,,,,,,,,,Santé > Accès aux soins,projet CUSS,,,,,
|
||||||
|
7,Periode 7,,,,,,,,,,,,,Santé > Accès aux soins,Prévention et Sensibilisation,,,,,
|
||||||
|
8,Periode 8,,,,,,,,,,,,,Santé > Accès aux soins,"Rédaction recours (CNS, Médecin contrôle,...)",,,,,
|
||||||
|
9,Periode 9,,,,,,,,,,,,,Santé > Accès aux soins,prise en charge de facture médicale ou autre,,,,,
|
||||||
|
10,Periode 10,,,,,,,,,,,,,Santé > Accès aux soins,"Réorienter chez médecin gratuit (Médecins du Monde, Stëmm vun der Strooss)",,,,,
|
||||||
|
11,Periode 11,,,,,,,,,,,,,Santé > Accès aux soins,Demande assistance dépendance,,,,,
|
||||||
|
12,Periode 12,,,,,,,,,,,,,Santé > Santé mentale,"Ecouter, informer, conseiller",,,,,
|
||||||
|
13,Periode 13,,,,,,,,,,,,,Santé > Santé mentale,Prise de rendez-vous médicaux,,,,,
|
||||||
|
14,Periode 14,,,,,,,,,,,,,Santé > Santé mentale,Réorientation service compétent,,,,,
|
||||||
|
15,Periode 15,,,,,,,,,,,,,Santé > Consultation médicale – Stëmm,enquête Dr Stëmm,,,,,
|
||||||
|
16,Periode 16,,,,,,,,,,,,,Santé > Consultation médicale – Stëmm,"établir une prise en charge pour spécialiste, laboratoire, radiologie,...",,,,,
|
||||||
|
17,Periode 17,,,,,,,,,,,,,Santé > Consultation médicale – Stëmm,établir un bon pharmacie,,,,,
|
||||||
|
18,Periode 18,,,,,,,,,,,,,Santé > Consultation médicale – Stëmm,prise en charge de facture médicale ou autre,,,,,
|
||||||
|
19,Periode 19,,,,,,,,,,,,,Santé > Handicap,"Ecouter, informer, conseiller",,,,,
|
||||||
|
20,Periode 20,,,,,,,,,,,,,Santé > Handicap,Prise de rendez-vous médicaux,,,,,
|
||||||
|
21,Periode 21,,,,,,,,,,,,,Santé > Handicap,Réorientation service compétent,,,,,
|
||||||
|
22,Periode 22,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),"Ecouter, informer, conseiller",,,,,
|
||||||
|
23,Periode 23,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Enquête sociale,,,,,
|
||||||
|
24,Periode 24,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Préparation de la demande,,,,,
|
||||||
|
25,Periode 25,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Transmission de la demande au Ministère de la Santé,,,,,
|
||||||
|
26,Periode 26,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),"Echange avec MISA, CCSS, CNS",,,,,
|
||||||
|
27,Periode 27,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Entretien régulier,,,,,
|
||||||
|
28,Periode 28,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Prise de rendez-vous médicaux,,,,,
|
||||||
|
29,Periode 29,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Demande assistance dépéndance,,,,,
|
||||||
|
30,Periode 30,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Accompagnement physique au rendez-vous,,,,,
|
||||||
|
31,Periode 31,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Suivi social,,,,,
|
||||||
|
32,Periode 32,,,,,,,,,,,,,Santé > CUSS (Couverture Universelle des Soins de Santé),Art. 32,,,,,
|
||||||
|
33,Periode 33,,,,,,,,,,,,,Justice > Accès aux droits,Enquête sociale,,,,,
|
||||||
|
34,Periode 34,,,,,,,,,,,,,Justice > Accès aux droits,Vérifier les possibilités d'accès aux droits,,,,,
|
||||||
|
35,Periode 35,,,,,,,,,,,,,Justice > Accès aux droits,aide à la constitution d'un dossier pour l'OS ou autre,,,,,
|
||||||
|
36,Periode 36,,,,,,,,,,,,,Justice > Accès aux droits,Vérifier possibilité d'une adresse,,,,,
|
||||||
|
37,Periode 37,,,,,,,,,,,,,Justice > Accès aux droits,Vérifier si autorisation de travailler,,,,,
|
||||||
|
38,Periode 38,,,,,,,,,,,,,Justice > Accès aux droits,"Informer, conseiller, expliquer",,,,,
|
||||||
|
39,Periode 39,,,,,,,,,,,,,Justice > Accès aux droits,Orienter vers réseau (bas seuil ou spécialisé dans la problématique),,,,,
|
||||||
|
40,Periode 40,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Enquête sociale,,,,,
|
||||||
|
41,Periode 41,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Vérifier les possibilités d'accès aux droits,,,,,
|
||||||
|
42,Periode 42,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Vérifier possibilité d'une adresse,,,,,
|
||||||
|
43,Periode 43,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Vérifier si autorisation de travailler,,,,,
|
||||||
|
44,Periode 44,,,,,,,,,,,,,Justice > Accès aux droits – Migration,"Informer, conseiller",,,,,
|
||||||
|
45,Periode 45,,,,,,,,,,,,,Justice > Accès aux droits – Migration,"Orienter vers réseau (ASTI, CLAE, HUT, LISKO, ONA...)",,,,,
|
||||||
|
46,Periode 46,,,,,,,,,,,,,Justice > Accès aux droits – Migration,(Renouvellement) titre de séjour,,,,,
|
||||||
|
47,Periode 47,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Actualisation documents d'identité,,,,,
|
||||||
|
48,Periode 48,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Contacter MAI,,,,,
|
||||||
|
49,Periode 49,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Contacter MAE,,,,,
|
||||||
|
50,Periode 50,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Assistance judiciaire (recours),,,,,
|
||||||
|
51,Periode 51,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Centre de rétention/Maison retour,,,,,
|
||||||
|
52,Periode 52,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Retour volontaire (IOM),,,,,
|
||||||
|
53,Periode 53,,,,,,,,,,,,,Justice > Accès aux droits – Migration,Regroupement familial,,,,,
|
||||||
|
54,Periode 54,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,Demande d'assistance judiciaire,,,,,
|
||||||
|
55,Periode 55,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,Réorientation permanence judiciaire gratuite,,,,,
|
||||||
|
56,Periode 56,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,"recherche de renseignements concernant l'affaire (police, avocat, parquet,..)",,,,,
|
||||||
|
57,Periode 57,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,Ombudsman/OKAJU,,,,,
|
||||||
|
58,Periode 58,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,"Demande renseignement service spécialisé (Mieterschutz, UCL, Syndicats,...)",,,,,
|
||||||
|
59,Periode 59,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,Explication courrier,,,,,
|
||||||
|
60,Periode 60,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,Rédaction recours,,,,,
|
||||||
|
61,Periode 61,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,Echange services pénitentiaires,,,,,
|
||||||
|
62,Periode 62,,,,,,,,,,,,,Justice > Accès aux droits – Juridique,"Contact service compétent (avocat, huissier, créanciers,...)",,,,,
|
||||||
|
63,Periode 63,,,,,,,,,,,,,Justice > Protection Adulte,"Ecouter, informer, conseiller",,,,,
|
||||||
|
64,Periode 64,,,,,,,,,,,,,Justice > Protection Adulte,"Prise de contact service compétent (violence.lu, SCAS,...)",,,,,
|
||||||
|
65,Periode 65,,,,,,,,,,,,,Justice > Protection Adulte,"Réorientation service compétent (violence.lu, SCAS,...)",,,,,
|
||||||
|
66,Periode 66,,,,,,,,,,,,,Justice > Protection Adulte,Réorientation Police (Plainte),,,,,
|
||||||
|
67,Periode 67,,,,,,,,,,,,,Justice > Protection Adulte,Réorientation Service Info Traite,,,,,
|
||||||
|
68,Periode 68,,,,,,,,,,,,,Justice > Protection Adulte,Demande d'assistance judiciaire,,,,,
|
||||||
|
69,Periode 69,,,,,,,,,,,,,Justice > Protection Adulte – besoins spécifiques,"Ecouter, informer, conseiller",,,,,
|
||||||
|
70,Periode 70,,,,,,,,,,,,,Justice > Protection Adulte – besoins spécifiques,"Réorientation service compétent (TACS, Avocat,...)",,,,,
|
||||||
|
71,Periode 71,,,,,,,,,,,,,Justice > Protection Adulte – besoins spécifiques,Faire une demande tutelle/curatelle,,,,,
|
||||||
|
72,Periode 72,,,,,,,,,,,,,Emploi > Sans emploi,"Informer, conseiller, expliquer",,,,,
|
||||||
|
73,Periode 73,,,,,,,,,,,,,Emploi > Sans emploi,Rédaction de CV,,,,,
|
||||||
|
74,Periode 74,,,,,,,,,,,,,Emploi > Sans emploi,Rédaction de LM,,,,,
|
||||||
|
75,Periode 75,,,,,,,,,,,,,Emploi > Sans emploi,Réorientation vers ACT ou similaire,,,,,
|
||||||
|
76,Periode 76,,,,,,,,,,,,,Emploi > Sans emploi,Intérim,,,,,
|
||||||
|
77,Periode 77,,,,,,,,,,,,,Emploi > Sans emploi,Inscription Adem,,,,,
|
||||||
|
78,Periode 78,,,,,,,,,,,,,Emploi > problèmes,"Ecouter, informer, conseiller",,,,,
|
||||||
|
79,Periode 79,,,,,,,,,,,,,Emploi > problèmes,Echange employeur,,,,,
|
||||||
|
80,Periode 80,,,,,,,,,,,,,Emploi > problèmes,Echange ONIS,,,,,
|
||||||
|
81,Periode 81,,,,,,,,,,,,,Emploi > problèmes,Echange ARIS,,,,,
|
||||||
|
82,Periode 82,,,,,,,,,,,,,Emploi > problèmes,Contact ITM,,,,,
|
||||||
|
83,Periode 83,,,,,,,,,,,,,Emploi > problèmes,Rédaction courrier,,,,,
|
||||||
|
84,Periode 84,,,,,,,,,,,,,Emploi > problèmes,Réorientation Service Info Traite,,,,,
|
||||||
|
85,Periode 85,,,,,,,,,,,,,Emploi > ISP (TUC où autre),Echange avec ADEM,,,,,
|
||||||
|
86,Periode 86,,,,,,,,,,,,,Emploi > ISP (TUC où autre),Echange avec employeur,,,,,
|
||||||
|
87,Periode 87,,,,,,,,,,,,,Emploi > ISP (TUC où autre),Réorienter vers l'ONIS,,,,,
|
||||||
|
88,Periode 88,,,,,,,,,,,,,Emploi > ISP (TUC où autre),Echanger avec l'ARIS,,,,,
|
||||||
|
89,Periode 89,,,,,,,,,,,,,Finance > Guidance budgétaire,"Ecouter, informer, conseiller",,,,,
|
||||||
|
90,Periode 90,,,,,,,,,,,,,Finance > Guidance budgétaire,Signer la procuration,,,,,
|
||||||
|
91,Periode 91,,,,,,,,,,,,,Finance > Guidance budgétaire,Signer la dénonciation de procuration,,,,,
|
||||||
|
92,Periode 92,,,,,,,,,,,,,Finance > Guidance budgétaire,Faire un bilan de la situation financière,,,,,
|
||||||
|
93,Periode 93,,,,,,,,,,,,,Finance > Guidance budgétaire,Etablir un plan budgétaire ou d'apurement,,,,,
|
||||||
|
94,Periode 94,,,,,,,,,,,,,Finance > Guidance budgétaire,Réévaluation en cas de besoin,,,,,
|
||||||
|
95,Periode 95,,,,,,,,,,,,,Finance > Guidance budgétaire,"Contacter les créanciers, huissiers,...",,,,,
|
||||||
|
96,Periode 96,,,,,,,,,,,,,Finance > Guidance budgétaire,aide à la constitution d'un dossier pour l'OS,,,,,
|
||||||
|
97,Periode 97,,,,,,,,,,,,,Finance > Guidance budgétaire,Ouvrir un compte bancaire,,,,,
|
||||||
|
98,Periode 98,,,,,,,,,,,,,Finance > Guidance budgétaire,Clôturer un compte bancaire,,,,,
|
||||||
|
99,Periode 99,,,,,,,,,,,,,Finance > Guidance budgétaire,Effectuer un virement,,,,,
|
||||||
|
100,Periode 100,,,,,,,,,,,,,Finance > Guidance budgétaire,Donner de l'argent liquide,,,,,
|
||||||
|
101,Periode 101,,,,,,,,,,,,,Finance > Guidance budgétaire,Accès aide alimentaire,,,,,
|
||||||
|
102,Periode 102,,,,,,,,,,,,,Finance > Guidance budgétaire,mise en place d'ordres permanents,,,,,
|
||||||
|
103,Periode 103,,,,,,,,,,,,,Finance > Guidance budgétaire,faire une avance,,,,,
|
||||||
|
104,Periode 104,,,,,,,,,,,,,Finance > Guidance budgétaire,"vérifier les possibilités d'accès (Revis, Rpgh, chômage, pension, invalidité,allocations familiales...)",,,,,
|
||||||
|
105,Periode 105,,,,,,,,,,,,,Finance > Guidance budgétaire,entamer les démarches requises,,,,,
|
||||||
|
106,Periode 106,,,,,,,,,,,,,Finance > Guidance budgétaire,"rédiger un recours (ADEM, FNS,...)",,,,,
|
||||||
|
107,Periode 107,,,,,,,,,,,,,Logement > Accès au logement,"Ecouter, informer, conseiller",,,,,
|
||||||
|
108,Periode 108,,,,,,,,,,,,,Logement > Accès au logement,Faire demande RENLA,,,,,
|
||||||
|
109,Periode 109,,,,,,,,,,,,,Logement > Accès au logement,Faire une demande de subvention loyer,,,,,
|
||||||
|
110,Periode 110,,,,,,,,,,,,,Logement > Accès au logement,Faire une demande d'aide pour garanti locative de l'état,,,,,
|
||||||
|
111,Periode 111,,,,,,,,,,,,,Logement > Accès au logement,Orienter vers OS pour garantie locative,,,,,
|
||||||
|
112,Periode 112,,,,,,,,,,,,,Logement > Accès au logement,Faire un recours en cas de notification de déguerpissement,,,,,
|
||||||
|
113,Periode 113,,,,,,,,,,,,,Logement > Accès au logement,Orienter vers logement d'urgence,,,,,
|
||||||
|
114,Periode 114,,,,,,,,,,,,,Logement > perte/absence,"Ecouter, informer, conseiller",,,,,
|
||||||
|
115,Periode 115,,,,,,,,,,,,,Logement > perte/absence,Réorientation vers office social,,,,,
|
||||||
|
116,Periode 116,,,,,,,,,,,,,Logement > perte/absence,Demande d'adresse de référence,,,,,
|
||||||
|
117,Periode 117,,,,,,,,,,,,,Logement > perte/absence,Demande RENLA,,,,,
|
||||||
|
118,Periode 118,,,,,,,,,,,,,Logement > perte/absence,Demande logements sociaux,,,,,
|
||||||
|
119,Periode 119,,,,,,,,,,,,,Logement > perte/absence,Orientation pour adresse courrier,,,,,
|
||||||
|
120,Periode 120,,,,,,,,,,,,,Logement > perte/absence,Orientation structure d'urgence,,,,,
|
||||||
|
121,Periode 121,,,,,,,,,,,,,Logement > perte/absence,faire une demande pour maison de repos \ maison de soins,,,,,
|
||||||
|
122,Periode 122,,,,,,,,,,,,,Logement > perte/absence,actualisation annuelle de la demande logement social,,,,,
|
||||||
|
123,Periode 123,,,,,,,,,,,,,Logement > perte/absence,actualisation subvention loyer,,,,,
|
||||||
|
124,Periode 124,,,,,,,,,,,,,Logement > Adresse de référence,Enquête sociale (vérifier les conditions d'accès),,,,,
|
||||||
|
125,Periode 125,,,,,,,,,,,,,Logement > Adresse de référence,Instruction de la demande,,,,,
|
||||||
|
126,Periode 126,,,,,,,,,,,,,Logement > Adresse de référence,Réorientation vers service compétent,,,,,
|
||||||
|
127,Periode 127,,,,,,,,,,,,,Logement > Adresse de référence,Accompagnement social,,,,,
|
||||||
|
128,Periode 128,,,,,,,,,,,,,Logement > Adresse de référence,Clôture de la demande,,,,,
|
||||||
|
129,Periode 129,,,,,,,,,,,,,Logement > Logement Encadré,Entretien d'évaluation (avant déménagement),,,,,
|
||||||
|
130,Periode 130,,,,,,,,,,,,,Logement > Logement Encadré,Rédiger contrat avec objectifs à atteindre,,,,,
|
||||||
|
131,Periode 131,,,,,,,,,,,,,Logement > Logement Encadré,Visites régulières,,,,,
|
||||||
|
132,Periode 132,,,,,,,,,,,,,Logement > Logement Encadré,"Aides démarches (administratives, quotidiens, etc)",,,,,
|
||||||
|
133,Periode 133,,,,,,,,,,,,,Logement > Logement Encadré,Si objectifs atteint -> sortie logement,,,,,
|
||||||
|
134,Periode 134,,,,,,,,,,,,,Logement > Logement Encadré,échange avec bailleur social,,,,,
|
||||||
|
135,Periode 135,,,,,,,,,,,,,Logement > Logement Encadré,compléter révision annuelle du loyer,,,,,
|
||||||
|
136,Periode 136,,,,,,,,,,,,,Logement > Insalubrité,"Ecouter, informer, conseiller",,,,,
|
||||||
|
137,Periode 137,,,,,,,,,,,,,Logement > Insalubrité,Chercher le dialogue avec le bailleur,,,,,
|
||||||
|
138,Periode 138,,,,,,,,,,,,,Logement > Insalubrité,Echange Mairie,,,,,
|
||||||
|
139,Periode 139,,,,,,,,,,,,,Logement > Insalubrité,Echange centre d'hébergement,,,,,
|
||||||
|
140,Periode 140,,,,,,,,,,,,,Logement > Insalubrité,Procédure d'insalubrité,,,,,
|
||||||
|
141,Periode 141,,,,,,,,,,,,,Logement > Insalubrité,Rédaction de recours,,,,,
|
||||||
|
142,Periode 142,,,,,,,,,,,,,Logement > Insalubrité,Echange avocat,,,,,
|
||||||
|
143,Periode 143,,,,,,,,,,,,,Logement > médiation,Echange avec Bailleur,,,,,
|
||||||
|
144,Periode 144,,,,,,,,,,,,,Logement > médiation,Echange Mairie,,,,,
|
||||||
|
145,Periode 145,,,,,,,,,,,,,Logement > médiation,Echange centre d'hébergement,,,,,
|
||||||
|
+34
-21
@@ -9,9 +9,11 @@ DB_USER="${PGUSER:-postgres}"
|
|||||||
DB_NAME="${PGDATABASE:-chill-import}"
|
DB_NAME="${PGDATABASE:-chill-import}"
|
||||||
|
|
||||||
PSQL=(psql -v ON_ERROR_STOP=1 -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME")
|
PSQL=(psql -v ON_ERROR_STOP=1 -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME")
|
||||||
|
PREPARE_SQL="$ROOT_DIR/sql/prepare-import.sql"
|
||||||
|
|
||||||
required_tables=(
|
required_tables=(
|
||||||
"import.personnes"
|
"import.personnes"
|
||||||
|
"import.periodes"
|
||||||
"import.choix_periodes"
|
"import.choix_periodes"
|
||||||
"import.choix_localisations"
|
"import.choix_localisations"
|
||||||
"import.tiers"
|
"import.tiers"
|
||||||
@@ -19,11 +21,21 @@ required_tables=(
|
|||||||
|
|
||||||
required_files=(
|
required_files=(
|
||||||
"$ROOT_DIR/csv/choix_usagers.csv"
|
"$ROOT_DIR/csv/choix_usagers.csv"
|
||||||
|
"$ROOT_DIR/csv/periodes.csv"
|
||||||
"$ROOT_DIR/csv/choix_periodes.csv"
|
"$ROOT_DIR/csv/choix_periodes.csv"
|
||||||
"$ROOT_DIR/csv/choix_localisations.csv"
|
"$ROOT_DIR/csv/choix_localisations.csv"
|
||||||
"$ROOT_DIR/csv/choix_tiers.csv"
|
"$ROOT_DIR/csv/choix_tiers.csv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ ! -f "$PREPARE_SQL" ]]; then
|
||||||
|
echo "Fichier SQL manquant: ${PREPARE_SQL#$ROOT_DIR/}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[-1/3] Recreation du schema import..."
|
||||||
|
"${PSQL[@]}" -c "DROP SCHEMA IF EXISTS import CASCADE;"
|
||||||
|
"${PSQL[@]}" -f "$PREPARE_SQL"
|
||||||
|
|
||||||
for table in "${required_tables[@]}"; do
|
for table in "${required_tables[@]}"; do
|
||||||
exists="$("${PSQL[@]}" -tAc "SELECT to_regclass('${table}') IS NOT NULL;")"
|
exists="$("${PSQL[@]}" -tAc "SELECT to_regclass('${table}') IS NOT NULL;")"
|
||||||
if [[ "$exists" != "t" ]]; then
|
if [[ "$exists" != "t" ]]; then
|
||||||
@@ -40,7 +52,7 @@ for csv_file in "${required_files[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "[0/4] Assouplissement des types texte des tables import..."
|
echo "[0/3] Assouplissement des types texte des tables import..."
|
||||||
"${PSQL[@]}" <<'SQL'
|
"${PSQL[@]}" <<'SQL'
|
||||||
DO $$
|
DO $$
|
||||||
DECLARE r record;
|
DECLARE r record;
|
||||||
@@ -49,7 +61,7 @@ BEGIN
|
|||||||
SELECT table_schema, table_name, column_name
|
SELECT table_schema, table_name, column_name
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema = 'import'
|
WHERE table_schema = 'import'
|
||||||
AND table_name IN ('personnes', 'choix_periodes', 'choix_localisations', 'tiers')
|
AND table_name IN ('personnes', 'periodes', 'choix_periodes', 'choix_localisations', 'tiers')
|
||||||
AND data_type IN ('character varying', 'character')
|
AND data_type IN ('character varying', 'character')
|
||||||
LOOP
|
LOOP
|
||||||
EXECUTE format(
|
EXECUTE format(
|
||||||
@@ -62,17 +74,18 @@ BEGIN
|
|||||||
END $$;
|
END $$;
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
echo "[1/4] Vidage des tables d'import..."
|
echo "[1/3] Vidage des tables d'import..."
|
||||||
"${PSQL[@]}" <<'SQL'
|
"${PSQL[@]}" <<'SQL'
|
||||||
TRUNCATE TABLE
|
TRUNCATE TABLE
|
||||||
import.personnes,
|
import.personnes,
|
||||||
|
import.periodes,
|
||||||
import.choix_periodes,
|
import.choix_periodes,
|
||||||
import.choix_localisations,
|
import.choix_localisations,
|
||||||
import.tiers
|
import.tiers
|
||||||
RESTART IDENTITY;
|
RESTART IDENTITY;
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
echo "[2/4] Import des CSV du dossier csv/..."
|
echo "[2/3] Import des CSV du dossier csv/..."
|
||||||
|
|
||||||
copy_table_from_file() {
|
copy_table_from_file() {
|
||||||
local table="$1"
|
local table="$1"
|
||||||
@@ -87,26 +100,26 @@ copy_table_from_file() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy_table_from_file "import.personnes" "$ROOT_DIR/csv/choix_usagers.csv" "civility,lastname,firstname,gender,gendercomment,nationality,memo,birthdate,place_of_birth,countryofbirth,deathdate,email,phonenumber,mobilenumber,contactinfo,street,extra,streetnumber,postcode,country"
|
copy_table_from_file "import.personnes" "$ROOT_DIR/csv/choix_usagers.csv" "civility,lastname,firstname,gender,gendercomment,nationality,memo,birthdate,place_of_birth,countryofbirth,deathdate,email,phonenumber,mobilenumber,contactinfo,street,extra,streetnumber,postcode,country"
|
||||||
copy_table_from_file "import.choix_periodes" "$ROOT_DIR/csv/choix_periodes.csv" "closingmotive,origin,acp_scopes,job,referrer,parent,enfant,acp_social_issues,work_social_action,street,extra,streetnumber,postcode,country"
|
|
||||||
copy_table_from_file "import.choix_localisations" "$ROOT_DIR/csv/choix_localisations.csv" "title,addressRequired,availableForUsers,contactData,defaultFor,editableByUsers"
|
|
||||||
|
|
||||||
echo "[3/4] Import de tiers via table staging..."
|
|
||||||
"${PSQL[@]}" -c "\copy import.tiers_stage(coordonnees,nom,categorie) FROM STDIN WITH (FORMAT csv, HEADER true, DELIMITER ',')" < "$ROOT_DIR/csv/choix_tiers.csv"
|
|
||||||
|
|
||||||
|
echo " - generation des ids manquants dans import.personnes"
|
||||||
"${PSQL[@]}" <<'SQL'
|
"${PSQL[@]}" <<'SQL'
|
||||||
INSERT INTO import.tiers (id, coordonnees, nom, categorie)
|
WITH numbered AS (
|
||||||
SELECT
|
SELECT ctid, row_number() OVER (ORDER BY ctid) AS new_id
|
||||||
row_number() OVER (ORDER BY nom) AS id,
|
FROM import.personnes
|
||||||
NULLIF(trim(coordonnees), ''),
|
WHERE id IS NULL OR NULLIF(id::text, '') IS NULL
|
||||||
NULLIF(trim(nom), ''),
|
)
|
||||||
NULLIF(trim(categorie), '')
|
UPDATE import.personnes p
|
||||||
FROM import.tiers_stage
|
SET id = numbered.new_id
|
||||||
WHERE COALESCE(trim(nom), '') <> '';
|
FROM numbered
|
||||||
|
WHERE p.ctid = numbered.ctid;
|
||||||
DROP TABLE import.tiers_stage;
|
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
echo "[4/4] Verification des volumes importes..."
|
copy_table_from_file "import.periodes" "$ROOT_DIR/csv/periodes.csv" "id,nom,openingdate,closingdate,closingmotive,origin,remark,intensity,referrer,job,acp_scopes,address,personlocation,addresslocation,acp_socialissues,work_socialaction,comment1_content,comment2_content,comment3_content,comment4_content,comment5_content"
|
||||||
"${PSQL[@]}" -c "SELECT 'personnes' AS table_name, count(*) AS rows FROM import.personnes UNION ALL SELECT 'choix_periodes', count(*) FROM import.choix_periodes UNION ALL SELECT 'choix_localisations', count(*) FROM import.choix_localisations UNION ALL SELECT 'tiers', count(*) FROM import.tiers;"
|
copy_table_from_file "import.choix_periodes" "$ROOT_DIR/csv/choix_periodes.csv" "closingmotive,origin,acp_scopes,job,referrer,parent,enfant,acp_social_issues,work_social_action,street,extra,streetnumber,postcode,country"
|
||||||
|
copy_table_from_file "import.choix_localisations" "$ROOT_DIR/csv/choix_localisations.csv" "title,\"addressRequired\",\"availableForUsers\",\"contactData\",\"defaultFor\",\"editableByUsers\""
|
||||||
|
copy_table_from_file "import.tiers" "$ROOT_DIR/csv/choix_tiers.csv" "acronym,nom,categorie"
|
||||||
|
|
||||||
|
echo "[3/3] Verification des volumes importes..."
|
||||||
|
"${PSQL[@]}" -c "SELECT 'personnes' AS table_name, count(*) AS rows FROM import.personnes UNION ALL SELECT 'periodes', count(*) FROM import.periodes UNION ALL SELECT 'choix_periodes', count(*) FROM import.choix_periodes UNION ALL SELECT 'choix_localisations', count(*) FROM import.choix_localisations UNION ALL SELECT 'tiers', count(*) FROM import.tiers;"
|
||||||
|
|
||||||
echo "Import termine sans doublons (tables videes au debut)."
|
echo "Import termine sans doublons (tables videes au debut)."
|
||||||
|
|||||||
+40
-26
@@ -12,6 +12,13 @@
|
|||||||
--
|
--
|
||||||
-- vérifier les étiquettes de colonnes: user-> referrer, acp_social_issues-> acp_socialissues
|
-- vérifier les étiquettes de colonnes: user-> referrer, acp_social_issues-> acp_socialissues
|
||||||
|
|
||||||
|
-- Exécution du bloc DOWN uniquement si demandé explicitement:
|
||||||
|
-- psql -v run_down=1 -f sql/import.sql
|
||||||
|
\if :{?run_down}
|
||||||
|
\else
|
||||||
|
\set run_down 0
|
||||||
|
\endif
|
||||||
|
|
||||||
|
|
||||||
-- 1. Adjust Type cast for id columns
|
-- 1. Adjust Type cast for id columns
|
||||||
ALTER TABLE import.personnes ALTER COLUMN id TYPE INTEGER USING (id::integer);
|
ALTER TABLE import.personnes ALTER COLUMN id TYPE INTEGER USING (id::integer);
|
||||||
@@ -355,26 +362,28 @@ INSERT INTO chill_person_person_center_history (id, person_id, center_id, startd
|
|||||||
-- a) add new columns
|
-- a) add new columns
|
||||||
ALTER TABLE import.personnes ADD column address_id BIGINT;
|
ALTER TABLE import.personnes ADD column address_id BIGINT;
|
||||||
ALTER TABLE import.personnes ADD column address_ref_id BIGINT;
|
ALTER TABLE import.personnes ADD column address_ref_id BIGINT;
|
||||||
ALTER TABLE import.personnes ADD column postcode_id BIGINT[];
|
ALTER TABLE import.personnes ADD column postcode_arr BIGINT[];
|
||||||
|
|
||||||
-- special command to extract postcode values in text
|
-- special command to extract postcode values in text
|
||||||
ALTER TABLE import.personnes ADD COLUMN postcode1 TEXT;
|
ALTER TABLE import.personnes ADD COLUMN postcode1 TEXT;
|
||||||
UPDATE import.personnes SET postcode1=SUBSTRING(postcode FROM '\y\d{5}\y') WHERE postcode!='';
|
UPDATE import.personnes
|
||||||
|
SET postcode1 = NULLIF(regexp_replace(coalesce(postcode, ''), '\D', '', 'g'), '')
|
||||||
|
WHERE coalesce(postcode, '') != '';
|
||||||
|
|
||||||
-- b) find and add postal code references. Check missing correspondances (if you can)
|
-- b) find and add postal code references. Check missing correspondances (if you can)
|
||||||
UPDATE import.personnes
|
UPDATE import.personnes
|
||||||
SET postcode_id = (
|
SET postcode_arr = (
|
||||||
SELECT pc.id
|
SELECT array_agg(pc.id)
|
||||||
FROM chill_main_postal_code AS pc
|
FROM chill_main_postal_code AS pc
|
||||||
WHERE pc.canonical ILIKE import.personnes.postcode
|
WHERE pc.code = import.personnes.postcode1
|
||||||
AND pc.origin = 0
|
AND pc.origin = 0
|
||||||
);
|
);
|
||||||
--SELECT * FROM import.personnes as ip WHERE ip.postcode_id IS NULL -- missing correspondances
|
--SELECT * FROM import.personnes as ip WHERE ip.postcode_arr IS NULL -- missing correspondances
|
||||||
|
|
||||||
-- c) find and add reference addresses. Check missing correspondances (if you can)
|
-- c) find and add reference addresses. Check missing correspondances (if you can)
|
||||||
UPDATE import.personnes AS ip SET address_ref_id = cmar.id FROM chill_main_address_reference AS cmar
|
UPDATE import.personnes AS ip SET address_ref_id = cmar.id FROM chill_main_address_reference AS cmar
|
||||||
WHERE
|
WHERE
|
||||||
cmar.postcode_id = ip.postcode_id
|
cmar.postcode_id = ANY(ip.postcode_arr)
|
||||||
AND similarity(trim(ip.street), trim(cmar.street)) > 0.6
|
AND similarity(trim(ip.street), trim(cmar.street)) > 0.6
|
||||||
AND trim(ip.streetnumber) = trim(cmar.streetnumber);
|
AND trim(ip.streetnumber) = trim(cmar.streetnumber);
|
||||||
--SELECT * FROM import.personnes as ip WHERE ip.address_ref_id IS NULL -- missing correspondances
|
--SELECT * FROM import.personnes as ip WHERE ip.address_ref_id IS NULL -- missing correspondances
|
||||||
@@ -384,7 +393,7 @@ UPDATE import.personnes SET address_id = nextval('chill_main_address_id_seq');
|
|||||||
|
|
||||||
-- e) insert reference address into chill_main_addresses
|
-- e) insert reference address into chill_main_addresses
|
||||||
INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom, addressreference_id, refstatus, point, createdat, updatedat, createdby_id, updatedby_id)
|
INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom, addressreference_id, refstatus, point, createdat, updatedat, createdby_id, updatedby_id)
|
||||||
SELECT address_id, postcode_id, street, coalesce(streetnumber, ''), coalesce(extra,''),
|
SELECT address_id, postcode_arr[1], street, coalesce(streetnumber, ''), coalesce(extra,''),
|
||||||
CURRENT_DATE,
|
CURRENT_DATE,
|
||||||
address_ref_id, 'match',
|
address_ref_id, 'match',
|
||||||
(SELECT point FROM chill_main_address_reference WHERE id = address_ref_id),
|
(SELECT point FROM chill_main_address_reference WHERE id = address_ref_id),
|
||||||
@@ -396,14 +405,14 @@ INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, va
|
|||||||
|
|
||||||
-- f) insert created addresses in chill_main_addresses
|
-- f) insert created addresses in chill_main_addresses
|
||||||
INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom, point, createdat, updatedat, createdby_id, updatedby_id)
|
INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom, point, createdat, updatedat, createdby_id, updatedby_id)
|
||||||
SELECT address_id, postcode_id, coalesce(street, ''), coalesce(streetnumber, ''), coalesce(extra,''),
|
SELECT address_id, postcode_arr[1], coalesce(street, ''), coalesce(streetnumber, ''), coalesce(extra,''),
|
||||||
CURRENT_DATE,
|
CURRENT_DATE,
|
||||||
(SELECT center FROM chill_main_postal_code WHERE id = postcode_id), -- geolocation is given by the postcode
|
(SELECT center FROM chill_main_postal_code WHERE id = postcode_arr[1]), -- geolocation is given by the postcode
|
||||||
CURRENT_DATE,
|
CURRENT_DATE,
|
||||||
CURRENT_DATE,
|
CURRENT_DATE,
|
||||||
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users),
|
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users),
|
||||||
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users)
|
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users)
|
||||||
FROM import.personnes WHERE address_ref_id IS NULL AND postcode_id IS NOT NULL;
|
FROM import.personnes WHERE address_ref_id IS NULL AND postcode_arr IS NOT NULL;
|
||||||
|
|
||||||
SELECT setval('chill_main_address_id_seq', (SELECT COALESCE(max(id)) FROM chill_main_address));
|
SELECT setval('chill_main_address_id_seq', (SELECT COALESCE(max(id)) FROM chill_main_address));
|
||||||
|
|
||||||
@@ -440,7 +449,7 @@ UPDATE import.periodes SET period_id = periodid
|
|||||||
INSERT INTO chill_person_accompanying_period (id, openingdate, closingdate, step, remark, intensity, createdby_id, createdat, updatedby_id, updatedat) SELECT
|
INSERT INTO chill_person_accompanying_period (id, openingdate, closingdate, step, remark, intensity, createdby_id, createdat, updatedby_id, updatedat) SELECT
|
||||||
period_id,
|
period_id,
|
||||||
COALESCE(openingdate1, date(date_trunc('year', CURRENT_DATE))), closingdate1,
|
COALESCE(openingdate1, date(date_trunc('year', CURRENT_DATE))), closingdate1,
|
||||||
'CONFIRMED', COALESCE(TRIM(remark), ''), intensity1,
|
'CONFIRMED', COALESCE(TRIM(remark::text), ''), intensity1,
|
||||||
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users), CURRENT_DATE,
|
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users), CURRENT_DATE,
|
||||||
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users), CURRENT_DATE
|
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users), CURRENT_DATE
|
||||||
FROM import.periodes;
|
FROM import.periodes;
|
||||||
@@ -482,11 +491,7 @@ INSERT INTO chill_person_accompanying_period_location_history (id, period_id, st
|
|||||||
INSERT INTO chill_person_accompanying_period_social_issues (accompanyingperiod_id, socialissue_id)
|
INSERT INTO chill_person_accompanying_period_social_issues (accompanyingperiod_id, socialissue_id)
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT ON (t.period_id) t.period_id,
|
DISTINCT ON (t.period_id) t.period_id,
|
||||||
COALESCE(
|
COALESCE(t.enfant_id, t.parent_id) AS socialissue_id
|
||||||
t.enfant_id,
|
|
||||||
t.parent_id,
|
|
||||||
1 -- default value ?
|
|
||||||
) AS socialissue_id
|
|
||||||
FROM (
|
FROM (
|
||||||
SELECT p.period_id,
|
SELECT p.period_id,
|
||||||
(SELECT id FROM chill_person_social_issue WHERE title::jsonb->>'fr' = icp.parent1::jsonb->>'fr' AND parent_id IS NULL) AS parent_id, icp.parent1,
|
(SELECT id FROM chill_person_social_issue WHERE title::jsonb->>'fr' = icp.parent1::jsonb->>'fr' AND parent_id IS NULL) AS parent_id, icp.parent1,
|
||||||
@@ -494,13 +499,14 @@ FROM (
|
|||||||
(SELECT id FROM chill_person_social_issue WHERE title::jsonb->>'fr' = icp.parent1::jsonb->>'fr' AND parent_id IS NULL)) AS enfant_id, icp.enfant1
|
(SELECT id FROM chill_person_social_issue WHERE title::jsonb->>'fr' = icp.parent1::jsonb->>'fr' AND parent_id IS NULL)) AS enfant_id, icp.enfant1
|
||||||
FROM import.periodes p
|
FROM import.periodes p
|
||||||
JOIN import.choix_periodes icp ON p.acp_socialissues = icp.acp_social_issues
|
JOIN import.choix_periodes icp ON p.acp_socialissues = icp.acp_social_issues
|
||||||
ORDER BY id) AS t;
|
ORDER BY id) AS t
|
||||||
|
WHERE COALESCE(t.enfant_id, t.parent_id) IS NOT NULL;
|
||||||
|
|
||||||
-- 57. Link referrer to periods
|
-- 57. Link referrer to periods
|
||||||
UPDATE chill_person_accompanying_period acp
|
UPDATE chill_person_accompanying_period acp
|
||||||
SET user_id = COALESCE(
|
SET user_id = COALESCE(
|
||||||
(SELECT id FROM users WHERE users.username = ip.referrer),
|
(SELECT id FROM users WHERE users.username = ip.referrer),
|
||||||
1 -- default value ?
|
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM users)
|
||||||
)
|
)
|
||||||
FROM import.periodes ip WHERE acp.id = ip.period_id;
|
FROM import.periodes ip WHERE acp.id = ip.period_id;
|
||||||
--SELECT ip.id, (SELECT id FROM users WHERE users.username = ip.referrer) AS referrer_id, ip.referrer, acp.id as period_id, acp.user_id FROM chill_person_accompanying_period acp JOIN import.periodes ip ON ip.period_id = acp.id ORDER BY ip.id;
|
--SELECT ip.id, (SELECT id FROM users WHERE users.username = ip.referrer) AS referrer_id, ip.referrer, acp.id as period_id, acp.user_id FROM chill_person_accompanying_period acp JOIN import.periodes ip ON ip.period_id = acp.id ORDER BY ip.id;
|
||||||
@@ -557,11 +563,16 @@ SELECT setval('chill_person_accompanying_period_work_id_seq', (SELECT COALESCE(m
|
|||||||
|
|
||||||
-- 58. Link scopes to periods
|
-- 58. Link scopes to periods
|
||||||
INSERT INTO accompanying_periods_scopes (accompanying_period_id, scope_id)
|
INSERT INTO accompanying_periods_scopes (accompanying_period_id, scope_id)
|
||||||
SELECT ip.period_id, COALESCE(
|
SELECT t.period_id, t.scope_id
|
||||||
(SELECT id FROM scopes s WHERE ip.acp_scopes1::jsonb->>'fr' = s.name::jsonb->>'fr'),
|
FROM (
|
||||||
(SELECT id from scopes s WHERE s.name::jsonb->>'fr' = 'Principal') -- default value 'Principal'
|
SELECT ip.period_id, COALESCE(
|
||||||
)
|
(SELECT id FROM scopes s WHERE ip.acp_scopes1::jsonb->>'fr' = s.name::jsonb->>'fr'),
|
||||||
FROM import.periodes ip;
|
(SELECT id from scopes s WHERE s.name::jsonb->>'fr' = 'Principal'),
|
||||||
|
(SELECT distinct(first_value(id) OVER(ORDER BY id)) FROM scopes)
|
||||||
|
) AS scope_id
|
||||||
|
FROM import.periodes ip
|
||||||
|
) AS t
|
||||||
|
WHERE t.scope_id IS NOT NULL;
|
||||||
|
|
||||||
-- 59. Link origin to periods
|
-- 59. Link origin to periods
|
||||||
UPDATE chill_person_accompanying_period acp SET origin_id =
|
UPDATE chill_person_accompanying_period acp SET origin_id =
|
||||||
@@ -937,6 +948,8 @@ AND NOT EXISTS ( SELECT 1 FROM chill_3party.third_party WHERE "name" = trim(t.pe
|
|||||||
-- DOWN
|
-- DOWN
|
||||||
--
|
--
|
||||||
|
|
||||||
|
\if :run_down
|
||||||
|
|
||||||
-- Undo 68.
|
-- Undo 68.
|
||||||
--TODO
|
--TODO
|
||||||
|
|
||||||
@@ -1026,7 +1039,7 @@ SELECT setval('chill_person_household_id_seq', (SELECT COALESCE(max(id),1) FROM
|
|||||||
-- Undo 43.
|
-- Undo 43.
|
||||||
DELETE FROM chill_main_address addr USING import.personnes ip WHERE addr.id = ip.address_id;
|
DELETE FROM chill_main_address addr USING import.personnes ip WHERE addr.id = ip.address_id;
|
||||||
SELECT setval('chill_main_address_id_seq', (SELECT COALESCE(max(id),1) FROM chill_main_address));
|
SELECT setval('chill_main_address_id_seq', (SELECT COALESCE(max(id),1) FROM chill_main_address));
|
||||||
ALTER TABLE import.personnes DROP column postcode_id;
|
ALTER TABLE import.personnes DROP column postcode_arr;
|
||||||
ALTER TABLE import.personnes DROP column address_id;
|
ALTER TABLE import.personnes DROP column address_id;
|
||||||
|
|
||||||
-- Undo 42.
|
-- Undo 42.
|
||||||
@@ -1179,6 +1192,7 @@ ALTER TABLE import.periodes DROP COLUMN closingdate1;
|
|||||||
|
|
||||||
|
|
||||||
-- =============
|
-- =============
|
||||||
|
\endif
|
||||||
-- QUESTIONS
|
-- QUESTIONS
|
||||||
--
|
--
|
||||||
-- définir par défaut: quel user, quel centre ?
|
-- définir par défaut: quel user, quel centre ?
|
||||||
|
|||||||
+19
-19
@@ -119,24 +119,24 @@ CREATE TABLE "import".users (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE "import".tiers (
|
CREATE TABLE "import".tiers (
|
||||||
ID varchar(50) NULL,
|
id varchar(50) NULL,
|
||||||
CATEGORIE VARCHAR(255),
|
categorie VARCHAR(255),
|
||||||
SECTEUR_AS VARCHAR(255),
|
secteur_as VARCHAR(255),
|
||||||
COMMUNE VARCHAR(255),
|
commune VARCHAR(255),
|
||||||
NOM VARCHAR(255),
|
nom VARCHAR(255),
|
||||||
ACRONYM VARCHAR(64),
|
acronym VARCHAR(64),
|
||||||
PHONENUMBER VARCHAR(20),
|
phonenumber VARCHAR(20),
|
||||||
PHONENUMBER_2 VARCHAR(20),
|
phonenumber_2 VARCHAR(20),
|
||||||
EMAIL VARCHAR(255),
|
email VARCHAR(255),
|
||||||
PERSONNE_NOM VARCHAR(255),
|
personne_nom VARCHAR(255),
|
||||||
PERSONNE_prenom VARCHAR(255),
|
personne_prenom VARCHAR(255),
|
||||||
PERSONNE_CIVILITE VARCHAR(20),
|
personne_civilite VARCHAR(20),
|
||||||
adresse TEXT,
|
adresse TEXT,
|
||||||
CP VARCHAR(10),
|
cp VARCHAR(10),
|
||||||
TIERS_PARENT VARCHAR(255),
|
tiers_parent VARCHAR(255),
|
||||||
TIERS_PHYSIQUE_VS_MORALE VARCHAR(50),
|
tiers_physique_vs_morale VARCHAR(50),
|
||||||
POINT_DE_CONTACT_SUR_LE_TERRITOIRE TEXT,
|
point_de_contact_sur_le_territoire TEXT,
|
||||||
COORDONNEES TEXT,
|
coordonnees TEXT,
|
||||||
HORAIRES TEXT,
|
horaires TEXT,
|
||||||
OBSERVATIONS TEXT
|
observations TEXT
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,417 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
-- Nettoyage des donnees importees a partir des tables du schema import.
|
||||||
|
-- Ce script suppose que sql/import.sql a ete execute au moins partiellement.
|
||||||
|
|
||||||
|
-- 1. Commentaires et liaisons des periodes
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'periodes' AND column_name = 'period_id'
|
||||||
|
) THEN
|
||||||
|
UPDATE chill_person_accompanying_period acp
|
||||||
|
SET pinnedcomment_id = NULL
|
||||||
|
FROM import.periodes ip
|
||||||
|
WHERE acp.id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_accompanying_period_comment com
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE com.accompanyingperiod_id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_accompanying_period_work work
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE work.accompanyingperiod_id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_accompanying_period_social_issues asi
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE asi.accompanyingperiod_id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_accompanying_period_location_history hist
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE hist.period_id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM accompanying_periods_scopes scopes_link
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE scopes_link.accompanying_period_id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_accompanying_period_participation part
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE part.accompanyingperiod_id = ip.period_id;
|
||||||
|
|
||||||
|
UPDATE chill_person_accompanying_period acp
|
||||||
|
SET addresslocation_id = NULL,
|
||||||
|
personlocation_id = NULL,
|
||||||
|
user_id = NULL,
|
||||||
|
origin_id = NULL,
|
||||||
|
job_id = NULL
|
||||||
|
FROM import.periodes ip
|
||||||
|
WHERE acp.id = ip.period_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_accompanying_period acp
|
||||||
|
USING import.periodes ip
|
||||||
|
WHERE acp.id = ip.period_id;
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
-- 2. Menages, adresses et personnes
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'personnes' AND column_name = 'person_id'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_household_composition comp
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE comp.household_id = ip.person_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_household_to_addresses hh_addr
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE hh_addr.household_id = ip.person_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_household_members member
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE member.person_id = ip.person_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_household hh
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE hh.id = ip.person_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_person_center_history hist
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE hist.person_id = ip.person_id;
|
||||||
|
|
||||||
|
DELETE FROM chill_person_person person
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE person.id = ip.person_id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'personnes' AND column_name = 'address_id'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_main_address addr
|
||||||
|
USING import.personnes ip
|
||||||
|
WHERE addr.id = ip.address_id;
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
-- 3. Adresses temporaires de periodes et localisations
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'address_location_id'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_main_address addr
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE addr.id = icp.address_location_id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'localisations' AND column_name = 'address_id'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_main_address addr
|
||||||
|
USING import.localisations loc
|
||||||
|
WHERE addr.id = loc.address_id;
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
-- 4. Localisations et types de localisation
|
||||||
|
DELETE FROM chill_main_location loc
|
||||||
|
USING import.localisations il
|
||||||
|
WHERE loc.name = trim(il.locname);
|
||||||
|
|
||||||
|
DELETE FROM chill_main_location_type lt
|
||||||
|
USING import.choix_localisations icl
|
||||||
|
WHERE lt.title::jsonb->>'fr' = trim(icl.title)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM chill_main_location loc
|
||||||
|
WHERE loc.locationtype_id = lt.id
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 5. Tiers et categories
|
||||||
|
DELETE FROM chill_3party.thirdparty_category tpc
|
||||||
|
USING chill_3party.third_party tp, import.tiers it
|
||||||
|
WHERE tpc.thirdparty_id = tp.id
|
||||||
|
AND (
|
||||||
|
tp.name = trim(it.nom)
|
||||||
|
OR tp.name = trim(it.personne_nom)
|
||||||
|
);
|
||||||
|
|
||||||
|
DELETE FROM chill_3party.third_party tp
|
||||||
|
USING import.tiers it
|
||||||
|
WHERE tp.name = trim(it.personne_nom)
|
||||||
|
OR tp.name = trim(it.nom);
|
||||||
|
|
||||||
|
DELETE FROM chill_3party.party_category pc
|
||||||
|
USING import.tiers it
|
||||||
|
WHERE pc.name::jsonb->>'fr' = trim(it.categorie)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM chill_3party.thirdparty_category tpc
|
||||||
|
WHERE tpc.category_id = pc.id
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 6. Utilisateurs importes et historique des metiers
|
||||||
|
DELETE FROM chill_main_user_job_history hist
|
||||||
|
USING import.users iu
|
||||||
|
WHERE hist.user_id = (
|
||||||
|
SELECT id FROM users WHERE username = split_part(iu.email, '@', 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
DELETE FROM users u
|
||||||
|
USING import.users iu
|
||||||
|
WHERE u.username = split_part(iu.email, '@', 1);
|
||||||
|
|
||||||
|
DELETE FROM chill_main_user_job job
|
||||||
|
USING import.users iu
|
||||||
|
WHERE job.label::jsonb->>'fr' = trim(iu.metier)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM chill_main_user_job_history hist
|
||||||
|
WHERE hist.job_id = job.id
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 7. Tables de reference ajoutees pendant l'import principal
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'work_social_action1'
|
||||||
|
) AND EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'work_social_issue1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_social_action sa
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT si.id
|
||||||
|
FROM chill_person_social_issue si
|
||||||
|
WHERE si.title::jsonb->>'fr' = icp.work_social_issue1::jsonb->>'fr'
|
||||||
|
ORDER BY (si.parent_id IS NULL), si.id
|
||||||
|
LIMIT 1
|
||||||
|
) issue ON true
|
||||||
|
WHERE sa.title::jsonb->>'fr' = icp.work_social_action1::jsonb->>'fr'
|
||||||
|
AND (
|
||||||
|
(sa.issue_id IS NULL AND issue.id IS NULL)
|
||||||
|
OR sa.issue_id = issue.id
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'enfant1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_social_issue child_issue
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE child_issue.title::jsonb->>'fr' = icp.enfant1::jsonb->>'fr';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'parent1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_social_issue parent_issue
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE parent_issue.title::jsonb->>'fr' = icp.parent1::jsonb->>'fr'
|
||||||
|
AND parent_issue.parent_id IS NULL;
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DELETE FROM users u
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE u.username::text = icp.referrer::text
|
||||||
|
AND u.password = ''
|
||||||
|
AND u.enabled = false;
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'acp_scopes1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM scopes s
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE s.name::jsonb->>'fr' = icp.acp_scopes1::jsonb->>'fr'
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM accompanying_periods_scopes aps
|
||||||
|
WHERE aps.scope_id = s.id
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'job1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_main_user_job job
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE job.label::jsonb->>'fr' = icp.job1::jsonb->>'fr'
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM chill_person_accompanying_period acp
|
||||||
|
WHERE acp.job_id = job.id
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'origin1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_accompanying_period_origin origin
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE origin.label::jsonb->>'fr' = icp.origin1::jsonb->>'fr'
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM chill_person_accompanying_period acp
|
||||||
|
WHERE acp.origin_id = origin.id
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_periodes' AND column_name = 'closingmotive1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_accompanying_period_closingmotive motive
|
||||||
|
USING import.choix_periodes icp
|
||||||
|
WHERE motive.name::jsonb->>'fr' = icp.closingmotive1::jsonb->>'fr';
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_personnes' AND column_name = 'household_position1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_household_position pos
|
||||||
|
USING import.choix_personnes icp
|
||||||
|
WHERE pos.label::jsonb->>'fr' = icp.household_position1::jsonb->>'fr';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_personnes' AND column_name = 'household_composition_type1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_household_composition_type comp_type
|
||||||
|
USING import.choix_personnes icp
|
||||||
|
WHERE comp_type.label::jsonb->>'fr' = icp.household_composition_type1::jsonb->>'fr';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_personnes' AND column_name = 'maritalstatus1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_person_marital_status ms
|
||||||
|
USING import.choix_personnes icp
|
||||||
|
WHERE ms.name::jsonb->>'fr' = icp.maritalstatus1::jsonb->>'fr';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_personnes' AND column_name = 'country1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM country c
|
||||||
|
USING import.choix_personnes icp
|
||||||
|
WHERE c.name::jsonb->>'fr' = icp.country1::jsonb->>'fr'
|
||||||
|
AND c.id > 249;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'import' AND table_name = 'choix_personnes' AND column_name = 'civility1'
|
||||||
|
) THEN
|
||||||
|
DELETE FROM chill_main_civility civ
|
||||||
|
USING import.choix_personnes icp
|
||||||
|
WHERE civ.name::jsonb->>'fr' = icp.civility1::jsonb->>'fr';
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
-- 8. Suppression des colonnes techniques ajoutees par sql/import.sql
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS person_id;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS address_id;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS address_ref_id;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS postcode_id;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS postcode_arr;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS postcode1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS birthdate1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS deathdate1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS validfrom1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS household_startdate1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS civility1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS gender1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS nationality1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS countryofbirth1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS maritalstatus1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS numberofchildren1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS placeofbirth1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS memo1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS household_composition_type1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS household_position1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS mobilenumber1;
|
||||||
|
ALTER TABLE import.personnes DROP COLUMN IF EXISTS phonenumber1;
|
||||||
|
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS period_id;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS openingdate1;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS closingdate1;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS closingmotive1;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS origin1;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS job1;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS acp_scopes1;
|
||||||
|
ALTER TABLE import.periodes DROP COLUMN IF EXISTS intensity1;
|
||||||
|
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS closingmotive1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS origin1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS job1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS acp_scopes1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS parent1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS enfant1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS work_social_action1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS work_social_issue1;
|
||||||
|
ALTER TABLE import.choix_periodes DROP COLUMN IF EXISTS address_location_id;
|
||||||
|
|
||||||
|
ALTER TABLE import.choix_personnes DROP COLUMN IF EXISTS civility1;
|
||||||
|
ALTER TABLE import.choix_personnes DROP COLUMN IF EXISTS country1;
|
||||||
|
ALTER TABLE import.choix_personnes DROP COLUMN IF EXISTS maritalstatus1;
|
||||||
|
ALTER TABLE import.choix_personnes DROP COLUMN IF EXISTS household_composition_type1;
|
||||||
|
ALTER TABLE import.choix_personnes DROP COLUMN IF EXISTS household_position1;
|
||||||
|
|
||||||
|
ALTER TABLE import.choix_localisations DROP COLUMN IF EXISTS title1;
|
||||||
|
ALTER TABLE import.localisations DROP COLUMN IF EXISTS postcode_arr;
|
||||||
|
ALTER TABLE import.localisations DROP COLUMN IF EXISTS address_id;
|
||||||
|
ALTER TABLE import.localisations DROP COLUMN IF EXISTS address_ref_id;
|
||||||
|
|
||||||
|
ALTER TABLE import.tiers DROP COLUMN IF EXISTS postcode_arr;
|
||||||
|
ALTER TABLE import.tiers DROP COLUMN IF EXISTS address_id;
|
||||||
|
ALTER TABLE import.tiers DROP COLUMN IF EXISTS address_ref_id;
|
||||||
|
|
||||||
|
-- 9. Recalage des sequences principales
|
||||||
|
SELECT setval('chill_person_accompanying_period_comment_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period_comment));
|
||||||
|
SELECT setval('chill_person_accompanying_period_work_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period_work));
|
||||||
|
SELECT setval('chill_person_accompanying_period_location_history_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period_location_history));
|
||||||
|
SELECT setval('chill_person_accompanying_period_participation_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period_participation));
|
||||||
|
SELECT setval('chill_person_accompanying_period_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period));
|
||||||
|
SELECT setval('chill_person_household_composition_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_household_composition));
|
||||||
|
SELECT setval('chill_person_household_members_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_household_members));
|
||||||
|
SELECT setval('chill_person_household_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_household));
|
||||||
|
SELECT setval('chill_person_person_center_history_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_person_center_history));
|
||||||
|
SELECT setval('chill_person_person_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_person));
|
||||||
|
SELECT setval('chill_person_social_action_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_social_action));
|
||||||
|
SELECT setval('chill_person_social_issue_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_social_issue));
|
||||||
|
SELECT setval('chill_person_accompanying_period_origin_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period_origin));
|
||||||
|
SELECT setval('chill_person_accompanying_period_closingmotive_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_accompanying_period_closingmotive));
|
||||||
|
SELECT setval('chill_person_household_position_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_household_position));
|
||||||
|
SELECT setval('chill_person_household_composition_type_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_person_household_composition_type));
|
||||||
|
SELECT setval('chill_main_civility_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_main_civility));
|
||||||
|
SELECT setval('country_id_seq', (SELECT COALESCE(max(id), 1) FROM country));
|
||||||
|
SELECT setval('users_id_seq', (SELECT COALESCE(max(id), 1) FROM users));
|
||||||
|
SELECT setval('scopes_id_seq', (SELECT COALESCE(max(id), 1) FROM scopes));
|
||||||
|
SELECT setval('chill_main_user_job_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_main_user_job));
|
||||||
|
SELECT setval('chill_main_address_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_main_address));
|
||||||
|
SELECT setval('chill_main_location_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_main_location));
|
||||||
|
SELECT setval('chill_main_location_type_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_main_location_type));
|
||||||
|
SELECT setval('chill_main_user_job_history_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_main_user_job_history));
|
||||||
|
SELECT setval('chill_3party.party_category_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_3party.party_category));
|
||||||
|
SELECT setval('chill_3party.third_party_id_seq', (SELECT COALESCE(max(id), 1) FROM chill_3party.third_party));
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
Reference in New Issue
Block a user