zombie-squirrel 0.8.1__py3-none-any.whl → 0.8.3__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.
@@ -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.1"
6
+ __version__ = "0.8.3"
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
@@ -1,6 +1,5 @@
1
1
  """Acorns module: individual data fetching functions."""
2
2
 
3
- # Import the acorn modules to trigger decorator registration
4
3
  from zombie_squirrel.acorn_contents import ( # noqa: F401
5
4
  asset_basics,
6
5
  raw_to_derived,
@@ -37,6 +37,11 @@ def asset_basics(force_update: bool = False) -> pd.DataFrame:
37
37
  "location",
38
38
  ]
39
39
 
40
+ if df.empty and not force_update:
41
+ raise ValueError(
42
+ "Cache is empty. Use force_update=True to fetch data from database."
43
+ )
44
+
40
45
  if df.empty or force_update:
41
46
  logging.info("Updating cache for asset basics")
42
47
  df = pd.DataFrame(
@@ -22,6 +22,11 @@ def raw_to_derived(force_update: bool = False) -> pd.DataFrame:
22
22
  DataFrame with _id and derived_records columns."""
23
23
  df = acorns.TREE.scurry(acorns.NAMES["r2d"])
24
24
 
25
+ if df.empty and not force_update:
26
+ raise ValueError(
27
+ "Cache is empty. Use force_update=True to fetch data from database."
28
+ )
29
+
25
30
  if df.empty or force_update:
26
31
  logging.info("Updating cache for raw to derived mapping")
27
32
  client = MetadataDbClient(
@@ -50,9 +55,10 @@ def raw_to_derived(force_update: bool = False) -> pd.DataFrame:
50
55
  source_data_list = derived_record.get("data_description", {}).get("source_data", [])
51
56
  derived_id = derived_record["_id"]
52
57
  # Add this derived record to each raw record it depends on
53
- for source_id in source_data_list:
54
- if source_id in raw_to_derived_map:
55
- raw_to_derived_map[source_id].append(derived_id)
58
+ if source_data_list:
59
+ for source_id in source_data_list:
60
+ if source_id in raw_to_derived_map:
61
+ raw_to_derived_map[source_id].append(derived_id)
56
62
 
57
63
  # Convert to DataFrame
58
64
  data = []
@@ -22,6 +22,11 @@ def source_data(force_update: bool = False) -> pd.DataFrame:
22
22
  DataFrame with _id and source_data columns."""
23
23
  df = acorns.TREE.scurry(acorns.NAMES["d2r"])
24
24
 
25
+ if df.empty and not force_update:
26
+ raise ValueError(
27
+ "Cache is empty. Use force_update=True to fetch data from database."
28
+ )
29
+
25
30
  if df.empty or force_update:
26
31
  logging.info("Updating cache for source data")
27
32
  client = MetadataDbClient(
@@ -22,6 +22,11 @@ def unique_project_names(force_update: bool = False) -> list[str]:
22
22
  List of unique project names."""
23
23
  df = acorns.TREE.scurry(acorns.NAMES["upn"])
24
24
 
25
+ if df.empty and not force_update:
26
+ raise ValueError(
27
+ "Cache is empty. Use force_update=True to fetch data from database."
28
+ )
29
+
25
30
  if df.empty or force_update:
26
31
  # If cache is missing, fetch data
27
32
  logging.info("Updating cache for unique project names")
@@ -22,6 +22,11 @@ def unique_subject_ids(force_update: bool = False) -> list[str]:
22
22
  List of unique subject IDs."""
23
23
  df = acorns.TREE.scurry(acorns.NAMES["usi"])
24
24
 
25
+ if df.empty and not force_update:
26
+ raise ValueError(
27
+ "Cache is empty. Use force_update=True to fetch data from database."
28
+ )
29
+
25
30
  if df.empty or force_update:
26
31
  # If cache is missing, fetch data
27
32
  logging.info("Updating cache for unique subject IDs")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zombie-squirrel
3
- Version: 0.8.1
3
+ Version: 0.8.3
4
4
  Summary: Generated from aind-library-template
5
5
  Author: Allen Institute for Neural Dynamics
6
6
  License: MIT
@@ -0,0 +1,16 @@
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,,
@@ -1,16 +0,0 @@
1
- zombie_squirrel/__init__.py,sha256=sPD8B2awlREi8c33mhKoGw0khdE5u1XQmU_3hWiVH9A,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=LsNy5xjlJS981SVxRLD4yPhUg__fuY8-HbPDapOhH-o,285
7
- zombie_squirrel/acorn_contents/asset_basics.py,sha256=cTg016sZbrJH5_As7CqnirumR1hSMn4GiYX0IReoou0,5513
8
- zombie_squirrel/acorn_contents/raw_to_derived.py,sha256=EFjLP9szzk3Q6jNhyDwxx8rqhG1bFTVmxeCpCAsv6yg,2445
9
- zombie_squirrel/acorn_contents/source_data.py,sha256=zbw3DnTwXo6xDTZ1uCoIbcYrVBH2r2xZN3trKtxT8cg,1527
10
- zombie_squirrel/acorn_contents/unique_project_names.py,sha256=Fu0P2DyI91W7xhx1uRk2YVMyFG8WPihDCj7n_A7zL2E,1289
11
- zombie_squirrel/acorn_contents/unique_subject_ids.py,sha256=dOVn1ObDF86p8S8US__hlyjTGxT0vz01oeGzjoWGFIc,1260
12
- zombie_squirrel-0.8.1.dist-info/licenses/LICENSE,sha256=U0Y7B3gZJHXpjJVLgTQjM8e_c8w4JJpLgGhIdsoFR1Y,1092
13
- zombie_squirrel-0.8.1.dist-info/METADATA,sha256=xEQ04ahuoz0XhbxLpAUCYFLG1kj6VSV2RFMfRtAq1PY,1898
14
- zombie_squirrel-0.8.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
15
- zombie_squirrel-0.8.1.dist-info/top_level.txt,sha256=FmM0coe4AangURZLjM4JwwRv2B8H6oINYCoZLKLDCKA,16
16
- zombie_squirrel-0.8.1.dist-info/RECORD,,