-
Notifications
You must be signed in to change notification settings - Fork 149
Script to convert UN codelist to pvmap #2092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ajaits
wants to merge
17
commits into
datacommonsorg:master
Choose a base branch
from
ajaits:pr-refactor-codelist-map
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c641f9f
Support 0 eval results
ajaits 07feb6e
Merge branch 'master' of https://github.com/datacommonsorg/data
ajaits f30e895
Use environment variable for DC API root
ajaits 2a0e93d
cleanup dc_api_root configs
ajaits dfad750
lint fix
ajaits 65527d1
Merge branch 'master' of https://github.com/datacommonsorg/data
ajaits 9951b78
Add script for UN20 imports
ajaits 4e30515
Add script for generating codelist mapping
ajaits 3cae0f3
add dcid generator to flags
ajaits 258bbde
script to generate statvar names
ajaits c1c2a67
convert large ints to float
ajaits 0d87b47
make max_int configurable
ajaits eaecf24
support imports form other folders
ajaits 87b5b93
add script to generate statvar groups
ajaits 837b81b
add linkedMemberof
ajaits 4498d00
Refactor generate_codelist_map and add unit test suite
ajaits 69aa397
Fix clean_value_str regex to properly escape brackets and preserve st…
ajaits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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': '.', | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
| '#End': 'End', | ||
| 'Dummy': '.', | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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': | ||
| '.', | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick ':s/Eond/End' ?