diff --git a/datasette/inspect-data.json b/datasette/inspect-data.json new file mode 100644 index 0000000..bda64b0 --- /dev/null +++ b/datasette/inspect-data.json @@ -0,0 +1,12 @@ +{ + "db": { + "hash": "e7781c4da0df3983d9e8bfc09d513162302d787bff766e3cfee2dd5dcd272b85", + "size": 121118720, + "file": "datasette/db.db", + "tables": { + "decp": { + "count": 292374 + } + } + } +} \ No newline at end of file diff --git a/datasette/metadata.yaml b/datasette/metadata.yaml new file mode 100644 index 0000000..c49b10e --- /dev/null +++ b/datasette/metadata.yaml @@ -0,0 +1,31 @@ +--- +extra_css_urls: +- "/static/custom.css" +title: Exploration et téléchargement des données essentielles de la commande publique + (format tabulaire) +description: Ce site vous permet de filtrer et trier les données sur les marchés publics, + et de télécharger le résultat sous la forme d'un fichier que vous pourrez ouvrir + dans un logiciel de tableur (MS Excel, LibreOffice, OpenOffice). +source: Données essentielles de la commande publique +source_url: https://www.data.gouv.fr/fr/datasets/608c055b35eb4e6ee20eb325/ +license: Licence ouverte +license_url: https://www.etalab.gouv.fr/wp-content/uploads/2014/05/Licence_Ouverte.pdf +databases: + db: + tables: + decp: + title: Marchés et titulaires (= DECP) + description_html: |- + Marché publics et leurs titulaires, données équivalentes au format réglementaire. Une ligne = un titulaire de marché, donc ces données ne sont pas adaptées pour travailler avec les montants de marché ou compter les marchés. + size: 40 + download: https://www.data.gouv.fr/fr/datasets/r/8587fe77-fb31-4155-8753-f6a3c5e0f5c9 + decp-sans-titulaires: + title: Marchés publics sans leurs titulaires + description_html: Marchés publics sans les titulaires (pas de colonnes titulaire). Une ligne = un marché, donc ces données sont adaptées pour travailler avec les montants de marchés et compter les marchés. + size: 40 + download: https://www.data.gouv.fr/fr/datasets/r/834c14dd-037c-4825-958d-0a841c4777ae + decp-titulaires: + title: Données sur les titulaires et géolocalisation + description_html: Données détaillées sur les titulaires, dont leur géolocalisation. Les colonnes formePrix, procedure, objetModification et datePublicationDonnees sont absentes. Une ligne = un titulaire de marché, donc ces données ne sont pas adaptées pour travailler avec les montants de marché ou compter les marchés. + size: 40 + download: https://www.data.gouv.fr/fr/datasets/r/25fcd9e6-ce5a-41a7-b6c0-f140abb2a060 diff --git a/datasette/plugins/menu.py b/datasette/plugins/menu.py new file mode 100644 index 0000000..ddf0b9a --- /dev/null +++ b/datasette/plugins/menu.py @@ -0,0 +1,12 @@ +from datasette import hookimpl + +@hookimpl +def menu_links(datasette, actor): + return [ + {"href": "https://teamopendata.org/t/decp-info-les-donnees-de-la-commande-publique-pour-tous-questions-reponses-discussions/2948", "label": "Présentation / FAQ"}, + {"href": "https://github.com/ColinMaudry/decp-table-schema/#documentation-du-sch%C3%A9ma", "label": "Documentation des champs"}, + {"href": "https://github.com/ColinMaudry/decp.info", "label": "Code source"}, + {"href": "/versions", "label": "Notes de version"}, + {"href": "/inscription", "label": "Lettre d'information"}, + {"href": "/mentions-legales", "label": "Mentions légales"} + ] diff --git a/datasette/plugins/xlsx.py b/datasette/plugins/xlsx.py new file mode 100644 index 0000000..88bf4dd --- /dev/null +++ b/datasette/plugins/xlsx.py @@ -0,0 +1,75 @@ +from datasette import hookimpl +from datasette.utils.asgi import Response +from openpyxl import Workbook +from openpyxl.writer.excel import save_virtual_workbook +from openpyxl.cell import WriteOnlyCell +from openpyxl.styles import Alignment, Font, PatternFill +from tempfile import NamedTemporaryFile + + +def render_spreadsheet(rows): + wb = Workbook(write_only=True) + ws = wb.create_sheet() + ws = wb.active + ws.title = "decp" + + columnSpecs = { + 'acheteur.nom': { + 'width': 7, + 'wrapText': True + }, + 'objet': { + 'width': 7, + 'wrapText': True + }, + 'titulaire.denominationSociale': { + 'width': 7, + 'wrapText': True + }, + } + + columns = rows[0].keys() + if columns[0] == "rowid": + columns = columns[1:] + + letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + headers = [] + index = 0 + for col in columns : + c = WriteOnlyCell(ws, col) + c.fill = PatternFill("solid", fgColor="DDEFFF") + headers.append(c) + if col in columnSpecs: + ws.column_dimensions[letters[index]].width = columnSpecs[col]['width'] * 5 + else: + ws.column_dimensions[letters[index]].bestFit = True + index = index + 1 + ws.append(headers) + + for row in rows: + wsRow = [] + for col in columns: + c = WriteOnlyCell(ws, row[col]) + if col in columnSpecs : + c.alignment = Alignment(wrapText = columnSpecs[col]['wrapText']) + wsRow.append(c) + ws.append(wsRow) + + with NamedTemporaryFile() as tmp: + wb.save(tmp.name) + tmp.seek(0) + return Response( + tmp.read(), + headers={ + 'Content-Disposition': 'attachment; filename=decp.xlsx', + 'Content-type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + } + ) + + +@hookimpl +def register_output_renderer(): + return {"extension": "xlsx", + "render": render_spreadsheet, + "can_render": lambda: False} diff --git a/datasette/settings.json b/datasette/settings.json new file mode 100644 index 0000000..a9c9b3e --- /dev/null +++ b/datasette/settings.json @@ -0,0 +1,12 @@ +{ + "sql_time_limit_ms": 10000, + "max_returned_rows": 50000, + "num_sql_threads": 6, + "default_cache_ttl": 3600, + "max_csv_mb": 0, + "force_https_urls": 1, + "allow_facet": "off", + "suggest_facets": "off", + "template_debug": 1, + "hash_urls": 1 +} diff --git a/datasette/static/custom.css b/datasette/static/custom.css new file mode 100644 index 0000000..6e291c4 --- /dev/null +++ b/datasette/static/custom.css @@ -0,0 +1,166 @@ +section.content > div.table-wrapper { + display: inline-block; +} + +a, a:visited, a:focus, a:active { + color: #276890; + text-decoration: underline; +} + +a:hover { + color: #0c286d; +} + +a.explore { + font-size: 1.6em; +} + +a.nodec { + text-decoration: none; +} + +nav ul { + list-style-type: none; +} + +nav li { + padding: 10px; + border-top: solid 1px #fff; +} + +nav summary { + font-weight: bold; +} + +nav .nav-menu-inner { + padding: 10px 0; +} + +table.rows-and-columns td > div { + max-height: 100px; + font-size: 0.8em; + overflow-y: auto; + overflow-x: hidden; +} + +table.rows-and-columns tr:nth-child(even) { + background-color: #DDEFFF; +} + +h4,.header4 { + text-decoration: none; +} + +table.rows-and-columns td.col-objet > div { + min-width: 140px; +} + +table.rows-and-columns td.col-procedure > div { + min-width: 140px; +} + +td.col-longitude,th.col-longitude,td.col-latitude,th.col-latitude { + display: none; +} + +#sib-container form label { + width: 100%; +} + +.db-table .columns { + font-size: 0.9em; + color: #555; +} + +.db-presentation { + border-left: 10px solid #276890; + padding-left: 10px; + max-width: 1000px; + margin-top: 30px; + font-size: 1.2em; +} + + + +/* +Flaticon icon font: Flaticon +Creation date: 22/06/2016 15:35 +*/ + +@font-face { +font-family: "Flaticon"; +src: url("./font/Flaticon.eot"); +src: url("./font/Flaticon.eot?#iefix") format("embedded-opentype"), + url("./font/Flaticon.woff") format("woff"), + url("./font/Flaticon.ttf") format("truetype"), + url("./font/Flaticon.svg#Flaticon") format("svg"); +font-weight: normal; +font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { +@font-face { +font-family: "Flaticon"; +src: url("./font/Flaticon.svg#Flaticon") format("svg"); +} +} + +[class^="flaticon-"]:before, [class*=" flaticon-"]:before, +[class^="flaticon-"]:after, [class*=" flaticon-"]:after { +font-family: Flaticon; + font-size: 20px; +font-style: normal; +font-weight: bold; +margin-left: 20px; +} + +.flaticon-avatar:before { content: "\f100"; } +.flaticon-avatar-1:before { content: "\f101"; } +.flaticon-back:before { content: "\f102"; } +.flaticon-book:before { content: "\f103"; } +.flaticon-cancel:before { content: "\f104"; } +.flaticon-chat:before { content: "\f105"; } +.flaticon-chat-1:before { content: "\f106"; } +.flaticon-chat-2:before { content: "\f107"; } +.flaticon-copy:before { content: "\f108"; } +.flaticon-dislike:before { content: "\f109"; } +.flaticon-download:before { content: "\f10a"; } +.flaticon-download-1:before { content: "\f10b"; } +.flaticon-edit:before { content: "\f10c"; } +.flaticon-envelope:before { content: "\f10d"; } +.flaticon-folder:before { content: "\f10e"; } +.flaticon-garbage:before { content: "\f10f"; } +.flaticon-glasses:before { content: "\f110"; } +.flaticon-hand:before { content: "\f111"; } +.flaticon-headphones:before { content: "\f112"; } +.flaticon-heart:before { content: "\f113"; } +.flaticon-house:before { content: "\f114"; } +.flaticon-like:before { content: "\f115"; } +.flaticon-link:before { content: "\f116"; } +.flaticon-logout:before { content: "\f117"; } +.flaticon-magnifying-glass:before { content: "\f118"; } +.flaticon-monitor:before { content: "\f119"; } +.flaticon-musical-note:before { content: "\f11a"; } +.flaticon-next:before { content: "\f11b"; } +.flaticon-next-1:before { content: "\f11c"; } +.flaticon-padlock:before { content: "\f11d"; } +.flaticon-paper-plane:before { content: "\f11e"; } +.flaticon-phone-call:before { content: "\f11f"; } +.flaticon-photo-camera:before { content: "\f120"; } +.flaticon-pie-chart:before { content: "\f121"; } +.flaticon-piggy-bank:before { content: "\f122"; } +.flaticon-placeholder:before { content: "\f123"; } +.flaticon-printer:before { content: "\f124"; } +.flaticon-reload:before { content: "\f125"; } +.flaticon-settings:before { content: "\f126"; } +.flaticon-settings-1:before { content: "\f127"; } +.flaticon-share:before { content: "\f128"; } +.flaticon-shopping-bag:before { content: "\f129"; } +.flaticon-shopping-cart:before { content: "\f12a"; } +.flaticon-shuffle:before { content: "\f12b"; } +.flaticon-speaker:before { content: "\f12c"; } +.flaticon-star:before { content: "\f12d"; } +.flaticon-tag:before { content: "\f12e"; } +.flaticon-upload:before { content: "\f12f"; } +.flaticon-upload-1:before { content: "\f130"; } +.flaticon-vector:before { content: "\f131"; } diff --git a/datasette/static/font/Flaticon.eot b/datasette/static/font/Flaticon.eot new file mode 100644 index 0000000..d5f80f6 Binary files /dev/null and b/datasette/static/font/Flaticon.eot differ diff --git a/datasette/static/font/Flaticon.svg b/datasette/static/font/Flaticon.svg new file mode 100644 index 0000000..b679e84 --- /dev/null +++ b/datasette/static/font/Flaticon.svg @@ -0,0 +1,445 @@ + + + + diff --git a/datasette/static/font/Flaticon.ttf b/datasette/static/font/Flaticon.ttf new file mode 100644 index 0000000..399bb49 Binary files /dev/null and b/datasette/static/font/Flaticon.ttf differ diff --git a/datasette/static/font/Flaticon.woff b/datasette/static/font/Flaticon.woff new file mode 100644 index 0000000..6bbf5e6 Binary files /dev/null and b/datasette/static/font/Flaticon.woff differ diff --git a/datasette/static/font/_flaticon.scss b/datasette/static/font/_flaticon.scss new file mode 100644 index 0000000..102084f --- /dev/null +++ b/datasette/static/font/_flaticon.scss @@ -0,0 +1,139 @@ + /* + Flaticon icon font: Flaticon + Creation date: 22/06/2016 15:35 + */ + + @font-face { + font-family: "Flaticon"; + src: url("./Flaticon.eot"); + src: url("./Flaticon.eot?#iefix") format("embedded-opentype"), + url("./Flaticon.woff") format("woff"), + url("./Flaticon.ttf") format("truetype"), + url("./Flaticon.svg#Flaticon") format("svg"); + font-weight: normal; + font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: "Flaticon"; + src: url("./Flaticon.svg#Flaticon") format("svg"); + } +} + + .fi:before{ + display: inline-block; + font-family: "Flaticon"; + font-style: normal; + font-weight: normal; + font-variant: normal; + line-height: 1; + text-decoration: inherit; + text-rendering: optimizeLegibility; + text-transform: none; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + font-smoothing: antialiased; + } + + .flaticon-avatar:before { content: "\f100"; } +.flaticon-avatar-1:before { content: "\f101"; } +.flaticon-back:before { content: "\f102"; } +.flaticon-book:before { content: "\f103"; } +.flaticon-cancel:before { content: "\f104"; } +.flaticon-chat:before { content: "\f105"; } +.flaticon-chat-1:before { content: "\f106"; } +.flaticon-chat-2:before { content: "\f107"; } +.flaticon-copy:before { content: "\f108"; } +.flaticon-dislike:before { content: "\f109"; } +.flaticon-download:before { content: "\f10a"; } +.flaticon-download-1:before { content: "\f10b"; } +.flaticon-edit:before { content: "\f10c"; } +.flaticon-envelope:before { content: "\f10d"; } +.flaticon-folder:before { content: "\f10e"; } +.flaticon-garbage:before { content: "\f10f"; } +.flaticon-glasses:before { content: "\f110"; } +.flaticon-hand:before { content: "\f111"; } +.flaticon-headphones:before { content: "\f112"; } +.flaticon-heart:before { content: "\f113"; } +.flaticon-house:before { content: "\f114"; } +.flaticon-like:before { content: "\f115"; } +.flaticon-link:before { content: "\f116"; } +.flaticon-logout:before { content: "\f117"; } +.flaticon-magnifying-glass:before { content: "\f118"; } +.flaticon-monitor:before { content: "\f119"; } +.flaticon-musical-note:before { content: "\f11a"; } +.flaticon-next:before { content: "\f11b"; } +.flaticon-next-1:before { content: "\f11c"; } +.flaticon-padlock:before { content: "\f11d"; } +.flaticon-paper-plane:before { content: "\f11e"; } +.flaticon-phone-call:before { content: "\f11f"; } +.flaticon-photo-camera:before { content: "\f120"; } +.flaticon-pie-chart:before { content: "\f121"; } +.flaticon-piggy-bank:before { content: "\f122"; } +.flaticon-placeholder:before { content: "\f123"; } +.flaticon-printer:before { content: "\f124"; } +.flaticon-reload:before { content: "\f125"; } +.flaticon-settings:before { content: "\f126"; } +.flaticon-settings-1:before { content: "\f127"; } +.flaticon-share:before { content: "\f128"; } +.flaticon-shopping-bag:before { content: "\f129"; } +.flaticon-shopping-cart:before { content: "\f12a"; } +.flaticon-shuffle:before { content: "\f12b"; } +.flaticon-speaker:before { content: "\f12c"; } +.flaticon-star:before { content: "\f12d"; } +.flaticon-tag:before { content: "\f12e"; } +.flaticon-upload:before { content: "\f12f"; } +.flaticon-upload-1:before { content: "\f130"; } +.flaticon-vector:before { content: "\f131"; } + + $font-Flaticon-avatar: "\f100"; + $font-Flaticon-avatar-1: "\f101"; + $font-Flaticon-back: "\f102"; + $font-Flaticon-book: "\f103"; + $font-Flaticon-cancel: "\f104"; + $font-Flaticon-chat: "\f105"; + $font-Flaticon-chat-1: "\f106"; + $font-Flaticon-chat-2: "\f107"; + $font-Flaticon-copy: "\f108"; + $font-Flaticon-dislike: "\f109"; + $font-Flaticon-download: "\f10a"; + $font-Flaticon-download-1: "\f10b"; + $font-Flaticon-edit: "\f10c"; + $font-Flaticon-envelope: "\f10d"; + $font-Flaticon-folder: "\f10e"; + $font-Flaticon-garbage: "\f10f"; + $font-Flaticon-glasses: "\f110"; + $font-Flaticon-hand: "\f111"; + $font-Flaticon-headphones: "\f112"; + $font-Flaticon-heart: "\f113"; + $font-Flaticon-house: "\f114"; + $font-Flaticon-like: "\f115"; + $font-Flaticon-link: "\f116"; + $font-Flaticon-logout: "\f117"; + $font-Flaticon-magnifying-glass: "\f118"; + $font-Flaticon-monitor: "\f119"; + $font-Flaticon-musical-note: "\f11a"; + $font-Flaticon-next: "\f11b"; + $font-Flaticon-next-1: "\f11c"; + $font-Flaticon-padlock: "\f11d"; + $font-Flaticon-paper-plane: "\f11e"; + $font-Flaticon-phone-call: "\f11f"; + $font-Flaticon-photo-camera: "\f120"; + $font-Flaticon-pie-chart: "\f121"; + $font-Flaticon-piggy-bank: "\f122"; + $font-Flaticon-placeholder: "\f123"; + $font-Flaticon-printer: "\f124"; + $font-Flaticon-reload: "\f125"; + $font-Flaticon-settings: "\f126"; + $font-Flaticon-settings-1: "\f127"; + $font-Flaticon-share: "\f128"; + $font-Flaticon-shopping-bag: "\f129"; + $font-Flaticon-shopping-cart: "\f12a"; + $font-Flaticon-shuffle: "\f12b"; + $font-Flaticon-speaker: "\f12c"; + $font-Flaticon-star: "\f12d"; + $font-Flaticon-tag: "\f12e"; + $font-Flaticon-upload: "\f12f"; + $font-Flaticon-upload-1: "\f130"; + $font-Flaticon-vector: "\f131"; \ No newline at end of file diff --git a/datasette/static/font/flaticon.css b/datasette/static/font/flaticon.css new file mode 100644 index 0000000..1d54a8c --- /dev/null +++ b/datasette/static/font/flaticon.css @@ -0,0 +1,81 @@ + /* + Flaticon icon font: Flaticon + Creation date: 22/06/2016 15:35 + */ + +@font-face { + font-family: "Flaticon"; + src: url("./Flaticon.eot"); + src: url("./Flaticon.eot?#iefix") format("embedded-opentype"), + url("./Flaticon.woff") format("woff"), + url("./Flaticon.ttf") format("truetype"), + url("./Flaticon.svg#Flaticon") format("svg"); + font-weight: normal; + font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: "Flaticon"; + src: url("./Flaticon.svg#Flaticon") format("svg"); + } +} + +[class^="flaticon-"]:before, [class*=" flaticon-"]:before, +[class^="flaticon-"]:after, [class*=" flaticon-"]:after { + font-family: Flaticon; + font-size: 20px; +font-style: normal; +margin-left: 20px; +} + +.flaticon-avatar:before { content: "\f100"; } +.flaticon-avatar-1:before { content: "\f101"; } +.flaticon-back:before { content: "\f102"; } +.flaticon-book:before { content: "\f103"; } +.flaticon-cancel:before { content: "\f104"; } +.flaticon-chat:before { content: "\f105"; } +.flaticon-chat-1:before { content: "\f106"; } +.flaticon-chat-2:before { content: "\f107"; } +.flaticon-copy:before { content: "\f108"; } +.flaticon-dislike:before { content: "\f109"; } +.flaticon-download:before { content: "\f10a"; } +.flaticon-download-1:before { content: "\f10b"; } +.flaticon-edit:before { content: "\f10c"; } +.flaticon-envelope:before { content: "\f10d"; } +.flaticon-folder:before { content: "\f10e"; } +.flaticon-garbage:before { content: "\f10f"; } +.flaticon-glasses:before { content: "\f110"; } +.flaticon-hand:before { content: "\f111"; } +.flaticon-headphones:before { content: "\f112"; } +.flaticon-heart:before { content: "\f113"; } +.flaticon-house:before { content: "\f114"; } +.flaticon-like:before { content: "\f115"; } +.flaticon-link:before { content: "\f116"; } +.flaticon-logout:before { content: "\f117"; } +.flaticon-magnifying-glass:before { content: "\f118"; } +.flaticon-monitor:before { content: "\f119"; } +.flaticon-musical-note:before { content: "\f11a"; } +.flaticon-next:before { content: "\f11b"; } +.flaticon-next-1:before { content: "\f11c"; } +.flaticon-padlock:before { content: "\f11d"; } +.flaticon-paper-plane:before { content: "\f11e"; } +.flaticon-phone-call:before { content: "\f11f"; } +.flaticon-photo-camera:before { content: "\f120"; } +.flaticon-pie-chart:before { content: "\f121"; } +.flaticon-piggy-bank:before { content: "\f122"; } +.flaticon-placeholder:before { content: "\f123"; } +.flaticon-printer:before { content: "\f124"; } +.flaticon-reload:before { content: "\f125"; } +.flaticon-settings:before { content: "\f126"; } +.flaticon-settings-1:before { content: "\f127"; } +.flaticon-share:before { content: "\f128"; } +.flaticon-shopping-bag:before { content: "\f129"; } +.flaticon-shopping-cart:before { content: "\f12a"; } +.flaticon-shuffle:before { content: "\f12b"; } +.flaticon-speaker:before { content: "\f12c"; } +.flaticon-star:before { content: "\f12d"; } +.flaticon-tag:before { content: "\f12e"; } +.flaticon-upload:before { content: "\f12f"; } +.flaticon-upload-1:before { content: "\f130"; } +.flaticon-vector:before { content: "\f131"; } \ No newline at end of file diff --git a/datasette/static/font/flaticon.html b/datasette/static/font/flaticon.html new file mode 100644 index 0000000..f638216 --- /dev/null +++ b/datasette/static/font/flaticon.html @@ -0,0 +1,705 @@ + + + + + + +
+Instructions
+ +
+ <head>
+
...
+
<link rel="stylesheet" type="text/css" href="your_website_domain/css_root/flaticon.css">
+
...
+
</head>
+
+
+ 3Use the icon class on "display: inline" elements:
+
+ Use example: <i class="flaticon-airplane49"></i> or <span class="flaticon-airplane49"></span>
+
Under CC: Gregor Cresnar
+ + <i class="flaticon-avatar"></i> +
++ + <i class="flaticon-avatar-1"></i> +
++ + <i class="flaticon-back"></i> +
++ + <i class="flaticon-book"></i> +
++ {% if metadata.license or metadata.license_url %}Licence des données : + {% if metadata.license_url %} + {{ metadata.license or metadata.license_url }} + {% else %} + {{ metadata.license }} + {% endif %} + {% endif %} + {% if metadata.source or metadata.source_url %}{% if metadata.license or metadata.license_url %}·{% endif %} + Source des données : {% if metadata.source_url %} + + {% endif %}{{ metadata.source or metadata.source_url }}{% if metadata.source_url %}{% endif %} + {% endif %} + {% if metadata.about or metadata.about_url %}{% if metadata.license or metadata.license_url or metadata.source or metadata.source_url %}·{% endif %} + Plus d'informations : {% if metadata.about_url %} + + {% endif %}{{ metadata.about or metadata.about_url }}{% if metadata.about_url %}{% endif %} + {% endif %} +
+{% endif %} diff --git a/datasette/templates/_footer.html b/datasette/templates/_footer.html new file mode 100644 index 0000000..dcf46fd --- /dev/null +++ b/datasette/templates/_footer.html @@ -0,0 +1,23 @@ +Propulsé par Datasette + +{% if metadata %} + {% if metadata.license or metadata.license_url %}· Licence des données : + {% if metadata.license_url %} + {{ metadata.license or metadata.license_url }} + {% else %} + {{ metadata.license }} + {% endif %} + {% endif %} + {% if metadata.source or metadata.source_url %}· + Source des données : {% if metadata.source_url %} + + {% endif %}{{ metadata.source or metadata.source_url }}{% if metadata.source_url %}{% endif %} + {% endif %} + · Code source : Github + {% if metadata.about or metadata.about_url %}· + Plus d'informations : {% if metadata.about_url %} + + {% endif %}{{ metadata.about or metadata.about_url }}{% if metadata.about_url %}{% endif %} + {% endif %} + · Mentions légales +{% endif %} diff --git a/datasette/templates/_table.html b/datasette/templates/_table.html new file mode 100644 index 0000000..ccc2d9c --- /dev/null +++ b/datasette/templates/_table.html @@ -0,0 +1,34 @@ +{% if display_rows %} +| + {% if not column.sortable %} + {{ column.name }} + {% else %} + {% if column.name == sort %} + {{ column.name }} ▼ + {% else %} + {{ column.name }}{% if column.name == sort_desc %} ▲{% endif %} + {% endif %} + {% endif %} + | + {% endfor %} +
|---|
{% if cell.column == "titulaire.id" or cell.column == "acheteur.id" %}{{ cell.value }}{% elif cell.column == "codeAPE" %} {{ cell.value }} {% else %}{{ cell.value }}{% endif %} |
+ {% endfor %}
+
0 lignes
+{% endif %} diff --git a/datasette/templates/about.html b/datasette/templates/about.html new file mode 100644 index 0000000..290fd9d --- /dev/null +++ b/datasette/templates/about.html @@ -0,0 +1,3 @@ +{% extends "base.html" %} + +Use this tool to try out different actor and allow combinations. See Defining permissions with "allow" blocks for documentation.
+ + + +{% if error %}{% endif %} + +{% if result == "True" %}{% endif %} + +{% if result == "False" %}{% endif %} + +{% endblock %} diff --git a/datasette/templates/base.html b/datasette/templates/base.html new file mode 100644 index 0000000..874aa19 --- /dev/null +++ b/datasette/templates/base.html @@ -0,0 +1,85 @@ + + + ++ accueil +
+ {{ super() }} +{% endblock %} + +{% block content %} + + + + + + + +{% if attached_databases %} + +{% endif %} + +decp.info vous permet d'explorer les données à travers différentes vues. Selon que vous soyez plutôt intéressé·e par le montant, les titulaires ou les caractériques d'un marché public, une vue vous sera plus utile qu'une autre.
+ +{% for table in tables %} +{% if show_hidden or not table.hidden %} +Description : {{ metadata.tables[table.name].description_html | safe }} (CSV)
+Colonnes : {% for column in table.columns %}{{ column }}{% if not loop.last %}, {% endif %}{% endfor %}
+{% if table.count is none %}{% else %}{{ "{:,}".format(table.count) }} ligne{% if table.count == 1 %}{% else %}s{% endif %}{% endif %}
+... and {{ "{:,}".format(hidden_count) }} hidden table{% if hidden_count == 1 %}{% else %}s{% endif %}
+{% endif %} + +{% if views %} +Download SQLite DB: {{ database }}.db {{ format_bytes(size) }}
+{% endif %} + +{% include "_codemirror_foot.html" %} + +{% endblock %} diff --git a/datasette/templates/error.html b/datasette/templates/error.html new file mode 100644 index 0000000..3aa13ea --- /dev/null +++ b/datasette/templates/error.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block title %}{% if title %}{{ title }}{% else %}Error {{ status }}{% endif %}{% endblock %} + +{% block nav %} ++ accueil +
+ {{ super() }} +{% endblock %} + +{% block content %} + +Présentation / FAQ / discussions
+ + + +Se tenir informé des nouveautés de decp.info
+ + + + + +{% endblock %} diff --git a/datasette/templates/logout.html b/datasette/templates/logout.html new file mode 100644 index 0000000..9873867 --- /dev/null +++ b/datasette/templates/logout.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} + +{% block title %}Log out{% endblock %} + +{% block nav %} ++ home +
+ {{ super() }} +{% endblock %} + +{% block content %} + +You are logged in as {{ display_actor(actor) }}
+ + + +{% endblock %} diff --git a/datasette/templates/messages_debug.html b/datasette/templates/messages_debug.html new file mode 100644 index 0000000..e0ab9a4 --- /dev/null +++ b/datasette/templates/messages_debug.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} + +{% block title %}Debug messages{% endblock %} + +{% block content %} + +Set a message:
+ + + +{% endblock %} diff --git a/datasette/templates/pages/inscription.html b/datasette/templates/pages/inscription.html new file mode 100644 index 0000000..e68dd42 --- /dev/null +++ b/datasette/templates/pages/inscription.html @@ -0,0 +1,240 @@ +{% extends "base.html" %} +{% block title %}Se tenir informé{% endblock %} +{% block nav %} ++ accueil +
+ {{ super() }} +{% endblock %} +{% block content %} + +Mentions légales et politique de confidentialité
+ + + + + + + + ++ accueil +
+ {{ super() }} +{% endblock %} +{% block content %} + +Le site decp.info est édité par Colin Maudry, inscrit au répertoire SIRENE sous le numéro 812 231 132, dont le siège social est situé à Rennes, et dont l'adresse email est colin@maudry.com.
+Le site est hébergé en France par :
+ +Scaleway par ONLINE, SAS, au capital de 214 410,50 Euros
+Siège social : 8 rue de la ville l'Evêque-75008 PARIS
+RCS Paris B 433 115 904, TVA FR35433115904
+https://www.scaleway.com
Les icônes de la page d'accueil ont été dessinées par Gregor Cresnar de www.flaticon.com
+ + +Ce site dépose un petit fichier texte (un « cookie ») sur votre ordinateur lorsque vous le consultez (Wikipédia). Cela me permet de mesurer le nombre de visites et de distinguer les nouveaux visiteurs des utilisateurs réguliers.
+ + + +C’est vrai, vous n’avez pas eu à cliquer sur un bloc qui recouvre la moitié de la page pour dire que vous êtes d’accord avec le dépôt de cookies.
+ +Rien d’exceptionnel, je respecte simplement la loi, qui dit que certains outils de suivi d’audience, correctement configurés pour respecter la vie privée, sont exemptés d’autorisation préalable.
+ +J’utilise pour cela Matomo, un outil libre, paramétré pour être en conformité avec la recommandation « Cookies » de la CNIL. Cela signifie que votre adresse IP, par exemple, est anonymisée avant d’être enregistrée. Il m’est donc impossible d’associer vos visites sur ce site à votre personne.
++ accueil +
+ {{ super() }} +{% endblock %} +{% block content %} + ++ Data license: + Apache License 2.0 + · + Data source: + + tests/fixtures.py + · + About: + + About Datasette +
++ 1,258 rows in 24 tables, 206 rows in 5 hidden tables, 4 views +
+compound_three_primary_keys, sortable, facetable, roadside_attraction_characteristics, simple_primary_key, ...
++ 6 rows in 2 tables +
+ ++ Data license: + Apache License 2.0 + · + Data source: + + tests/fixtures.py + · + About: + + About Datasette +
+ + + + ++ Data license: + Apache License 2.0 + · + Data source: + + tests/fixtures.py + · + About: + + About Datasette +
+This data as json, CSV (advanced)
+ ++ Suggested facets: tags, created (date), tags (array) +
+ ++ created + + ✖ + +
++ city_id + + ✖ + +
+| + Link + | ++ rowid ▼ + | ++ attraction_id + | ++ characteristic_id + | +
|---|---|---|---|
| 1 | +1 | +The Mystery Spot 1 | +Paranormal 2 | +
| 2 | +2 | +Winchester Mystery House 2 | +Paranormal 2 | +
| 3 | +3 | +Bigfoot Discovery Museum 4 | +Paranormal 2 | +
JSON shape: + default, + array, + newline-delimited +
+ +CREATE TABLE roadside_attraction_characteristics ( + attraction_id INTEGER REFERENCES roadside_attractions(pk), + characteristic_id INTEGER REFERENCES attraction_characteristic(pk) +);+
This data as json
+| + pk + | ++ name + | ++ address + | ++ latitude + | ++ longitude + | +
|---|---|---|---|---|
| 2 | +Winchester Mystery House | +525 South Winchester Boulevard, San Jose, CA 95128 | +37.3184 | +-121.9511 | +
+ home +
+ {{ super() }} +{% endblock %} + +{% block content %} + +Actor: {{ check.actor|tojson }}
+ {% if check.resource %} +Resource: {{ check.resource }}
+ {% endif %} ++ home / + {{ database }} +
+ {{ super() }} +{% endblock %} + +{% block content %} + +This data as {% for name, url in renderers.items() %}{{ name }}{{ ", " if not loop.last }}{% endfor %}, CSV
+| {{ column }} | {% endfor %} +
|---|
| {{ td }} | + {% endfor %} +
0 results
+ {% endif %} +{% endif %} + +{% include "_codemirror_foot.html" %} + +{% endblock %} diff --git a/datasette/templates/row.html b/datasette/templates/row.html new file mode 100644 index 0000000..5823110 --- /dev/null +++ b/datasette/templates/row.html @@ -0,0 +1,49 @@ +{% extends "base.html" %} + +{% block title %}{{ database }}: {{ table }}{% endblock %} + +{% block extra_head %} +{{ super() }} + +{% endblock %} + +{% block body_class %}row db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %} + +{% block nav %} ++ accueil / + {{ database }} / + {{ table }} +
+ {{ super() }} +{% endblock %} + +{% block content %} +Télcharger ces données au format {% for name, url in renderers.items() %}{{ name }}{{ ", " if not loop.last }}{% endfor %}
+ +{% include custom_table_templates %} + +{% if foreign_key_tables %} ++ home +
+ {{ super() }} +{% endblock %} + +{% block content %} +{{ data_json }}
+
+{% endblock %}
diff --git a/datasette/templates/table.html b/datasette/templates/table.html
new file mode 100644
index 0000000..c2baa94
--- /dev/null
+++ b/datasette/templates/table.html
@@ -0,0 +1,216 @@
+{% extends "base.html" %}
+
+{% block title %}{{ database }}: {{ table }}: {% if filtered_table_rows_count or filtered_table_rows_count == 0 %}{{ "{:,}".format(filtered_table_rows_count) }} ligne{% if filtered_table_rows_count == 1 %}{% else %}s{% endif %}{% endif %}
+ {% if human_description_en %}où {{ human_description_en }}{% endif %}{% endblock %}
+
+{% block extra_head %}
+{{ super() }}
+
+
+{% endblock %}
+
+
+{% block body_class %}table db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %}
+
+{% block nav %}
+ + accueil / + {{ database }} +
+ {{ super() }} +{% endblock %} + +{% block content %} +{{ extra_where.text }} [supprimer]Télécharger ces données au format Excel ou CSV{% if filtered_table_rows_count > 50000 %} (50 000 premières lignes){% endif %}. + +{% if query.sql and allow_execute_sql %} + - ✎ Voir et éditer le SQL +{% endif %} +
+ + + +{% include custom_table_templates %} + +{% if next_url %} + +{% endif %} + + + + + +{% endblock %} diff --git a/scripts/start-datasette.sh b/scripts/start-datasette.sh new file mode 100755 index 0000000..8e1df31 --- /dev/null +++ b/scripts/start-datasette.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +echo "Get data..." +wget -nv https://www.data.gouv.fr/fr/datasets/r/c6b08d03-7aa4-4132-b5b2-fd76633feecc -O datasette/db.db + +datasette inspect datasette/*.db --inspect-file=datasette/inspect-data.json + +echo "Starting datasette..." +datasette datasette/ --port 9090 --cors | grep -v "/static/"