xedocs 0.2.26__tar.gz → 0.2.28__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- xedocs-0.2.28/AUTHORS.rst +13 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/PKG-INFO +5 -3
- {xedocs-0.2.26 → xedocs-0.2.28}/README.rst +4 -2
- {xedocs-0.2.26 → xedocs-0.2.28}/pyproject.toml +1 -1
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/__init__.py +1 -1
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/data_locations/mongodb.py +21 -4
- xedocs-0.2.28/xedocs/schemas/corrections/__init__.py +3 -0
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/__init__.py +1 -2
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/avg_se_gain.py +3 -3
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/baseline_samples_nv.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/bayes_model.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/cs2_aft_corrections.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/electron_diffusion_cte.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/electron_drift.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/electron_lifetime.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/extraction_efficiency.py +2 -2
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/field_distortion.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/global_versions.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/hit_thresholds.py +2 -2
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/hotspot_veto_cut.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/photoionization_strength.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/pmt_area_to_pe.py +2 -2
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/position_reconstruction.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/relative_light_yield.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/s1_aft_xyz.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/s1_pattern_maps.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/s1_xyz.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/s2_pattern_maps.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/s2_xy.py +1 -1
- xedocs-0.2.28/xedocs/schemas/corrections/implementations/se_gain_partition.py +21 -0
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/se_gains.py +2 -2
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/som_network.py +1 -1
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/z_bias.py +1 -1
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/detector_numbers.py +4 -7
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/xedocs.py +38 -3
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/xenon_config.py +1 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/tests/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/tests/test_corrections.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/tests/test_xedocs.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/_settings.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/_straxen_plugin.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/cli.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/clock.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/data_locations/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/data_locations/api.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/data_locations/corrections_repo.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/data_locations/data_folder.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/data_locations/github.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/databases.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/dispatchers.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/entrypoints.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/json_records.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/regex_dispatcher.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/analysis/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/analysis/base_analysis.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/analysis/processing_requests.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/base_schemas.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/calibrations/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/calibrations/base_calibrations.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/calibrations/diffused_calibration.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/calibrations/ibelt_calibrations.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/calibrations/sources.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/calibrations/utube_calibrations.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/constants.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/context_config.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/context_lineage.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/corrections/base_corrections.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/corrections/base_references.py +0 -0
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/field_simulation.py +0 -0
- {xedocs-0.2.26/xedocs/schemas/corrections → xedocs-0.2.28/xedocs/schemas/corrections/implementations}/lone_hits.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/fax.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/historian_reader.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/operations_reports/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/operations_reports/abnormal_rates.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/operations_reports/anode_ramp.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/operations_reports/anode_washing.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/operations_reports/base_report.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/operations_reports/hotspot.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/plugin_lineages.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/__init__.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/base_pmt_data.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/gain_calculation.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/pmt_installs.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/pmts.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/voltage_changes.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/schemas/pmt_data/voltage_settings.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/utils.py +0 -0
- {xedocs-0.2.26 → xedocs-0.2.28}/xedocs/widgets.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: xedocs
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.28
|
4
4
|
Summary: Top-level package for xedocs.
|
5
5
|
Home-page: https://github.com/XENONnT/xedocs
|
6
6
|
Author: Yossi Mosbacher
|
@@ -32,8 +32,10 @@ Description-Content-Type: text/x-rst
|
|
32
32
|
=======================================
|
33
33
|
XeDocs - XENON Metadata management tool
|
34
34
|
=======================================
|
35
|
-
|
36
|
-
|
35
|
+
|
36
|
+
XeDocs manages tracking versioned detector numbers, replacing CMT and ideally all hard-coded values.
|
37
|
+
XeDocs both looks up data from its own online database, and uses straxen URL-style lookup to find other resources.
|
38
|
+
To upload data to the XeDocs database, you must submit it as a PR to https://github.com/XENONnT/corrections
|
37
39
|
|
38
40
|
What does Xedocs give you
|
39
41
|
=========================
|
@@ -1,8 +1,10 @@
|
|
1
1
|
=======================================
|
2
2
|
XeDocs - XENON Metadata management tool
|
3
3
|
=======================================
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
XeDocs manages tracking versioned detector numbers, replacing CMT and ideally all hard-coded values.
|
6
|
+
XeDocs both looks up data from its own online database, and uses straxen URL-style lookup to find other resources.
|
7
|
+
To upload data to the XeDocs database, you must submit it as a PR to https://github.com/XENONnT/corrections
|
6
8
|
|
7
9
|
What does Xedocs give you
|
8
10
|
=========================
|
@@ -5,9 +5,9 @@ from rframe import DataAccessor
|
|
5
5
|
|
6
6
|
|
7
7
|
def xenon_config_source(settings: BaseSettings) -> Dict[str, Any]:
|
8
|
-
from xedocs import settings
|
8
|
+
from xedocs import settings as xenon_settings
|
9
9
|
|
10
|
-
cfg =
|
10
|
+
cfg = xenon_settings.xenon_config.RunDB
|
11
11
|
data = {}
|
12
12
|
if cfg.xent_url:
|
13
13
|
data['host'] = cfg.xent_url
|
@@ -17,6 +17,14 @@ def xenon_config_source(settings: BaseSettings) -> Dict[str, Any]:
|
|
17
17
|
data['password'] = cfg.xent_password
|
18
18
|
if cfg.xent_database:
|
19
19
|
data['auth_db'] = cfg.xent_database
|
20
|
+
if cfg.max_pool_size:
|
21
|
+
data['max_pool_size'] = cfg.max_pool_size
|
22
|
+
if cfg.socket_timeout:
|
23
|
+
data['socket_timeout'] = cfg.socket_timeout
|
24
|
+
if cfg.connect_timeout:
|
25
|
+
data['connect_timeout'] = cfg.connect_timeout
|
26
|
+
if cfg.read_preference:
|
27
|
+
data['read_preference'] = cfg.read_preference
|
20
28
|
return data
|
21
29
|
|
22
30
|
|
@@ -50,17 +58,26 @@ class MongoDB(BaseSettings):
|
|
50
58
|
host: str = "localhost"
|
51
59
|
connection_uri: str = None
|
52
60
|
|
61
|
+
max_pool_size: int = 100
|
62
|
+
socket_timeout: int = 60000
|
63
|
+
connect_timeout: int = 60000
|
64
|
+
read_preference: str = "secondaryPreferred"
|
65
|
+
|
53
66
|
@property
|
54
67
|
def client(self):
|
55
68
|
if self.connection_uri is None:
|
56
|
-
self.connection_uri = f"mongodb://{self.username}:{self.password}@{self.host}?authSource={self.auth_db}
|
69
|
+
self.connection_uri = f"mongodb://{self.username}:{self.password}@{self.host}?authSource={self.auth_db}"
|
57
70
|
if self.connection_uri not in self.CLIENT_CACHE:
|
58
71
|
self.CLIENT_CACHE[self.connection_uri] = self.make_client(self.connection_uri)
|
59
72
|
return self.CLIENT_CACHE[self.connection_uri]
|
60
73
|
|
61
74
|
def make_client(self, connection_uri):
|
62
75
|
import pymongo
|
63
|
-
return pymongo.MongoClient(connection_uri
|
76
|
+
return pymongo.MongoClient(connection_uri,
|
77
|
+
maxPoolSize=self.max_pool_size,
|
78
|
+
socketTimeoutMS=self.socket_timeout,
|
79
|
+
connectTimeoutMS=self.connect_timeout,
|
80
|
+
readPreference=self.read_preference)
|
64
81
|
|
65
82
|
@classmethod
|
66
83
|
def from_utilix(cls, **kwargs):
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from .base_corrections import *
|
2
|
-
from .base_references import *
|
3
1
|
from .electron_drift import *
|
4
2
|
from .electron_lifetime import *
|
5
3
|
from .extraction_efficiency import *
|
@@ -26,3 +24,4 @@ from .s2_pattern_maps import *
|
|
26
24
|
from .s1_pattern_maps import *
|
27
25
|
from .z_bias import *
|
28
26
|
from .cs2_aft_corrections import *
|
27
|
+
from .se_gain_partition import *
|
@@ -9,11 +9,11 @@ wiki:
|
|
9
9
|
|
10
10
|
import rframe
|
11
11
|
|
12
|
-
from
|
13
|
-
from
|
12
|
+
from ..base_corrections import TimeIntervalCorrection
|
13
|
+
from ...constants import PARTITION
|
14
14
|
|
15
15
|
|
16
|
-
class AvgSingleElectronGain(
|
16
|
+
class AvgSingleElectronGain(TimeIntervalCorrection):
|
17
17
|
|
18
18
|
_ALIAS = "avg_se_gains"
|
19
19
|
partition: PARTITION = rframe.Index(default="all_tpc")
|
@@ -6,7 +6,7 @@ https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenonnt:zihao:sr1_s2aft_photoni
|
|
6
6
|
|
7
7
|
"""
|
8
8
|
|
9
|
-
from
|
9
|
+
from ..base_corrections import TimeSampledCorrection
|
10
10
|
|
11
11
|
|
12
12
|
class cS2BottomTopRatioCorrection(TimeSampledCorrection):
|
@@ -13,7 +13,7 @@ See note on drift velocity, diffusion constant, and drift time at the gate
|
|
13
13
|
|
14
14
|
import rframe
|
15
15
|
|
16
|
-
from
|
16
|
+
from ..base_corrections import TimeSampledCorrection
|
17
17
|
|
18
18
|
|
19
19
|
class ElectronDriftVelocity(TimeSampledCorrection):
|
@@ -13,8 +13,8 @@ Time dependence of Extraction Efficiency generated from Kr83m calibration data a
|
|
13
13
|
"""
|
14
14
|
import rframe
|
15
15
|
|
16
|
-
from
|
17
|
-
from
|
16
|
+
from ..base_corrections import TimeSampledCorrection
|
17
|
+
from ...constants import PARTITION
|
18
18
|
|
19
19
|
|
20
20
|
class RelExtractionEff(TimeSampledCorrection):
|
@@ -4,7 +4,7 @@ which vetos the events with local single electron rate above the threshold in ea
|
|
4
4
|
Reference: xenon:xenonnt:analysis:hot_spot_cut_summary
|
5
5
|
"""
|
6
6
|
|
7
|
-
from
|
7
|
+
from ..base_corrections import TimeIntervalCorrection
|
8
8
|
|
9
9
|
class HotspotVetoThreshold(TimeIntervalCorrection):
|
10
10
|
_ALIAS = 'hotspot_veto_thresholds'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"""
|
2
|
+
Correction: Region linear and circular for AB/CD partitions
|
3
|
+
Affects: Corrected areas
|
4
|
+
|
5
|
+
Two distinct patterns of evolution of single electron corrections between A+B and C+D. Distinguish thanks to linear and circular regions.
|
6
|
+
This TPC partitioning affects the single electron gains - both the average value and not - and the relative extraction efficiency.
|
7
|
+
|
8
|
+
SR0 wiki: https://xe1t-wiki.lngs.infn.it/doku.php?id=jlong:sr0_2_region_se_correction
|
9
|
+
SR1 wiki: https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenonnt:noahhood:corrections:se_gain_ee_final
|
10
|
+
"""
|
11
|
+
|
12
|
+
import rframe
|
13
|
+
|
14
|
+
from ..base_corrections import TimeIntervalCorrection
|
15
|
+
|
16
|
+
class SingleElectronGainPartition(TimeIntervalCorrection):
|
17
|
+
|
18
|
+
_ALIAS = "single_electron_gain_partition"
|
19
|
+
region: str = rframe.Index(max_length=80)
|
20
|
+
value: float
|
21
|
+
|
@@ -13,8 +13,8 @@ Wiki:
|
|
13
13
|
|
14
14
|
import rframe
|
15
15
|
|
16
|
-
from
|
17
|
-
from
|
16
|
+
from ..base_corrections import TimeSampledCorrection
|
17
|
+
from ...constants import PARTITION
|
18
18
|
|
19
19
|
|
20
20
|
class SingleElectronGain(TimeSampledCorrection):
|
@@ -4,7 +4,7 @@ Self-Organizing Map to classify peaklets as one of several SOM_types,
|
|
4
4
|
as well as classifying those types into either an S1 or an S2
|
5
5
|
"""
|
6
6
|
|
7
|
-
from
|
7
|
+
from ..base_references import BaseResourceReference
|
8
8
|
|
9
9
|
|
10
10
|
class SOMClassifier(BaseResourceReference):
|
@@ -5,7 +5,7 @@ the observed r(r_obs) and z(z_obs).
|
|
5
5
|
Reference: xenon:xenonnt:terliuk:drift_field_z_bias_correction
|
6
6
|
"""
|
7
7
|
|
8
|
-
from
|
8
|
+
from ..base_references import BaseResourceReference
|
9
9
|
|
10
10
|
class ZBias(BaseResourceReference):
|
11
11
|
_ALIAS = 'z_bias_maps'
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import rframe
|
2
2
|
import datetime
|
3
3
|
|
4
|
-
from .
|
4
|
+
from .corrections.base_corrections import TimeIntervalCorrection
|
5
5
|
from .constants import PARTITION
|
6
6
|
|
7
|
-
|
8
|
-
class DetectorNumber(VersionedXeDoc):
|
7
|
+
class DetectorNumber(TimeIntervalCorrection):
|
9
8
|
"""Detector parameters
|
10
9
|
A collection of non-time dependent detector
|
11
10
|
values.
|
@@ -15,10 +14,8 @@ class DetectorNumber(VersionedXeDoc):
|
|
15
14
|
|
16
15
|
field: str = rframe.Index(max_length=80)
|
17
16
|
partition: PARTITION = rframe.Index(default="all_tpc")
|
18
|
-
|
17
|
+
science_run: str = rframe.Index(max_length=80)
|
18
|
+
definition: str=""
|
19
19
|
value: float
|
20
20
|
uncertainty: float
|
21
|
-
definition: str
|
22
21
|
reference: str = ""
|
23
|
-
date: datetime.datetime
|
24
|
-
comments: str = ""
|
@@ -10,6 +10,7 @@ from tqdm.auto import tqdm
|
|
10
10
|
|
11
11
|
from ._settings import settings
|
12
12
|
from .schemas import XeDoc
|
13
|
+
from .data_locations.mongodb import MongoDB
|
13
14
|
|
14
15
|
|
15
16
|
def find_docs(schema, datasource=None, **labels):
|
@@ -77,6 +78,40 @@ def find_one(schema, datasource=None, **labels):
|
|
77
78
|
|
78
79
|
|
79
80
|
def insert_docs(schema: str, docs: Union[list, dict, pd.DataFrame], datasource=None, dry=False):
|
81
|
+
# Currently stuck on how to deal with instances of schemas
|
82
|
+
if datasource == 'straxen_db': # switch to straxen_db
|
83
|
+
mongo_username = MongoDB().username
|
84
|
+
if mongo_username == 'corrections_expert':
|
85
|
+
# If statements only trigger
|
86
|
+
target_version = "ONLINE"
|
87
|
+
# Note to self: This is done in a very dumb way, fix later
|
88
|
+
ONLINE_check = True
|
89
|
+
if isinstance(docs, pd.DataFrame):
|
90
|
+
ONLINE_check = (docs['version'] == target_version).all()
|
91
|
+
|
92
|
+
elif isinstance(docs, dict):
|
93
|
+
ONLINE_check = all(item['version'] == target_version for item in docs)
|
94
|
+
|
95
|
+
else:
|
96
|
+
if isinstance(docs, list):
|
97
|
+
if isinstance(docs[0], list) or isinstance(docs[0], dict):
|
98
|
+
# It could be a list of dicts, or list or schemas...
|
99
|
+
# This can be an actual list or a list of docs
|
100
|
+
# these cannot be treated the same
|
101
|
+
ONLINE_check = all(item['version'] == target_version for item in docs)
|
102
|
+
else:
|
103
|
+
# This assumes the last choice is a schema, if not other things will yield errors?
|
104
|
+
# This is kinda sloppy...
|
105
|
+
ONLINE_check = all(item.version == target_version for item in docs)
|
106
|
+
elif hasattr(docs, 'version'):
|
107
|
+
if docs.version != target_version: # if version isnt ONLINE
|
108
|
+
ONLINE_check = False
|
109
|
+
else:
|
110
|
+
ONLINE_check = all(item.version == target_version for item in docs)
|
111
|
+
|
112
|
+
if not ONLINE_check:
|
113
|
+
raise ValueError("You are attempting to modify the a straxen_db correction whose version is not ONLINE")
|
114
|
+
|
80
115
|
if isinstance(docs, pd.DataFrame):
|
81
116
|
docs = docs.reset_index().to_dict(orient="records")
|
82
117
|
if not isinstance(docs, list):
|
@@ -125,13 +160,13 @@ def find_schema(name) -> Type[XeDoc]:
|
|
125
160
|
|
126
161
|
def get_accessor(schema, db=None):
|
127
162
|
import xedocs
|
128
|
-
|
163
|
+
|
129
164
|
schema = find_schema(schema)
|
130
165
|
if not issubclass(schema, XeDoc):
|
131
166
|
raise TypeError(
|
132
167
|
"Schema must be a subclass of XeDoc" "or the name of a known schema."
|
133
168
|
)
|
134
|
-
|
169
|
+
|
135
170
|
if db is None:
|
136
171
|
db = settings.DEFAULT_DATABASE
|
137
172
|
if isinstance(db, str):
|
@@ -169,7 +204,7 @@ def sync_dbs(from_db, to_db, schemas=None, dry=False):
|
|
169
204
|
|
170
205
|
if isinstance(from_db, str):
|
171
206
|
from_db = getattr(xedocs.databases, from_db)()
|
172
|
-
|
207
|
+
|
173
208
|
if isinstance(to_db, str):
|
174
209
|
to_db = getattr(xedocs.databases, to_db)()
|
175
210
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|