Skip to content
Snippets Groups Projects
Commit 89d4d345 authored by aldo.gonzalez-lorenzo's avatar aldo.gonzalez-lorenzo
Browse files

Importer la base de données parcielle

parent 2aee6b0f
No related branches found
No related tags found
No related merge requests found
# Projet SAÉ 303 # Projet SAÉ 303
Code pour le projet de la SAÉ 303 : Concevoir des visualisations de données pour le web et un support animé
## Contenu
## Getting started Ce dossier contient les fichiers nécessaires pour faire marcher une version préliminaire de l'application web. Le fichier `sae303.sql` contient la base de données.
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://etulab.univ-amu.fr/gonzalez-l.a/projet-sae-303.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://etulab.univ-amu.fr/gonzalez-l.a/projet-sae-303/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation ## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support Instructions pour un déploiement local de développement sur votre ordinateur ou pour un déploiement de production sur le serveur web pédagogique.
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap ### Développement
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing Vous avez besoin de XAMPP pour un déploiement. Étapes :
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. 1. Créez une base de données appelée `sae303` avec phpMyAdmin et importez le fichier `sae303.sql`.
2. Copiez ce répertoire dans votre dossier `htdocs`.
3. Le site web est accessible localement à l'adresse URL `http://localhost/sae303/index.php`.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. Vous trouverez plus d'explications [ici](https://aldo-gonzalez-lorenzo.pedaweb.univ-amu.fr/2021/r213-tp1.html).
## Authors and acknowledgment ### Production
Show your appreciation to those who have contributed to the project.
## License Étapes :
For open source projects, say how it is licensed. 1. Allez sur [phpMyAdmin](https://a-pedagoarles-mmi.aix.univ-amu.fr/phpmyadmin/), connectez-vous et importez le fichier `sae303.sql` sur votre base de données.
2. Copiez ce répertoire dans votre dossier avec FileZilla.
3. Modifiez vos coordonnées dans le fichier `include/php/functions.php`, lignes 16 et 17.
4. Modifiez la ligne 51 du fichier `include/php/functions.php` pour faire la connexion vers la base de données du serveur web.
## Project status Vous trouverez plus d'explications [ici](https://aldo-gonzalez-lorenzo.pedaweb.univ-amu.fr/2021/r213-tp2.html).
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
import json
import random
labels = {
'contrat_etab': {'comment': "Statut de l’établissement de la filière de formation (public, privé…)"},
'cod_uai': {'comment': "Code UAI de l'établissement"},
'g_ea_lib_vx': {'comment': "Établissement"},
'dep': {'comment': "Code départemental de l’établissement"},
'dep_lib': {'comment': "Département de l’établissement"},
'region_etab_aff': {'comment': "Région de l’établissement"},
'acad_mies': {'comment': "Académie de l’établissement"},
'ville_etab': {'comment': "Commune de l’établissement"},
'select_form': {'comment': "Sélectivité"},
'fili': {'comment': "Filière de formation très agrégée"},
'lib_comp_voe_ins': {'comment': "Filière de formation détaillée"},
'form_lib_voe_acc': {'comment': "Filière de formation"},
'form_lib_voe_acc': {'comment': "Filière de formation détaillée bis"},
'detail_forma': {'comment': "Filière de formation très détaillée", 'type': "varchar(200)"},
'capa_fin': {'comment': "Capacité de l’établissement par formation"},
'voe_tot': {'comment': "Effectif total des candidats pour une formation"},
'voe_tot_f': {'comment': "Dont effectif des candidates pour une formation"},
'nb_voe_pp': {'comment': "Effectif total des candidats en phase principale"},
'nb_voe_pp_internat': {'comment': "Dont effectif des candidats ayant postulé en internat", 'type': "int(11)"},
'nb_voe_pp_bg': {'comment': "Effectif des candidats néo bacheliers généraux en phase principale"},
'nb_voe_pp_bg_brs': {'comment': "Dont effectif des candidats boursiers néo bacheliers généraux en phase principale"},
'nb_voe_pp_bt': {'comment': "Effectif des candidats néo bacheliers technologiques en phase principale"},
'nb_voe_pp_bt_brs': {'comment': "Dont effectif des candidats boursiers néo bacheliers technologiques en phase principale"},
'nb_voe_pp_bp': {'comment': "Effectif des candidats néo bacheliers professionnels en phase principale"},
'nb_voe_pp_bp_brs': {'comment': "Dont effectif des candidats boursiers néo bacheliers professionnels en phase principale"},
'nb_voe_pp_at': {'comment': "Effectif des autres candidats en phase principale"},
'nb_voe_pc': {'comment': "Effectif total des candidats en phase complémentaire"},
'nb_voe_pc_bg': {'comment': "Effectif des candidats néo bacheliers généraux en phase complémentaire"},
'nb_voe_pc_bt': {'comment': "Effectif des candidats néo bacheliers technologique en phase complémentaire"},
'nb_voe_pc_bp': {'comment': "Effectif des candidats néo bacheliers professionnels en phase complémentaire"},
'nb_voe_pc_at': {'comment': "Effectifs des autres candidats en phase complémentaire"},
'nb_cla_pp': {'comment': "Effectif total des candidats classés par l’établissement en phase principale"},
'nb_cla_pc': {'comment': "Effectif des candidats classés par l’établissement en phase complémentaire"},
'nb_cla_pp_internat': {'comment': "Effectif des candidats classés par l’établissement en internat (CPGE)", 'type': "int(11)"},
'nb_cla_pp_pasinternat': {'comment': "Effectif des candidats classés par l’établissement hors internat (CPGE)", 'type': "int(11)"},
'nb_cla_pp_bg': {'comment': "Effectif des candidats néo bacheliers généraux classés par l’établissement"},
'nb_cla_pp_bg_brs': {'comment': "Dont effectif des candidats boursiers néo bacheliers généraux classés par l’établissement"},
'nb_cla_pp_bt': {'comment': "Effectif des candidats néo bacheliers technologiques classés par l’établissement"},
'nb_cla_pp_bt_brs': {'comment': "Dont effectif des candidats boursiers néo bacheliers technologiques classés par l’établissement"},
'nb_cla_pp_bp': {'comment': "Effectif des candidats néo bacheliers professionnels classés par l’établissement"},
'nb_cla_pp_bp_brs': {'comment': "Dont effectif des candidats boursiers néo bacheliers professionnels classés par l’établissement"},
'nb_cla_pp_at': {'comment': "Effectif des autres candidats classés par l’établissement"},
'prop_tot': {'comment': "Effectif total des candidats ayant reçu une proposition d’admission de la part de l’établissement"},
'acc_tot': {'comment': "Effectif total des candidats ayant accepté la proposition de l’établissement (admis)"},
'acc_tot_f': {'comment': "Dont effectif des candidates admises"},
'acc_pp': {'comment': "Effectif des admis en phase principale"},
'acc_pc': {'comment': "Effectif des admis en phase complémentaire"},
'acc_debutpp': {'comment': "Dont effectif des admis ayant reçu leur proposition d’admission à l'ouverture de la procédure principale"},
'acc_datebac': {'comment': "Dont effectif des admis ayant reçu leur proposition d’admission avant le baccalauréat"},
'acc_finpp': {'comment': "Dont effectif des admis ayant reçu leur proposition d’admission avant la fin de la procédure principale"},
'acc_internat': {'comment': "Dont effectif des admis en internat", 'type': "int(11)"},
'acc_brs': {'comment': "Dont effectif des admis boursiers néo bacheliers"},
'acc_neobac': {'comment': "Effectif des admis néo bacheliers"},
'acc_bg': {'comment': "Effectif des admis néo bacheliers généraux"},
'acc_bt': {'comment': "Effectif des admis néo bacheliers technologiques"},
'acc_bp': {'comment': "Effectif des admis néo bacheliers professionnels"},
'acc_at': {'comment': "Effectif des autres candidats admis"},
'acc_mention_nonrenseignee': {'comment': "Dont effectif des admis néo bacheliers sans information sur la mention au bac"},
'acc_sansmention': {'comment': "Dont effectif des admis néo bacheliers sans mention au bac"},
'acc_ab': {'comment': "Dont effectif des admis néo bacheliers avec mention Assez Bien au bac"},
'acc_b': {'comment': "Dont effectif des admis néo bacheliers avec mention Bien au bac"},
'acc_tb': {'comment': "Dont effectif des admis néo bacheliers avec mention Très Bien au bac"},
'acc_tbf': {'comment': "Dont effectif des admis néo bacheliers avec mention Très Bien avec félicitations au bac"},
'acc_bg_mention': {'comment': "Effectif des admis néo bacheliers généraux ayant eu une mention au bac"},
'acc_bt_mention': {'comment': "Effectif des admis néo bacheliers technologiques ayant eu une mention au bac"},
'acc_bp_mention': {'comment': "Effectif des admis néo bacheliers professionnels ayant eu une mention au bac"},
'acc_term': {'comment': "Dont effectif des admis issus du même établissement (BTS/CPGE)", 'type': "int(11)"},
'acc_term_f': {'comment': "Dont effectif des admises issues du même établissement (BTS/CPGE)", 'type': "int(11)"},
'acc_aca_orig': {'comment': "Dont effectif des admis issus de la même académie"},
'acc_aca_orig_idf': {'comment': "Dont effectif des admis issus de la même académie (Paris/Créteil/Versailles réunies)"},
'pct_acc_debutpp': {'comment': "% d’admis ayant reçu leur proposition d’admission à l'ouverture de la procédure principale"},
'pct_acc_datebac': {'comment': "% d’admis ayant reçu leur proposition d’admission avant le baccalauréat"},
'pct_acc_finpp': {'comment': "% d’admis ayant reçu leur proposition d’admission avant la fin de la procédure principale"},
'pct_f': {'comment': "% d’admis dont filles"},
'pct_aca_orig': {'comment': "% d’admis néo bacheliers issus de la même académie"},
'pct_aca_orig_idf': {'comment': "% d’admis néo bacheliers issus de la même académie (Paris/Créteil/Versailles réunies)"},
'pct_etab_orig': {'comment': "% d’admis néo bacheliers issus du même établissement (BTS/CPGE)", 'type': "float"},
'pct_bours': {'comment': "% d’admis néo bacheliers boursiers"},
'pct_neobac': {'comment': "% d’admis néo bacheliers"},
'pct_mention_nonrenseignee': {'comment': "% d’admis néo bacheliers sans information sur la mention au bac"},
'pct_sansmention': {'comment': "% d’admis néo bacheliers sans mention au bac"},
'pct_ab': {'comment': "% d’admis néo bacheliers avec mention Assez Bien au bac"},
'pct_b': {'comment': "% d’admis néo bacheliers avec mention Bien au bac"},
'pct_tb': {'comment': "% d’admis néo bacheliers avec mention Très Bien au bac"},
'pct_tbf': {'comment': "% d’admis néo bacheliers avec mention Très Bien avec félicitations au bac"},
'pct_bg': {'comment': "% d’admis néo bacheliers généraux"},
'pct_bg_mention': {'comment': "Dont % d’admis avec mention (BG)"},
'pct_bt': {'comment': "% d’admis néo bacheliers technologiques"},
'pct_bt_mention': {'comment': "Dont % d’admis avec mention (BT)"},
'pct_bp': {'comment': "% d’admis néo bacheliers professionnels"},
'pct_bp_mention': {'comment': "Dont % d’admis avec mention (BP)"},
'prop_tot_bg': {'comment': "Effectif des candidats en terminale générale ayant reçu une proposition d’admission de la part de l’établissement"},
'prop_tot_bg_brs': {'comment': "Dont effectif des candidats boursiers en terminale générale ayant reçu une proposition d’admission de la part de l’établissement"},
'prop_tot_bg': {'comment': "Effectif des candidats en terminale technologique ayant reçu une proposition d’admission de la part de l’établissement"},
'prop_tot_bg_brs': {'comment': "Dont effectif des candidats boursiers en terminale technologique ayant reçu une proposition d’admission de la part de l’établissement"},
'prop_tot_bp': {'comment': "Effectif des candidats en terminale professionnelle ayant reçu une proposition d’admission de la part de l’établissement"},
'prop_tot_bp_brs': {'comment': "Dont effectif des candidats boursiers en terminale générale professionnelle ayant reçu une proposition d’admission de la part de l’établissement"},
'prop_tot_at': {'comment': "Effectif des autres candidats ayant reçu une proposition d’admission de la part de l’établissement"},
'lib_grp1': {'comment': "Regroupement 1 effectué par les formations pour les classements"},
'ran_grp1': {'comment': "Rang du dernier appelé du groupe 1", 'type': "int(11)"},
'lib_grp2': {'comment': "Regroupement 2 effectué par les formations pour les classements", 'type': "varchar(100)"},
'ran_grp2': {'comment': "Rang du dernier appelé du groupe 2", 'type': "int(11)"},
'lib_grp3': {'comment': "Regroupement 3 effectué par les formations pour les classements", 'type': "varchar(100)"},
'ran_grp3': {'comment': "Rang du dernier appelé du groupe 3", 'type': "int(11)"},
'list_com': {'comment': "list_com"},
'taux_adm_psup': {'comment': "Taux d’accès des candidats ayant postulé à la formation (ratio entre le dernier appelé et le nombre vœux PP)"},
# '': {'comment': "tri"},
'cod_aff_form': {'comment': "Identifiant Parcoursup"},
'lib_for_voe_ins': {'comment': "LIB_FOR_VOE_INS"},
'detail_forma2': {'comment': "Concours communs et banque d'épreuves", 'type': "varchar(100)"},
'lien_form_psup': {'comment': "Lien de la formation sur la plateforme Parcoursup"},
'taux_adm_psup_gen': {'comment': "Dont taux d’accès des candidats ayant un bac général ayant postulé à la formation"},
'taux_adm_psup_techno': {'comment': "Dont taux d’accès des candidats ayant un bac technologique ayant postulé à la formation"},
'taux_adm_psup_pro': {'comment': "Dont taux d’accès des candidats ayant un bac professionnel ayant postulé à la formation"},
# '': {'comment': "etablissement_id_paysage"},
# '': {'comment': "composante_id_paysage"},
}
beginning = """SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
"""
ending = """
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;"""
def find_types(labels, data):
for key in labels:
if 'type' in labels[key]:
continue
cur_type = type(data[0]['fields'][key])
# print(cur_type)
if cur_type == str:
length = max(len(datum['fields'][key]) for datum in data if key in datum['fields'])
labels[key]['type'] = f'varchar({length})'
elif cur_type == int:
labels[key]['type'] = 'int(11)'
elif cur_type == float:
labels[key]['type'] = 'float'
else:
assert False
def make_row(fields, i) -> str:
values = [i]
for key in labels:
if 'varchar' in labels[key]['type']:
if key in fields:
string = fields[key].replace('"', '')
value = f'"{string}"'
else:
value = '""'
else:
value = fields[key] if key in fields else 0
values.append(value)
return '(' + ', '.join(f'{v}' for v in values) + '),\n'
# return f'({i}, "{fields["acad_mies"]}", "{fields["acc_ab"]}", "{fields["acc_aca_orig"]}", "{fields["ville_etab"]}", "{fields["lib_for_voe_ins"]}"),\n'
with open('fr-esr-parcoursup.json', 'r') as f:
data = json.load(f)
random.shuffle(data)
data = data[:1000]
find_types(labels, data)
lines = [beginning]
lines.append("DROP TABLE IF EXISTS `parcoursup`;\n")
lines.append("CREATE TABLE IF NOT EXISTS `parcoursup` (\n")
lines.append(" `id` int(11) NOT NULL AUTO_INCREMENT,\n")
for k, v in labels.items():
lines.append(f' `{k}` {v["type"]} NOT NULL COMMENT "{v["comment"]}",\n')
lines.append(" PRIMARY KEY (`id`)")
lines.append("\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n\n")
lines.append('INSERT INTO `parcoursup` (`id`, ' + ', '.join(f'`{k}`' for k in labels) + ') VALUES\n')
# print(lines)
for i, datum in enumerate(data):
lines.append(make_row(datum['fields'], i+1))
lines.append(ending)
with open('dog_breeds.sql', 'w') as writer:
writer.writelines(lines)
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment