zombie-squirrel 0.8.2__tar.gz → 0.8.4__tar.gz
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-0.8.2/src/zombie_squirrel.egg-info → zombie_squirrel-0.8.4}/PKG-INFO +1 -1
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/__init__.py +1 -1
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/asset_basics.py +7 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/raw_to_derived.py +11 -3
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/source_data.py +7 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/unique_project_names.py +7 -1
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/unique_subject_ids.py +7 -1
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorns.py +11 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/sync.py +0 -6
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/utils.py +14 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4/src/zombie_squirrel.egg-info}/PKG-INFO +1 -1
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/LICENSE +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/README.md +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/pyproject.toml +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/setup.cfg +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/setup.py +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/__init__.py +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/forest.py +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel.egg-info/SOURCES.txt +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel.egg-info/dependency_links.txt +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel.egg-info/requires.txt +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel.egg-info/top_level.txt +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/tests/test_acorns.py +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/tests/test_sync.py +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/tests/test_trees.py +0 -0
- {zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/tests/test_utils.py +0 -0
|
@@ -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.4"
|
|
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
|
{zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/asset_basics.py
RENAMED
|
@@ -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
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["basics"])
|
|
@@ -37,7 +38,13 @@ def asset_basics(force_update: bool = False) -> pd.DataFrame:
|
|
|
37
38
|
"location",
|
|
38
39
|
]
|
|
39
40
|
|
|
41
|
+
if df.empty and not force_update:
|
|
42
|
+
raise ValueError(
|
|
43
|
+
"Cache is empty. Use force_update=True to fetch data from database."
|
|
44
|
+
)
|
|
45
|
+
|
|
40
46
|
if df.empty or force_update:
|
|
47
|
+
setup_logging()
|
|
41
48
|
logging.info("Updating cache for asset basics")
|
|
42
49
|
df = pd.DataFrame(
|
|
43
50
|
columns=[
|
{zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/raw_to_derived.py
RENAMED
|
@@ -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
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["r2d"])
|
|
@@ -22,7 +23,13 @@ def raw_to_derived(force_update: bool = False) -> pd.DataFrame:
|
|
|
22
23
|
DataFrame with _id and derived_records columns."""
|
|
23
24
|
df = acorns.TREE.scurry(acorns.NAMES["r2d"])
|
|
24
25
|
|
|
26
|
+
if df.empty and not force_update:
|
|
27
|
+
raise ValueError(
|
|
28
|
+
"Cache is empty. Use force_update=True to fetch data from database."
|
|
29
|
+
)
|
|
30
|
+
|
|
25
31
|
if df.empty or force_update:
|
|
32
|
+
setup_logging()
|
|
26
33
|
logging.info("Updating cache for raw to derived mapping")
|
|
27
34
|
client = MetadataDbClient(
|
|
28
35
|
host=acorns.API_GATEWAY_HOST,
|
|
@@ -50,9 +57,10 @@ def raw_to_derived(force_update: bool = False) -> pd.DataFrame:
|
|
|
50
57
|
source_data_list = derived_record.get("data_description", {}).get("source_data", [])
|
|
51
58
|
derived_id = derived_record["_id"]
|
|
52
59
|
# Add this derived record to each raw record it depends on
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
raw_to_derived_map
|
|
60
|
+
if source_data_list:
|
|
61
|
+
for source_id in source_data_list:
|
|
62
|
+
if source_id in raw_to_derived_map:
|
|
63
|
+
raw_to_derived_map[source_id].append(derived_id)
|
|
56
64
|
|
|
57
65
|
# Convert to DataFrame
|
|
58
66
|
data = []
|
{zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/source_data.py
RENAMED
|
@@ -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
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["d2r"])
|
|
@@ -22,7 +23,13 @@ def source_data(force_update: bool = False) -> pd.DataFrame:
|
|
|
22
23
|
DataFrame with _id and source_data columns."""
|
|
23
24
|
df = acorns.TREE.scurry(acorns.NAMES["d2r"])
|
|
24
25
|
|
|
26
|
+
if df.empty and not force_update:
|
|
27
|
+
raise ValueError(
|
|
28
|
+
"Cache is empty. Use force_update=True to fetch data from database."
|
|
29
|
+
)
|
|
30
|
+
|
|
25
31
|
if df.empty or force_update:
|
|
32
|
+
setup_logging()
|
|
26
33
|
logging.info("Updating cache for source data")
|
|
27
34
|
client = MetadataDbClient(
|
|
28
35
|
host=acorns.API_GATEWAY_HOST,
|
|
@@ -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
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["upn"])
|
|
@@ -22,8 +23,13 @@ def unique_project_names(force_update: bool = False) -> list[str]:
|
|
|
22
23
|
List of unique project names."""
|
|
23
24
|
df = acorns.TREE.scurry(acorns.NAMES["upn"])
|
|
24
25
|
|
|
26
|
+
if df.empty and not force_update:
|
|
27
|
+
raise ValueError(
|
|
28
|
+
"Cache is empty. Use force_update=True to fetch data from database."
|
|
29
|
+
)
|
|
30
|
+
|
|
25
31
|
if df.empty or force_update:
|
|
26
|
-
|
|
32
|
+
setup_logging()
|
|
27
33
|
logging.info("Updating cache for unique project names")
|
|
28
34
|
client = MetadataDbClient(
|
|
29
35
|
host=acorns.API_GATEWAY_HOST,
|
|
@@ -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
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@acorns.register_acorn(acorns.NAMES["usi"])
|
|
@@ -22,8 +23,13 @@ def unique_subject_ids(force_update: bool = False) -> list[str]:
|
|
|
22
23
|
List of unique subject IDs."""
|
|
23
24
|
df = acorns.TREE.scurry(acorns.NAMES["usi"])
|
|
24
25
|
|
|
26
|
+
if df.empty and not force_update:
|
|
27
|
+
raise ValueError(
|
|
28
|
+
"Cache is empty. Use force_update=True to fetch data from database."
|
|
29
|
+
)
|
|
30
|
+
|
|
25
31
|
if df.empty or force_update:
|
|
26
|
-
|
|
32
|
+
setup_logging()
|
|
27
33
|
logging.info("Updating cache for unique subject IDs")
|
|
28
34
|
client = MetadataDbClient(
|
|
29
35
|
host=acorns.API_GATEWAY_HOST,
|
|
@@ -45,3 +45,14 @@ def register_acorn(name: str):
|
|
|
45
45
|
return func
|
|
46
46
|
|
|
47
47
|
return decorator
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# Import acorn_contents modules to trigger registration
|
|
51
|
+
# This must be done after the registry and decorator are defined
|
|
52
|
+
from zombie_squirrel.acorn_contents import ( # noqa: E402, F401
|
|
53
|
+
asset_basics,
|
|
54
|
+
raw_to_derived,
|
|
55
|
+
source_data,
|
|
56
|
+
unique_project_names,
|
|
57
|
+
unique_subject_ids,
|
|
58
|
+
)
|
|
@@ -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)
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
"""Utility functions for zombie-squirrel package."""
|
|
2
2
|
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def setup_logging():
|
|
7
|
+
"""Configure logging for zombie-squirrel package.
|
|
8
|
+
|
|
9
|
+
Sets up INFO level logging with timestamp format.
|
|
10
|
+
Safe to call multiple times - uses force=True to reconfigure."""
|
|
11
|
+
logging.basicConfig(
|
|
12
|
+
level=logging.INFO,
|
|
13
|
+
format="%(asctime)s %(levelname)s %(message)s",
|
|
14
|
+
force=True
|
|
15
|
+
)
|
|
16
|
+
|
|
3
17
|
|
|
4
18
|
def prefix_table_name(table_name: str) -> str:
|
|
5
19
|
"""Add zombie-squirrel prefix and parquet extension to filenames.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel/acorn_contents/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{zombie_squirrel-0.8.2 → zombie_squirrel-0.8.4}/src/zombie_squirrel.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|