zombie-squirrel 0.8.3__py3-none-any.whl → 0.8.5__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.
- zombie_squirrel/__init__.py +1 -1
- zombie_squirrel/acorn_contents/asset_basics.py +12 -2
- zombie_squirrel/acorn_contents/raw_to_derived.py +7 -1
- zombie_squirrel/acorn_contents/source_data.py +7 -1
- zombie_squirrel/acorn_contents/unique_project_names.py +7 -2
- zombie_squirrel/acorn_contents/unique_subject_ids.py +7 -2
- zombie_squirrel/acorns.py +4 -2
- zombie_squirrel/sync.py +0 -6
- zombie_squirrel/utils.py +26 -0
- {zombie_squirrel-0.8.3.dist-info → zombie_squirrel-0.8.5.dist-info}/METADATA +2 -2
- zombie_squirrel-0.8.5.dist-info/RECORD +16 -0
- zombie_squirrel-0.8.3.dist-info/RECORD +0 -16
- {zombie_squirrel-0.8.3.dist-info → zombie_squirrel-0.8.5.dist-info}/WHEEL +0 -0
- {zombie_squirrel-0.8.3.dist-info → zombie_squirrel-0.8.5.dist-info}/licenses/LICENSE +0 -0
- {zombie_squirrel-0.8.3.dist-info → zombie_squirrel-0.8.5.dist-info}/top_level.txt +0 -0
zombie_squirrel/__init__.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Provides functions to fetch and cache project names, subject IDs, and asset
|
|
4
4
|
metadata from the AIND metadata database with support for multiple backends."""
|
|
5
5
|
|
|
6
|
-
__version__ = "0.8.
|
|
6
|
+
__version__ = "0.8.5"
|
|
7
7
|
|
|
8
8
|
from zombie_squirrel.acorn_contents.asset_basics import asset_basics # noqa: F401
|
|
9
9
|
from zombie_squirrel.acorn_contents.raw_to_derived import raw_to_derived # noqa: F401
|
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
|
6
6
|
from aind_data_access_api.document_db import MetadataDbClient
|
|
7
7
|
|
|
8
8
|
import zombie_squirrel.acorns as acorns
|
|
9
|
+
from zombie_squirrel.utils import setup_logging, SquirrelMessage
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["basics"])
|
|
@@ -43,7 +44,12 @@ def asset_basics(force_update: bool = False) -> pd.DataFrame:
|
|
|
43
44
|
)
|
|
44
45
|
|
|
45
46
|
if df.empty or force_update:
|
|
46
|
-
|
|
47
|
+
setup_logging()
|
|
48
|
+
logging.info(SquirrelMessage(
|
|
49
|
+
tree=acorns.TREE.__class__.__name__,
|
|
50
|
+
acorn=acorns.NAMES["basics"],
|
|
51
|
+
message="Updating cache"
|
|
52
|
+
).to_json())
|
|
47
53
|
df = pd.DataFrame(
|
|
48
54
|
columns=[
|
|
49
55
|
"_id",
|
|
@@ -83,7 +89,11 @@ def asset_basics(force_update: bool = False) -> pd.DataFrame:
|
|
|
83
89
|
BATCH_SIZE = 100
|
|
84
90
|
asset_records = []
|
|
85
91
|
for i in range(0, len(keep_ids), BATCH_SIZE):
|
|
86
|
-
logging.info(
|
|
92
|
+
logging.info(SquirrelMessage(
|
|
93
|
+
tree=acorns.TREE.__class__.__name__,
|
|
94
|
+
acorn=acorns.NAMES["basics"],
|
|
95
|
+
message=f"Fetching batch {i // BATCH_SIZE + 1}"
|
|
96
|
+
).to_json())
|
|
87
97
|
batch_ids = keep_ids[i: i + BATCH_SIZE]
|
|
88
98
|
batch_records = client.retrieve_docdb_records(
|
|
89
99
|
filter_query={"_id": {"$in": batch_ids}},
|
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
|
6
6
|
from aind_data_access_api.document_db import MetadataDbClient
|
|
7
7
|
|
|
8
8
|
import zombie_squirrel.acorns as acorns
|
|
9
|
+
from zombie_squirrel.utils import setup_logging, SquirrelMessage
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["r2d"])
|
|
@@ -28,7 +29,12 @@ def raw_to_derived(force_update: bool = False) -> pd.DataFrame:
|
|
|
28
29
|
)
|
|
29
30
|
|
|
30
31
|
if df.empty or force_update:
|
|
31
|
-
|
|
32
|
+
setup_logging()
|
|
33
|
+
logging.info(SquirrelMessage(
|
|
34
|
+
tree=acorns.TREE.__class__.__name__,
|
|
35
|
+
acorn=acorns.NAMES["r2d"],
|
|
36
|
+
message="Updating cache"
|
|
37
|
+
).to_json())
|
|
32
38
|
client = MetadataDbClient(
|
|
33
39
|
host=acorns.API_GATEWAY_HOST,
|
|
34
40
|
version="v2",
|
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
|
6
6
|
from aind_data_access_api.document_db import MetadataDbClient
|
|
7
7
|
|
|
8
8
|
import zombie_squirrel.acorns as acorns
|
|
9
|
+
from zombie_squirrel.utils import setup_logging, SquirrelMessage
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["d2r"])
|
|
@@ -28,7 +29,12 @@ def source_data(force_update: bool = False) -> pd.DataFrame:
|
|
|
28
29
|
)
|
|
29
30
|
|
|
30
31
|
if df.empty or force_update:
|
|
31
|
-
|
|
32
|
+
setup_logging()
|
|
33
|
+
logging.info(SquirrelMessage(
|
|
34
|
+
tree=acorns.TREE.__class__.__name__,
|
|
35
|
+
acorn=acorns.NAMES["d2r"],
|
|
36
|
+
message="Updating cache"
|
|
37
|
+
).to_json())
|
|
32
38
|
client = MetadataDbClient(
|
|
33
39
|
host=acorns.API_GATEWAY_HOST,
|
|
34
40
|
version="v2",
|
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
|
6
6
|
from aind_data_access_api.document_db import MetadataDbClient
|
|
7
7
|
|
|
8
8
|
import zombie_squirrel.acorns as acorns
|
|
9
|
+
from zombie_squirrel.utils import setup_logging, SquirrelMessage
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["upn"])
|
|
@@ -28,8 +29,12 @@ def unique_project_names(force_update: bool = False) -> list[str]:
|
|
|
28
29
|
)
|
|
29
30
|
|
|
30
31
|
if df.empty or force_update:
|
|
31
|
-
|
|
32
|
-
logging.info(
|
|
32
|
+
setup_logging()
|
|
33
|
+
logging.info(SquirrelMessage(
|
|
34
|
+
tree=acorns.TREE.__class__.__name__,
|
|
35
|
+
acorn=acorns.NAMES["upn"],
|
|
36
|
+
message="Updating cache"
|
|
37
|
+
).to_json())
|
|
33
38
|
client = MetadataDbClient(
|
|
34
39
|
host=acorns.API_GATEWAY_HOST,
|
|
35
40
|
version="v2",
|
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
|
6
6
|
from aind_data_access_api.document_db import MetadataDbClient
|
|
7
7
|
|
|
8
8
|
import zombie_squirrel.acorns as acorns
|
|
9
|
+
from zombie_squirrel.utils import setup_logging, SquirrelMessage
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["usi"])
|
|
@@ -28,8 +29,12 @@ def unique_subject_ids(force_update: bool = False) -> list[str]:
|
|
|
28
29
|
)
|
|
29
30
|
|
|
30
31
|
if df.empty or force_update:
|
|
31
|
-
|
|
32
|
-
logging.info(
|
|
32
|
+
setup_logging()
|
|
33
|
+
logging.info(SquirrelMessage(
|
|
34
|
+
tree=acorns.TREE.__class__.__name__,
|
|
35
|
+
acorn=acorns.NAMES["usi"],
|
|
36
|
+
message="Updating cache"
|
|
37
|
+
).to_json())
|
|
33
38
|
client = MetadataDbClient(
|
|
34
39
|
host=acorns.API_GATEWAY_HOST,
|
|
35
40
|
version="v2",
|
zombie_squirrel/acorns.py
CHANGED
|
@@ -16,12 +16,14 @@ API_GATEWAY_HOST = "api.allenneuraldynamics.org"
|
|
|
16
16
|
|
|
17
17
|
forest_type = os.getenv("FOREST_TYPE", "memory").lower()
|
|
18
18
|
|
|
19
|
-
if forest_type == "
|
|
19
|
+
if forest_type == "s3": # pragma: no cover
|
|
20
20
|
logging.info("Using S3 forest for caching")
|
|
21
21
|
TREE = S3Tree()
|
|
22
|
-
|
|
22
|
+
elif forest_type == "memory":
|
|
23
23
|
logging.info("Using in-memory forest for caching")
|
|
24
24
|
TREE = MemoryTree()
|
|
25
|
+
else:
|
|
26
|
+
raise ValueError(f"Unknown FOREST_TYPE: {forest_type}")
|
|
25
27
|
|
|
26
28
|
# --- Acorn registry and names -----------------------------------------------------
|
|
27
29
|
|
zombie_squirrel/sync.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"""Synchronization utilities for updating all cached data."""
|
|
2
2
|
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
3
|
from .acorns import ACORN_REGISTRY
|
|
6
4
|
|
|
7
5
|
|
|
@@ -10,9 +8,5 @@ def hide_acorns():
|
|
|
10
8
|
|
|
11
9
|
Calls each acorn function with force_update=True to refresh
|
|
12
10
|
all cached data in the tree backend."""
|
|
13
|
-
logging.basicConfig(
|
|
14
|
-
level=logging.INFO,
|
|
15
|
-
format="%(asctime)s %(levelname)s %(message)s"
|
|
16
|
-
)
|
|
17
11
|
for acorn in ACORN_REGISTRY.values():
|
|
18
12
|
acorn(force_update=True)
|
zombie_squirrel/utils.py
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
"""Utility functions for zombie-squirrel package."""
|
|
2
2
|
|
|
3
|
+
import logging
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SquirrelMessage(BaseModel):
|
|
8
|
+
"""Structured logging message for zombie-squirrel operations."""
|
|
9
|
+
tree: str
|
|
10
|
+
acorn: str
|
|
11
|
+
message: str
|
|
12
|
+
|
|
13
|
+
def to_json(self) -> str:
|
|
14
|
+
"""Convert message to JSON string."""
|
|
15
|
+
return self.model_dump_json()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def setup_logging():
|
|
19
|
+
"""Configure logging for zombie-squirrel package.
|
|
20
|
+
|
|
21
|
+
Sets up INFO level logging with timestamp format.
|
|
22
|
+
Safe to call multiple times - uses force=True to reconfigure."""
|
|
23
|
+
logging.basicConfig(
|
|
24
|
+
level=logging.INFO,
|
|
25
|
+
format="%(asctime)s %(levelname)s %(message)s",
|
|
26
|
+
force=True
|
|
27
|
+
)
|
|
28
|
+
|
|
3
29
|
|
|
4
30
|
def prefix_table_name(table_name: str) -> str:
|
|
5
31
|
"""Add zombie-squirrel prefix and parquet extension to filenames.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zombie-squirrel
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5
|
|
4
4
|
Summary: Generated from aind-library-template
|
|
5
5
|
Author: Allen Institute for Neural Dynamics
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Dynamic: license-file
|
|
|
21
21
|

|
|
22
22
|
[](https://github.com/semantic-release/semantic-release)
|
|
23
23
|

|
|
24
|
-

|
|
25
25
|

|
|
26
26
|
|
|
27
27
|
<img src="zombie-squirrel_logo.png" width="400" alt="Logo (image from ChatGPT)">
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
zombie_squirrel/__init__.py,sha256=VuYcirFF0r9h-Rn0WZsLuMZgNPONe0KmzKSxK45yV_s,693
|
|
2
|
+
zombie_squirrel/acorns.py,sha256=ZjGZMzVcV44dI56Efrj_m4yZCV88UPBvOp-IBQ7pAc4,1224
|
|
3
|
+
zombie_squirrel/forest.py,sha256=v0K1u0EA0OptzxocFC-fPEi6xYcnJ9SoWJ6aiPF4jLg,2939
|
|
4
|
+
zombie_squirrel/sync.py,sha256=51ufe4n_3CvYrfTKW4KHngY4k-E9k0I_HGdWOIHY-bA,366
|
|
5
|
+
zombie_squirrel/utils.py,sha256=hyXoWstJ7rUYZVmazEtt5hXJ4SAMbfmlQMDUmBlfFZw,1280
|
|
6
|
+
zombie_squirrel/acorn_contents/__init__.py,sha256=N4Wun9kn44_nCwV4g6naEVzf76ozOgEoupAHLYpiGsI,224
|
|
7
|
+
zombie_squirrel/acorn_contents/asset_basics.py,sha256=PYN1NQsTVVCdLVd7JgTMTf5uepABOKVtSe4Sx_wrA1g,6037
|
|
8
|
+
zombie_squirrel/acorn_contents/raw_to_derived.py,sha256=7y2xA7GLC2hMj_Z7gz-uBOKiVdzGjBtQ2lsgHzASnOg,2853
|
|
9
|
+
zombie_squirrel/acorn_contents/source_data.py,sha256=I7A3mHqVO4C4880w82LNlBHZZ72uSHw3eCwrKtVCnSI,1901
|
|
10
|
+
zombie_squirrel/acorn_contents/unique_project_names.py,sha256=VAS0CZzsC9ObPM39KfrIjYPDIVcqu9H9wyZz8styznQ,1612
|
|
11
|
+
zombie_squirrel/acorn_contents/unique_subject_ids.py,sha256=H_eb3ucayNOdt4GtW26qckqvX6qGcRU59Q_D9NlnSbg,1585
|
|
12
|
+
zombie_squirrel-0.8.5.dist-info/licenses/LICENSE,sha256=U0Y7B3gZJHXpjJVLgTQjM8e_c8w4JJpLgGhIdsoFR1Y,1092
|
|
13
|
+
zombie_squirrel-0.8.5.dist-info/METADATA,sha256=pXffN2yY6CD9ygtZhqGxeWF1VVL_qg4ZunrKKO23c8w,1897
|
|
14
|
+
zombie_squirrel-0.8.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
+
zombie_squirrel-0.8.5.dist-info/top_level.txt,sha256=FmM0coe4AangURZLjM4JwwRv2B8H6oINYCoZLKLDCKA,16
|
|
16
|
+
zombie_squirrel-0.8.5.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
zombie_squirrel/__init__.py,sha256=46-EAdFSa5UsVaOENsqKKw2wVBlGRDrQojdWE4SU14s,693
|
|
2
|
-
zombie_squirrel/acorns.py,sha256=BLhySoLfb7D6IfbNMOhxbLJba-8Wp-L9e1w_2KozjjM,1134
|
|
3
|
-
zombie_squirrel/forest.py,sha256=v0K1u0EA0OptzxocFC-fPEi6xYcnJ9SoWJ6aiPF4jLg,2939
|
|
4
|
-
zombie_squirrel/sync.py,sha256=9cpfSzTj0cQz4-d3glMAOejCZgekMirLc-dwEFFQhlg,496
|
|
5
|
-
zombie_squirrel/utils.py,sha256=kojQpHUKlRJD7WEZDfcpQIZTj9iUrtX5_6F-gWWzJW0,628
|
|
6
|
-
zombie_squirrel/acorn_contents/__init__.py,sha256=N4Wun9kn44_nCwV4g6naEVzf76ozOgEoupAHLYpiGsI,224
|
|
7
|
-
zombie_squirrel/acorn_contents/asset_basics.py,sha256=EZ4jGiO2JYyMZuhZ0DsCyOtEk2jL_oAqAO6HPVwrhY8,5669
|
|
8
|
-
zombie_squirrel/acorn_contents/raw_to_derived.py,sha256=Ld9gbYDmg6hVvB4ai_T1A4mAiU7shSq_ZEDSg4HPJ3M,2646
|
|
9
|
-
zombie_squirrel/acorn_contents/source_data.py,sha256=XoepH1EZUYy4QTLzXW5sP8zBn1mjoMVDLtWfy0TPHoA,1683
|
|
10
|
-
zombie_squirrel/acorn_contents/unique_project_names.py,sha256=k0ePwdrDHDe5rvdPZOfL1X9VlsUZcMtTkUWDw_vuZkw,1445
|
|
11
|
-
zombie_squirrel/acorn_contents/unique_subject_ids.py,sha256=nsew2-bHCcmxfaYCWzjUEx9T2cohL_E7OuRsQjJl8KY,1416
|
|
12
|
-
zombie_squirrel-0.8.3.dist-info/licenses/LICENSE,sha256=U0Y7B3gZJHXpjJVLgTQjM8e_c8w4JJpLgGhIdsoFR1Y,1092
|
|
13
|
-
zombie_squirrel-0.8.3.dist-info/METADATA,sha256=HpbkwFYI5U0OzKDRyYUXASOjxlcbUks6GmL-EreBt4U,1898
|
|
14
|
-
zombie_squirrel-0.8.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
-
zombie_squirrel-0.8.3.dist-info/top_level.txt,sha256=FmM0coe4AangURZLjM4JwwRv2B8H6oINYCoZLKLDCKA,16
|
|
16
|
-
zombie_squirrel-0.8.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|