LSMS_Library 0.2.7__py3-none-any.whl → 0.2.10.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lsms_library/__init__.py +8 -2
- lsms_library/countries/.dvc/.gitignore +3 -0
- lsms_library/countries/.dvc/config +13 -0
- lsms_library/countries/.dvc/plots/confusion.json +30 -0
- lsms_library/countries/.dvc/plots/default.json +29 -0
- lsms_library/countries/.dvc/plots/scatter.json +27 -0
- lsms_library/countries/.dvc/plots/smooth.json +39 -0
- lsms_library/countries/.dvc/s3_config +2 -0
- lsms_library/countries/.dvc/s3_reader_creds.gpg +0 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbh_ind_weighs.dta.dvc +5 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbhcfhh.dta.dvc +5 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbhcfind.dta.dvc +5 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbhhhpos.dta.dvc +5 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbhihh.dta.dvc +5 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbhiind.dta.dvc +5 -0
- lsms_library/countries/Bosnia-Herzegovina/2003/Data/cbhjhist.dta.dvc +5 -0
- lsms_library/countries/China/1995-97/_/data_info.yml +28 -0
- lsms_library/countries/China/_/data_scheme.yml +9 -0
- lsms_library/countries/India/1997-98/_/data_info.yml +29 -0
- lsms_library/countries/India/1997-98/_/testing.py +9 -0
- lsms_library/countries/India/_/data_scheme.yml +13 -0
- lsms_library/countries/Iraq/2006-07/_/data_info.yml +13 -0
- lsms_library/countries/Iraq/2012/_/data_info.yml +13 -0
- lsms_library/countries/Iraq/_/data_scheme.yml +8 -0
- lsms_library/countries/Kosovo/2000/_/data_info.yml +14 -0
- lsms_library/countries/Kosovo/_/data_scheme.yml +9 -0
- lsms_library/countries/Liberia/2018-19/_/data_info.yml +13 -0
- lsms_library/countries/Liberia/_/data_scheme.yml +8 -0
- lsms_library/countries/Nigeria/_/household_roster.py +0 -2
- lsms_library/countries/Serbia/2007/_/data_info.yml +13 -0
- lsms_library/countries/Serbia/_/data_scheme.yml +8 -0
- lsms_library/countries/Serbia and Montenegro/2002/_/data_info.yml +13 -0
- lsms_library/countries/Serbia and Montenegro/2003/_/data_info.yml +13 -0
- lsms_library/countries/Serbia and Montenegro/_/data_scheme.yml +8 -0
- lsms_library/countries/South Africa/1993/_/data_info.yml +34 -0
- lsms_library/countries/South Africa/_/data_scheme.yml +8 -0
- lsms_library/countries/Timor-Leste/2007-08/_/data_info.yml +13 -0
- lsms_library/countries/Timor-Leste/_/data_scheme.yml +8 -0
- lsms_library/countries/Togo/2018/_/data_info.yml +13 -0
- lsms_library/countries/Togo/_/data_scheme.yml +8 -0
- lsms_library/countries/Uganda/2005-06/_/data_info.yml +12 -1
- lsms_library/countries/Uganda/2009-10/_/data_info.yml +10 -0
- lsms_library/countries/Uganda/_/Makefile +2 -2
- lsms_library/countries/Uganda/_/data_scheme.yml +9 -0
- lsms_library/countries/Uganda/_/household_characteristics.py +2 -4
- lsms_library/countries/Uganda/_/unitlabels.csv +290 -0
- lsms_library/country.py +6 -7
- lsms_library/dvc_permissions.py +68 -0
- lsms_library/local_tools.py +3 -3
- lsms_library-0.2.10.dev0.dist-info/METADATA +290 -0
- {lsms_library-0.2.7.dist-info → lsms_library-0.2.10.dev0.dist-info}/RECORD +53 -14
- lsms_library/contributing.org +0 -290
- lsms_library-0.2.7.dist-info/METADATA +0 -138
- {lsms_library-0.2.7.dist-info → lsms_library-0.2.10.dev0.dist-info}/LICENSE.txt +0 -0
- {lsms_library-0.2.7.dist-info → lsms_library-0.2.10.dev0.dist-info}/WHEEL +0 -0
lsms_library/__init__.py
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
from . import country
|
|
2
2
|
from . country import Country, Wave
|
|
3
3
|
from . import local_tools as tools
|
|
4
|
-
#from . import countries
|
|
5
|
-
#from .countries import GhanaLSS
|
|
6
4
|
from .categorical_mapping import ai_agent
|
|
7
5
|
from . import transformations
|
|
6
|
+
from .dvc_permissions import authenticate
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
gpg_path = Path(__file__).resolve().parent / 'countries' / '.dvc'
|
|
10
|
+
creds_file = gpg_path / 's3_creds'
|
|
11
|
+
if not creds_file.exists():
|
|
12
|
+
authenticate()
|
|
13
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[core]
|
|
2
|
+
remote = ligonresearch_s3
|
|
3
|
+
autostage = true
|
|
4
|
+
[cache]
|
|
5
|
+
type = reflink
|
|
6
|
+
['remote "ligonresearch"']
|
|
7
|
+
url = gdrive://1oVOdo2-oeM_LYBSe1lKSr-pm08syczdu/LSMS
|
|
8
|
+
gdrive_use_service_account = true
|
|
9
|
+
gdrive_service_account_json_file_path = gdrive_creds.json
|
|
10
|
+
['remote "ligonresearch_s3"']
|
|
11
|
+
url = s3://dvcbucket0/LSMS
|
|
12
|
+
credentialpath = s3_creds
|
|
13
|
+
configpath = s3_config
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
|
|
3
|
+
"data": {
|
|
4
|
+
"values": "<DVC_METRIC_DATA>"
|
|
5
|
+
},
|
|
6
|
+
"title": "<DVC_METRIC_TITLE>",
|
|
7
|
+
"mark": "rect",
|
|
8
|
+
"encoding": {
|
|
9
|
+
"x": {
|
|
10
|
+
"field": "<DVC_METRIC_X>",
|
|
11
|
+
"type": "nominal",
|
|
12
|
+
"sort": "ascending",
|
|
13
|
+
"title": "<DVC_METRIC_X_LABEL>"
|
|
14
|
+
},
|
|
15
|
+
"y": {
|
|
16
|
+
"field": "<DVC_METRIC_Y>",
|
|
17
|
+
"type": "nominal",
|
|
18
|
+
"sort": "ascending",
|
|
19
|
+
"title": "<DVC_METRIC_Y_LABEL>"
|
|
20
|
+
},
|
|
21
|
+
"color": {
|
|
22
|
+
"aggregate": "count",
|
|
23
|
+
"type": "quantitative"
|
|
24
|
+
},
|
|
25
|
+
"facet": {
|
|
26
|
+
"field": "rev",
|
|
27
|
+
"type": "nominal"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
|
|
3
|
+
"data": {
|
|
4
|
+
"values": "<DVC_METRIC_DATA>"
|
|
5
|
+
},
|
|
6
|
+
"title": "<DVC_METRIC_TITLE>",
|
|
7
|
+
"mark": {
|
|
8
|
+
"type": "line"
|
|
9
|
+
},
|
|
10
|
+
"encoding": {
|
|
11
|
+
"x": {
|
|
12
|
+
"field": "<DVC_METRIC_X>",
|
|
13
|
+
"type": "quantitative",
|
|
14
|
+
"title": "<DVC_METRIC_X_LABEL>"
|
|
15
|
+
},
|
|
16
|
+
"y": {
|
|
17
|
+
"field": "<DVC_METRIC_Y>",
|
|
18
|
+
"type": "quantitative",
|
|
19
|
+
"title": "<DVC_METRIC_Y_LABEL>",
|
|
20
|
+
"scale": {
|
|
21
|
+
"zero": false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"color": {
|
|
25
|
+
"field": "rev",
|
|
26
|
+
"type": "nominal"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
|
|
3
|
+
"data": {
|
|
4
|
+
"values": "<DVC_METRIC_DATA>"
|
|
5
|
+
},
|
|
6
|
+
"title": "<DVC_METRIC_TITLE>",
|
|
7
|
+
"mark": "point",
|
|
8
|
+
"encoding": {
|
|
9
|
+
"x": {
|
|
10
|
+
"field": "<DVC_METRIC_X>",
|
|
11
|
+
"type": "quantitative",
|
|
12
|
+
"title": "<DVC_METRIC_X_LABEL>"
|
|
13
|
+
},
|
|
14
|
+
"y": {
|
|
15
|
+
"field": "<DVC_METRIC_Y>",
|
|
16
|
+
"type": "quantitative",
|
|
17
|
+
"title": "<DVC_METRIC_Y_LABEL>",
|
|
18
|
+
"scale": {
|
|
19
|
+
"zero": false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"color": {
|
|
23
|
+
"field": "rev",
|
|
24
|
+
"type": "nominal"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
|
|
3
|
+
"data": {
|
|
4
|
+
"values": "<DVC_METRIC_DATA>"
|
|
5
|
+
},
|
|
6
|
+
"title": "<DVC_METRIC_TITLE>",
|
|
7
|
+
"mark": {
|
|
8
|
+
"type": "line"
|
|
9
|
+
},
|
|
10
|
+
"encoding": {
|
|
11
|
+
"x": {
|
|
12
|
+
"field": "<DVC_METRIC_X>",
|
|
13
|
+
"type": "quantitative",
|
|
14
|
+
"title": "<DVC_METRIC_X_LABEL>"
|
|
15
|
+
},
|
|
16
|
+
"y": {
|
|
17
|
+
"field": "<DVC_METRIC_Y>",
|
|
18
|
+
"type": "quantitative",
|
|
19
|
+
"title": "<DVC_METRIC_Y_LABEL>",
|
|
20
|
+
"scale": {
|
|
21
|
+
"zero": false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"color": {
|
|
25
|
+
"field": "rev",
|
|
26
|
+
"type": "nominal"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"transform": [
|
|
30
|
+
{
|
|
31
|
+
"loess": "<DVC_METRIC_Y>",
|
|
32
|
+
"on": "<DVC_METRIC_X>",
|
|
33
|
+
"groupby": [
|
|
34
|
+
"rev"
|
|
35
|
+
],
|
|
36
|
+
"bandwidth": 0.3
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Country: China
|
|
2
|
+
Wave: 1995-97
|
|
3
|
+
|
|
4
|
+
household_roster:
|
|
5
|
+
file:
|
|
6
|
+
- ../Data/S01A2.DTA
|
|
7
|
+
idxvars:
|
|
8
|
+
i: hid
|
|
9
|
+
pid: pid
|
|
10
|
+
myvars:
|
|
11
|
+
Sex:
|
|
12
|
+
- s01a202
|
|
13
|
+
- mapping:
|
|
14
|
+
1: Male
|
|
15
|
+
2: Female
|
|
16
|
+
Relation:
|
|
17
|
+
- s01a203
|
|
18
|
+
- mapping:
|
|
19
|
+
1: Head
|
|
20
|
+
2: Spouse
|
|
21
|
+
3: Child
|
|
22
|
+
4: Grandchild
|
|
23
|
+
5: Parent
|
|
24
|
+
6: Sibling
|
|
25
|
+
7: Son/Daughter-in-law
|
|
26
|
+
8: Other relative
|
|
27
|
+
9: Non-relative
|
|
28
|
+
Age: s01a208
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Country: India
|
|
2
|
+
Wave: 1997-98
|
|
3
|
+
|
|
4
|
+
cluster_features:
|
|
5
|
+
|
|
6
|
+
household_roster:
|
|
7
|
+
file:
|
|
8
|
+
- ../Data/SECT01A.DTA
|
|
9
|
+
idxvars:
|
|
10
|
+
i: hh
|
|
11
|
+
pid: idcode
|
|
12
|
+
myvars:
|
|
13
|
+
Sex: v01a02
|
|
14
|
+
Age: v01a04
|
|
15
|
+
Relation: v01a03
|
|
16
|
+
Highest_education: v01a05
|
|
17
|
+
employment:
|
|
18
|
+
file:
|
|
19
|
+
- ../Data/SECT02AD.DTA
|
|
20
|
+
idxvars:
|
|
21
|
+
i: hh
|
|
22
|
+
pid: idcode
|
|
23
|
+
myvars:
|
|
24
|
+
Cash_per_day: v02b02
|
|
25
|
+
Rural: v02a05b
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Country: South Africa
|
|
2
|
+
Wave: 1993
|
|
3
|
+
|
|
4
|
+
household_roster:
|
|
5
|
+
file:
|
|
6
|
+
- ../Data/M8_HROST.dta
|
|
7
|
+
idxvars:
|
|
8
|
+
i: hhid
|
|
9
|
+
pid: pcode
|
|
10
|
+
myvars:
|
|
11
|
+
Sex: gender_c
|
|
12
|
+
Age: age
|
|
13
|
+
Relation:
|
|
14
|
+
- rel_head
|
|
15
|
+
- mapping:
|
|
16
|
+
1: "Resident Head"
|
|
17
|
+
2: "Absent Head"
|
|
18
|
+
3: "Wife or husband or partner"
|
|
19
|
+
4: "Son or daughter"
|
|
20
|
+
5: "Father or mother"
|
|
21
|
+
6: "Grandchild"
|
|
22
|
+
7: "Grandparent"
|
|
23
|
+
8: "Mother- or father-in-law"
|
|
24
|
+
9: "Son- or daughter-in-law"
|
|
25
|
+
10: "Brother- or sister-in-law"
|
|
26
|
+
11: "Aunt or uncle"
|
|
27
|
+
12: "Sister or brother"
|
|
28
|
+
13: "Niece or nephew"
|
|
29
|
+
14: "Cousin"
|
|
30
|
+
15: "Great-grandparent"
|
|
31
|
+
16: "Household help (or relative of)"
|
|
32
|
+
17: "Lodger or relative of lodgers"
|
|
33
|
+
18: "Other family"
|
|
34
|
+
19: "Other non-family"
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
Country: Uganda
|
|
2
2
|
Wave: 2005-06
|
|
3
3
|
|
|
4
|
+
household_roster:
|
|
5
|
+
file:
|
|
6
|
+
- ../Data/GSEC2.dta
|
|
7
|
+
idxvars:
|
|
8
|
+
i: HHID
|
|
9
|
+
pid: PID
|
|
10
|
+
myvars:
|
|
11
|
+
Sex: h2q4
|
|
12
|
+
Relation: h2q5
|
|
13
|
+
Age: h2q9
|
|
14
|
+
|
|
4
15
|
people_last7days:
|
|
5
16
|
file: GSEC14.dta
|
|
6
17
|
idxvars:
|
|
@@ -29,6 +40,6 @@ cluster_features:
|
|
|
29
40
|
District: h1aq1
|
|
30
41
|
Rural:
|
|
31
42
|
- urban
|
|
32
|
-
- #Value mapping dictionary
|
|
43
|
+
- # Value mapping dictionary
|
|
33
44
|
urban: Urban
|
|
34
45
|
0: Rural
|
|
@@ -28,7 +28,7 @@ interview_date_parquet := $(interview_date:.py=.parquet)
|
|
|
28
28
|
enterprise_income = $(shell find $(rounds) -name enterprise_income.py)
|
|
29
29
|
enterprise_income_parquet := $(enterprise_income:.py=.parquet)
|
|
30
30
|
|
|
31
|
-
../var/enterprise_income.parquet: enterprise_income.py $(enterprise_income_parquet)
|
|
31
|
+
../var/enterprise_income.parquet: enterprise_income.py $(enterprise_income_parquet) ../var/other_features.parquet
|
|
32
32
|
python enterprise_income.py
|
|
33
33
|
|
|
34
34
|
assets = $(shell find $(rounds) -name assets.py)
|
|
@@ -40,7 +40,7 @@ assets_parquet := $(assets:.py=.parquet)
|
|
|
40
40
|
earnings = $(shell find $(rounds) -name earnings.py)
|
|
41
41
|
earnings_parquet := $(earnings:.py=.parquet)
|
|
42
42
|
|
|
43
|
-
../var/earnings.parquet: earnings.py $(earnings_parquet)
|
|
43
|
+
../var/earnings.parquet: earnings.py $(earnings_parquet) ../var/other_features.parquet
|
|
44
44
|
python earnings.py
|
|
45
45
|
|
|
46
46
|
shocks = $(shell find $(rounds) -name shocks.py)
|
|
@@ -10,6 +10,12 @@ Data Scheme:
|
|
|
10
10
|
|
|
11
11
|
cluster_features:
|
|
12
12
|
index: (i,t,v)
|
|
13
|
+
|
|
14
|
+
household_roster:
|
|
15
|
+
index: (i, pid, t)
|
|
16
|
+
Sex: str
|
|
17
|
+
Age: int
|
|
18
|
+
Relation: str
|
|
13
19
|
|
|
14
20
|
shocks: # USE_MAKEFILE
|
|
15
21
|
earnings: # USE_MAKEFILE
|
|
@@ -21,3 +27,6 @@ Data Scheme:
|
|
|
21
27
|
food_expenditures: # USE_MAKEFILE
|
|
22
28
|
food_prices:
|
|
23
29
|
panel_ids:
|
|
30
|
+
income:
|
|
31
|
+
enterprise_income:
|
|
32
|
+
other_features:
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
from lsms_library.local_tools import to_parquet
|
|
3
|
-
from lsms_library.local_tools import get_dataframe
|
|
4
2
|
"""
|
|
5
3
|
Concatenate data on other household features across rounds.
|
|
6
4
|
"""
|
|
7
|
-
|
|
5
|
+
import json
|
|
8
6
|
import pandas as pd
|
|
7
|
+
from lsms_library.local_tools import to_parquet, get_dataframe
|
|
9
8
|
from uganda import Waves, id_walk
|
|
10
|
-
import json
|
|
11
9
|
|
|
12
10
|
x = {}
|
|
13
11
|
|