Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Validata
validata-ui
Commits
6fd32a87
Commit
6fd32a87
authored
Sep 27, 2018
by
Pierre Dittgen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom_checks -> goodtables_checks, rename validate.py
parent
4a8efa2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
validata_ui_next/__init__.py
validata_ui_next/__init__.py
+6
-6
validata_ui_next/validate_helper.py
validata_ui_next/validate_helper.py
+6
-6
validata_ui_next/views.py
validata_ui_next/views.py
+1
-2
No files found.
validata_ui_next/__init__.py
View file @
6fd32a87
...
...
@@ -3,13 +3,13 @@ from pathlib import Path
from
flask
import
Flask
from
validata_ui_next.validate
import
ValidatorHelper
from
validata_ui_next.validate
_helper
import
ValidatorHelper
# Schemas settings
schemas_config
=
{
"scdl-adresses"
:
{
"schema_json_url"
:
"https://git.opendatafrance.net/scdl/adresses/raw/master/schema-scdl-adresses.json"
,
"
custom
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/adresses/raw/master/goodtables-checks.json"
,
"
goodtables
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/adresses/raw/master/goodtables-checks.json"
,
"title"
:
"Adresses locales"
,
"description"
:
"Liste des adresses locales d'une collectivité"
,
"specurl"
:
"http://www.opendatafrance.net/SCDL_Adresses_Locales"
,
...
...
@@ -28,7 +28,7 @@ schemas_config = {
},
"scdl-deliberations"
:
{
"schema_json_url"
:
"https://git.opendatafrance.net/scdl/deliberations/raw/master/schema.json"
,
"
custom
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/deliberations/raw/master/goodtables-checks.json"
,
"
goodtables
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/deliberations/raw/master/goodtables-checks.json"
,
"title"
:
"Délibérations"
,
"description"
:
"Liste des délibérations adoptées par une assemblée locale"
,
"specurl"
:
"http://www.opendatafrance.net/SCDL_Deliberations"
,
...
...
@@ -47,7 +47,7 @@ schemas_config = {
},
"scdl-marches-publics"
:
{
"schema_json_url"
:
"https://git.opendatafrance.net/scdl/marches-publics/raw/v1.2/schema.json"
,
"
custom
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/marches-publics/raw/v1.2/goodtables-checks.json"
,
"
goodtables
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/marches-publics/raw/v1.2/goodtables-checks.json"
,
"title"
:
"Marchés publics"
,
"description"
:
"Liste des marchés publics attribués par une collectivité"
,
"specurl"
:
"http://www.opendatafrance.net/SCDL_Marches_Publics"
,
...
...
@@ -65,7 +65,7 @@ schemas_config = {
},
"scdl-prenoms"
:
{
"schema_json_url"
:
"https://github.com/Jailbreak-Paris/liste-prenoms-nouveaux-nes/raw/v1.1.3/prenom-schema.json"
,
"
custom
_checks_json_url"
:
"https://github.com/Jailbreak-Paris/liste-prenoms-nouveaux-nes/raw/v1.1.3/goodtables-checks.json"
,
"
goodtables
_checks_json_url"
:
"https://github.com/Jailbreak-Paris/liste-prenoms-nouveaux-nes/raw/v1.1.3/goodtables-checks.json"
,
"title"
:
"Prénoms des nouveaux-nés"
,
"description"
:
"Liste des prénoms des nouveaux-nés déclarés à l'état-civil"
,
"specurl"
:
"https://docs.google.com/document/d/1Vk0kpBw3MIocai9JqovLK2HxcUA_3QHnZicqxuOpcQ8/edit?usp=sharing"
,
...
...
@@ -83,7 +83,7 @@ schemas_config = {
},
"scdl-subventions"
:
{
"schema_json_url"
:
"https://git.opendatafrance.net/scdl/subventions/raw/master/schema.json"
,
"
custom
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/subventions/raw/master/goodtables-checks.json"
,
"
goodtables
_checks_json_url"
:
"https://git.opendatafrance.net/scdl/subventions/raw/master/goodtables-checks.json"
,
"title"
:
"Subventions"
,
"description"
:
"Liste des subventions publiques attribuées par une collectivité"
,
"specurl"
:
"http://www.opendatafrance.net/SCDL_Subventions"
,
...
...
validata_ui_next/validate.py
→
validata_ui_next/validate
_helper
.py
View file @
6fd32a87
...
...
@@ -36,9 +36,9 @@ class ValidatorHelper:
'{}_schema.json'
.
format
(
code
))
# custom_checks
if
'
custom
_checks_json_url'
in
schema
:
schema
[
'
custom
_checks'
]
=
cls
.
json_download
(
schema
[
'
custom
_checks_json_url'
],
'{}_custom
_checks.json'
.
format
(
code
))
if
'
goodtables
_checks_json_url'
in
schema
:
schema
[
'
goodtables
_checks'
]
=
cls
.
json_download
(
schema
[
'
goodtables
_checks_json_url'
],
'{}_goodtables
_checks.json'
.
format
(
code
))
cls
.
schema_dict
[
code
]
=
schema
@
classmethod
...
...
@@ -74,7 +74,7 @@ class ValidatorHelper:
# All keys but schema* and custom_checks*
d2
=
{
k
:
v
for
k
,
v
in
cls
.
schema_dict
[
schema_code
].
items
()
if
not
k
.
startswith
(
'schema'
)
and
not
k
.
startswith
(
'
custom
_checks'
)}
if
not
k
.
startswith
(
'schema'
)
and
not
k
.
startswith
(
'
goodtables
_checks'
)}
return
{
**
d1
,
'code'
:
schema_code
,
**
d2
}
...
...
@@ -93,8 +93,8 @@ class ValidatorHelper:
# Build checks configuration
checks
=
[
'structure'
,
'schema'
]
pre_checks_conf
=
None
if
'
custom
_checks'
in
sc_info
:
c_checks
=
sc_info
[
'
custom
_checks'
]
if
'
goodtables
_checks'
in
sc_info
:
c_checks
=
sc_info
[
'
goodtables
_checks'
]
if
'custom_checks'
in
c_checks
:
for
check_conf
in
c_checks
[
'custom_checks'
]:
checks
.
append
({
check_conf
[
'name'
]:
check_conf
[
'params'
]})
...
...
validata_ui_next/views.py
View file @
6fd32a87
...
...
@@ -9,7 +9,7 @@ from pathlib import Path
from
validata_ui_next
import
app
from
validata_ui_next.util
import
flash_error
,
flash_info
,
flash_success
,
flash_warning
from
validata_ui_next.validate
import
ValidatorHelper
from
validata_ui_next.validate
_helper
import
ValidatorHelper
from
flask
import
Flask
,
jsonify
,
redirect
,
render_template
,
request
,
url_for
import
tabulator
...
...
@@ -18,7 +18,6 @@ import tabulator
def
compute_source_preview
(
source
,
max_rows
=
5
):
""" Computes table preview """
header
=
None
nb_rows
=
0
rows
=
[]
with
tabulator
.
Stream
(
source
)
as
stream
:
for
row
in
stream
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment