warn-transformer 1.3.239__py3-none-any.whl → 1.3.241__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.
Potentially problematic release.
This version of warn-transformer might be problematic. Click here for more details.
- warn_transformer/transformers/ca.py +4 -0
- warn_transformer/transformers/ny.py +19 -45
- {warn_transformer-1.3.239.dist-info → warn_transformer-1.3.241.dist-info}/METADATA +1 -1
- {warn_transformer-1.3.239.dist-info → warn_transformer-1.3.241.dist-info}/RECORD +8 -8
- {warn_transformer-1.3.239.dist-info → warn_transformer-1.3.241.dist-info}/WHEEL +0 -0
- {warn_transformer-1.3.239.dist-info → warn_transformer-1.3.241.dist-info}/entry_points.txt +0 -0
- {warn_transformer-1.3.239.dist-info → warn_transformer-1.3.241.dist-info}/licenses/LICENSE +0 -0
- {warn_transformer-1.3.239.dist-info → warn_transformer-1.3.241.dist-info}/top_level.txt +0 -0
|
@@ -22,6 +22,10 @@ class Transformer(BaseTransformer):
|
|
|
22
22
|
# This Tesla layoff number large but correct
|
|
23
23
|
# https://www.cnbc.com/2020/05/13/coronavirus-latest-updates.html
|
|
24
24
|
11083: 11083,
|
|
25
|
+
# This large number is for a Tend layofff. Stucka found a tweet
|
|
26
|
+
# suggesting about half the number are losing jobs in California.
|
|
27
|
+
# Number thus unclear. Records request sent 5/30/2025.
|
|
28
|
+
16132: None,
|
|
25
29
|
}
|
|
26
30
|
date_corrections = {
|
|
27
31
|
"09/04/2008": datetime(2018, 9, 4),
|
|
@@ -9,11 +9,13 @@ class Transformer(BaseTransformer):
|
|
|
9
9
|
|
|
10
10
|
postal_code = "NY"
|
|
11
11
|
fields = dict(
|
|
12
|
-
company=lambda row: row["
|
|
13
|
-
location="
|
|
14
|
-
notice_date=lambda row: row["
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
company=lambda row: row["Business Legal Name"] or row["Company"] or None,
|
|
13
|
+
location="Impacted Site County",
|
|
14
|
+
notice_date=lambda row: row["Date of WARN Notice "]
|
|
15
|
+
or row["Date of WARN Notice"]
|
|
16
|
+
or None,
|
|
17
|
+
effective_date="Date Layoff/Closure Starts",
|
|
18
|
+
jobs="Number of Affected Workers ",
|
|
17
19
|
)
|
|
18
20
|
date_format = ("%Y-%m-%d %H:%M:%S", "%m/%d/%Y", "%Y-%m-%d")
|
|
19
21
|
date_corrections = {
|
|
@@ -28,40 +30,6 @@ class Transformer(BaseTransformer):
|
|
|
28
30
|
"2/12/24": datetime(2024, 12, 12), # Note date shift
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
def prep_row_list(
|
|
32
|
-
self, row_list: typing.List[typing.Dict]
|
|
33
|
-
) -> typing.List[typing.Dict]:
|
|
34
|
-
"""Make necessary transformations to the raw row list prior to transformation.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
row_list (list): A list of raw rows of data from the source.
|
|
38
|
-
|
|
39
|
-
Returns: The row list minus empty records
|
|
40
|
-
"""
|
|
41
|
-
# Do the standard stuff
|
|
42
|
-
row_list = super().prep_row_list(row_list)
|
|
43
|
-
|
|
44
|
-
# Split records from scrape from those in the archival set
|
|
45
|
-
scraped_list = [r for r in row_list if r["notice_url"]]
|
|
46
|
-
archival_list = [r for r in row_list if not r["notice_url"]]
|
|
47
|
-
assert len(scraped_list) + len(archival_list) == len(row_list)
|
|
48
|
-
|
|
49
|
-
# Remove records from the scrape that are covered by the more detailed archival file
|
|
50
|
-
cutoff = datetime(2021, 6, 30)
|
|
51
|
-
keep_list = []
|
|
52
|
-
for r in scraped_list:
|
|
53
|
-
dt_str = self.transform_date(r["notice_dated"])
|
|
54
|
-
assert isinstance(dt_str, str)
|
|
55
|
-
dt = datetime.strptime(dt_str, "%Y-%m-%d")
|
|
56
|
-
if dt > cutoff:
|
|
57
|
-
keep_list.append(r)
|
|
58
|
-
|
|
59
|
-
# Add them back together
|
|
60
|
-
prepped_list = keep_list + archival_list
|
|
61
|
-
|
|
62
|
-
# Return it
|
|
63
|
-
return prepped_list
|
|
64
|
-
|
|
65
33
|
def transform_date(self, value: str) -> typing.Optional[str]:
|
|
66
34
|
"""Transform a raw date string into a date object.
|
|
67
35
|
|
|
@@ -83,10 +51,13 @@ class Transformer(BaseTransformer):
|
|
|
83
51
|
|
|
84
52
|
Returns: A boolean or null
|
|
85
53
|
"""
|
|
86
|
-
value = row["
|
|
87
|
-
if "
|
|
54
|
+
value = row["Permanent or Temporary Layoff?"].lower()
|
|
55
|
+
if "permanent" in value:
|
|
56
|
+
return False
|
|
57
|
+
elif "temporary" in value:
|
|
58
|
+
return True
|
|
59
|
+
else:
|
|
88
60
|
return None
|
|
89
|
-
return "temp" in value or None
|
|
90
61
|
|
|
91
62
|
def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
|
|
92
63
|
"""Determine whether a row is a closure or not.
|
|
@@ -96,7 +67,10 @@ class Transformer(BaseTransformer):
|
|
|
96
67
|
|
|
97
68
|
Returns: A boolean or null
|
|
98
69
|
"""
|
|
99
|
-
value = row["
|
|
100
|
-
if "
|
|
70
|
+
value = row["Layoff or Closure?"].lower()
|
|
71
|
+
if "closure" in value:
|
|
72
|
+
return True
|
|
73
|
+
elif "layoff" in value:
|
|
74
|
+
return False
|
|
75
|
+
else:
|
|
101
76
|
return None
|
|
102
|
-
return "clos" in value or None
|
|
@@ -9,7 +9,7 @@ warn_transformer/transformers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
9
9
|
warn_transformer/transformers/ak.py,sha256=BVzKzIOpZ3fzSj6EjlqyG3z4D5LBVLwP6-gYRCfSVO4,2441
|
|
10
10
|
warn_transformer/transformers/al.py,sha256=OydLDvZMAJTDBTr-xfCW8sRlOYqgCGGmXIA415ppBV0,814
|
|
11
11
|
warn_transformer/transformers/az.py,sha256=cB1fTlpBH-meU4NO4hS5-pO2_oCSc6q6Ip7eeQQEUJo,398
|
|
12
|
-
warn_transformer/transformers/ca.py,sha256=
|
|
12
|
+
warn_transformer/transformers/ca.py,sha256=UGs9lbslvtJxT-3WylvZSFu7_BKlUgjNKDBZApOhc0Q,1764
|
|
13
13
|
warn_transformer/transformers/co.py,sha256=Nn3v5hu8UcLp_pWIAupn3UeBe0pxn1UsHAXIVEEssOM,5313
|
|
14
14
|
warn_transformer/transformers/ct.py,sha256=tREKFro2HYl4xRJsN0eokYIajP6fMC5dr8yClyUv-wQ,4251
|
|
15
15
|
warn_transformer/transformers/dc.py,sha256=1ahvBwVUl-h4ON3BACR_Y2SjQf4ifmWvKYelYriY4pI,2187
|
|
@@ -32,7 +32,7 @@ warn_transformer/transformers/mt.py,sha256=QSSlo3BFjJklcE4e6tUu_vJa1H887XeDXdxsC
|
|
|
32
32
|
warn_transformer/transformers/ne.py,sha256=6Hf5zsiCaAVXERA1uX4IxuOjLnkfRNv-0_pBjwPmdkU,939
|
|
33
33
|
warn_transformer/transformers/nj.py,sha256=1Tp2hyyVO9jMINwCsh3JPa1P6cy2OwH4UpRnygEJrH4,8258
|
|
34
34
|
warn_transformer/transformers/nm.py,sha256=ttRSlWMCVk1Ur-bGKjJjf7S3yhgSYeEjQ2y54KoBO_c,579
|
|
35
|
-
warn_transformer/transformers/ny.py,sha256=
|
|
35
|
+
warn_transformer/transformers/ny.py,sha256=HQ59adpj_AQemJD3NKIDa-SWr1PgzewrEjJiqSm8l9A,2428
|
|
36
36
|
warn_transformer/transformers/oh.py,sha256=-Xmun7_CVmOSqCWxipFV4EHpINBCJAVc3yr6ZaV9Nv8,3217
|
|
37
37
|
warn_transformer/transformers/ok.py,sha256=Ek3po8qTAmBtMLoHRJGMV5iJasZ_l_-0HH510kefUO4,399
|
|
38
38
|
warn_transformer/transformers/or.py,sha256=YcSBOndSS7sd04LICuVwmMwY4al2bBOCGxowXXj34vE,1433
|
|
@@ -46,9 +46,9 @@ warn_transformer/transformers/va.py,sha256=vxlkvIgrphAUqqCKi_6xZ8raOEhbUpskBukKb
|
|
|
46
46
|
warn_transformer/transformers/vt.py,sha256=5J9p7yexXmn4K3Pe0xIkPa9fR10DpZ2DSzvjkrDbCZs,452
|
|
47
47
|
warn_transformer/transformers/wa.py,sha256=0addhlk4jBAfScVngCq8VUJvd-Bc8e1winPn8Lu2DZo,1111
|
|
48
48
|
warn_transformer/transformers/wi.py,sha256=sM5KFkACDQ6dqiQ666wvZ8gJe47ywFVmM1hFbw8Io64,3019
|
|
49
|
-
warn_transformer-1.3.
|
|
50
|
-
warn_transformer-1.3.
|
|
51
|
-
warn_transformer-1.3.
|
|
52
|
-
warn_transformer-1.3.
|
|
53
|
-
warn_transformer-1.3.
|
|
54
|
-
warn_transformer-1.3.
|
|
49
|
+
warn_transformer-1.3.241.dist-info/licenses/LICENSE,sha256=ZV-QHyqPwyMuwuj0lI05JeSjV1NyzVEk8Yeu7FPtYS0,585
|
|
50
|
+
warn_transformer-1.3.241.dist-info/METADATA,sha256=vVIxyilA0doBfdNbu7EqN0Clh_28jyGm_SQghY_JRLU,1740
|
|
51
|
+
warn_transformer-1.3.241.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
52
|
+
warn_transformer-1.3.241.dist-info/entry_points.txt,sha256=MvWNvQnZTu5Fbpd7JMN-KGPeklT6f5v6Hx39uqnBl28,62
|
|
53
|
+
warn_transformer-1.3.241.dist-info/top_level.txt,sha256=8nZpmzmOcqSnismvY34muSX8MvaZM6aEfLldl-wp0fQ,17
|
|
54
|
+
warn_transformer-1.3.241.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|