Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
ATECO classifications for organizations are imported from ATOKA
· de7c9ec2
guglielmo
authored
Feb 18, 2019
Bump version: 1.1.7 → 1.1.8
de7c9ec2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
de7c9ec2
...
...
@@ -60,3 +60,6 @@ resources/data/role_types_atoka_opdm.csv
docker-compose.*.yml
/resources/data/cf_partecipate_mef.csv
/resources/data/cf_partecipate_opdm.csv
/resources/data/partecipazioni_mef_amm_centrali.csv
/resources/data/partecipazioni_mef.csv
/resources/data/partecipazioni_mef_amm_centrali_not_in_opdm.csv
CHANGELOG.md
View file @
de7c9ec2
...
...
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/en/1.0.0/
)
and this project adheres to
[
Semantic Versioning
](
http://semver.org/spec/v2.0.0.html
)
.
## [1.1.8]
### Add
-
ATECO classifications for organizations are imported from ATOKA
## [1.1.7]
### Add
...
...
project/__init__.py
View file @
de7c9ec2
...
...
@@ -3,4 +3,4 @@
Openpolis Data Manager service package (backend)
"""
__version__
=
'
1.1.
7
'
__version__
=
'
1.1.
8
'
project/atoka/etl/extractors.py
View file @
de7c9ec2
...
...
@@ -199,6 +199,7 @@ class AtokaOwnershipsExtractor(Extractor):
'
vat
'
:
r
[
'
base
'
].
get
(
'
vat
'
,
None
),
'
founded
'
:
r
[
'
base
'
].
get
(
'
founded
'
,
None
),
'
legal_form
'
:
[
x
[
'
name
'
]
for
x
in
r
[
'
base
'
][
'
legalForms
'
]
if
x
[
'
level
'
]
==
2
][
0
],
'
ateco
'
:
r
[
'
base
'
].
get
(
'
ateco
'
,
[])
}
for
r
in
owned_orgs
}
...
...
@@ -287,7 +288,7 @@ class AtokaOwnershipsExtractor(Extractor):
for
owned
in
owner
[
'
shares_owned
'
]:
owned_details
=
owned_orgs_dict
.
get
(
owned
[
'
atoka_id
'
],
None
)
if
owned_details
:
for
f
in
[
'
name
'
,
'
cciaa
'
,
'
rea
'
,
'
tax_id
'
,
'
vat
'
,
'
founded
'
,
'
legal_form
'
,
'
roles
'
]:
for
f
in
[
'
name
'
,
'
cciaa
'
,
'
rea
'
,
'
ateco
'
,
'
tax_id
'
,
'
vat
'
,
'
founded
'
,
'
legal_form
'
,
'
roles
'
]:
if
f
in
owned_details
:
owned
[
f
]
=
owned_details
[
f
]
...
...
project/atoka/etl/transformations.py
View file @
de7c9ec2
...
...
@@ -335,6 +335,13 @@ class AtokaOrganizationTransformation(Transformation):
"
scheme
"
:
"
VAT
"
,
"
identifier
"
:
i
[
"
vat
"
]
})
if
"
ateco
"
in
i
and
len
(
i
[
'
ateco
'
])
>
0
:
for
ateco_class
in
i
[
'
ateco
'
]:
o
[
"
classifications
"
].
append
({
"
scheme
"
:
"
ATOKA_ATECO
"
,
"
code
"
:
"
{0}-{1}
"
.
format
(
ateco_class
[
'
rootCode
'
],
ateco_class
[
'
code
'
]),
"
descr
"
:
ateco_class
[
'
description
'
]
})
if
"
other_atoka_ids
"
in
i
and
len
(
i
[
"
other_atoka_ids
"
]):
for
l
in
i
[
"
other_atoka_ids
"
]:
o
[
"
links
"
].
append
({
...
...
project/atoka/management/commands/import_atoka.py
View file @
de7c9ec2
...
...
@@ -33,6 +33,12 @@ class Command(LoggingBaseCommand):
default
=
0
,
help
=
"
Level of the public share, starting from public institution = 0
"
)
parser
.
add_argument
(
"
--tax-ids
"
,
nargs
=
'
*
'
,
metavar
=
'
TAX_ID
'
,
dest
=
"
tax_ids
"
,
help
=
"
Only consider these tax_ids (used for debugging)
"
,
)
parser
.
add_argument
(
"
--clear-cache
"
,
dest
=
"
clear_cache
"
,
...
...
@@ -46,6 +52,7 @@ class Command(LoggingBaseCommand):
self
.
batchsize
=
options
[
'
batchsize
'
]
self
.
datapath
=
options
[
'
datapath
'
]
self
.
shares_level
=
options
[
'
shares_level
'
]
self
.
tax_ids
=
options
.
get
(
'
tax_ids
'
)
self
.
clear_cache
=
options
[
'
clear_cache
'
]
self
.
logger
.
info
(
"
Start overall procedure
"
)
...
...
@@ -77,7 +84,7 @@ class Command(LoggingBaseCommand):
json_file
=
os
.
path
.
join
(
self
.
datapath
,
'
atoka.json
'
),
batchsize
=
self
.
batchsize
,
shares_level
=
self
.
shares_level
,
tax_ids
=
[
'
02438750586
'
,
'
00484960588
'
,
'
80003170661
'
]
tax_ids
=
self
.
tax_ids
)
def
transform_and_load_organizations
(
self
):
...
...
project/atoka/management/commands/script_compute_public_interest.py
View file @
de7c9ec2
# -*- coding: utf-8 -*-
from
django.db.models
import
Sum
from
models
import
Classification
,
Organization
from
popolo.
models
import
Classification
,
Organization
from
taskmanager.utils
import
LoggingBaseCommand
from
project.atoka.models
import
OrganizationEconomics
...
...
setup.cfg
View file @
de7c9ec2
[bumpversion]
current_version
= 1.1.
7
current_version
= 1.1.
8
commit
= True
tag
= True
tag_name
= v{new_version}
...
...