Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions import-automation/executor/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Requirements for Python scripts in this repo that have automation enabled!

absl-py
anyascii
arcgis2geojson
beautifulsoup4
chardet
Expand Down
23 changes: 23 additions & 0 deletions scripts/un/codes/codelist_pvmap_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Template for converting UN codelist files to PVMap for statvar processor.
# The pvmap will have columns to generate statvar constraint property:values
# and names.
# The pvmap will also have columns to generate schema MCF with a tMCF.
{
'key': '{CONCEPT}:{CODE}',
'UnConceptProp': 'Property',
'UnConcept': '"{CONCEPT}"',
'UnCodeProp': 'UnCode',
'UnCode': '"{CODE}"',
'ConstraintProp': '{PROPERTY}',
'ConstraintPropValue': 'to_dcid(NAMESPACE+"_"+CONCEPT+"-"+CODE)',
'ConstraintPropType': 'TypeOf',
'ConstraintPropEnum': (
'str(ConstraintProp[0].upper() + ConstraintProp[1:]+"Enum")'
),
'NameProp': 'ValueName_{CONCEPT}',
'ConstraintValueName': '"{NAME_EN}"',
'DescriptionProp': 'ValueDesc_{CONCEPT}',
'ConstraintValueDescription': '{DESCRIPTION}',
'End': 'End',
'Dummy': '.',
}
17 changes: 17 additions & 0 deletions scripts/un/codes/codelist_schema.tmcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Node: E:UN->E0
typeOf: C:UN->ConstraintPropEnum
dcid: C:UN->ConstraintPropValue
unCode: C:UN->UnCode
name: C:UN->ConstraintValueName
description: C:UN->ConstraintValueDescription

Node: E:UN->E1
typeOf: C:UN->UnConceptProp
dcid: C:UN->ConstraintProp
unConcept: C:UN->UnConcept
rangeIncludes: C:UN->ConstraintPropEnum

Node: E:UN->E2
typeOf: schema:Class
dcid: C:UN->ConstraintPropEnum
subClassOf: schema:Enumeration
22 changes: 22 additions & 0 deletions scripts/un/codes/dsd_property_pvmap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Template for converting UN DSD file with column metadata
# to PVMap for statvar processor.
# The pvmap will have columns to generate statvar constraint
# propoerties with names.
# The pvmap will also have columns to generate schema MCF with a tMCF.
{
'key': '{CONCEPT}',
'UnCodeProp': 'UnConceptCode',
'UnCode': '"{CONCEPT}"',
'ConceptProp': 'UnConceptProperty',
'ConstraintProp': '{PROPERTY}',
'ConstraintPropType': 'Property',
'ConstraintPropEnum': 'str(ConstraintProp[0].upper() + ConstraintProp[1:]+"Enum")',
'ConceptNameProp': 'PropertyName_{CONCEPT}',
'ConceptName': '"{NAME_EN}"',
'DescriptionProp': 'PropertyDesc_{CONCEPT}',
'ConceptDescription': '{DESCRIPTION}',
# Eond of line prop:value when description is empty.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick ':s/Eond/End' ?

'#End': 'End',
'Dummy': '.',
}

39 changes: 39 additions & 0 deletions scripts/un/codes/dsd_property_pvmap_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Template for converting UN DSD file with column metadata
# to PVMap for statvar processor.
# The pvmap will have columns to generate statvar constraint
# propoerties with names.
# The pvmap will also have columns to generate schema MCF with a tMCF.
{
'key':
'{CONCEPT}',
'UnCodeProp':
'UnConceptCode',
'UnCode':
'"{CONCEPT}"',
'ConceptProp':
'UnConceptProperty',
'ConstraintProp':
'{PROPERTY}',
'ConstraintPropType':
'Property',
'ConstraintPropEnum':
'str(ConstraintProp[0].upper() + ConstraintProp[1:]+"Enum")',
'ConceptNameProp':
'PropertyName_{CONCEPT}',
'ConceptName':
'"{NAME_EN}"',
'DescriptionProp':
'ValueDesc_{CONCEPT}',
'ConceptDescription':
'quote(anyascii(DESCRIPTION))',
# Initialize ValueName for specific codes for a concept to empty string
'CodeNameProp':
'ValueName_{CONCEPT}',
'DefaultName':
'""',
# End of line prop:value when description is empty.
'#End':
'End',
'Dummy':
'.',
}
15 changes: 15 additions & 0 deletions scripts/un/codes/dsd_property_schema.tmcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Node: E:DSD->E0
dcid: C:DSD->ConstraintProp
typeOf: C:DSD->ConstraintPropType
name: C:DSD->ConstraintProp
domainIncludes: dcid:UNSeries
alternateName: C:DSD->ConceptName
description: C:DSD->ConceptDescription
rangeIncludes: C:DSD->ConstraintPropEnum

Node: E:DSD->E1
dcid: C:DSD->ConstraintPropEnum
typeOf: schema:Class
subClassOf: schema:Enumeration
description: C:DSD->ConceptDescription

Loading
Loading