cs-models 0.0.699__py3-none-any.whl → 0.0.701__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 cs-models might be problematic. Click here for more details.
- cs_models/resources/SalesEstimate/models.py +4 -0
- cs_models/resources/SalesEstimate/schemas.py +4 -0
- cs_models/resources/SalesEstimateCompany/models.py +38 -0
- cs_models/resources/SalesEstimateCompany/schemas.py +35 -0
- cs_models/resources/SalesEstimateCondition/models.py +41 -0
- cs_models/resources/SalesEstimateCondition/schemas.py +17 -0
- cs_models/resources/SalesEstimateIntervention/models.py +41 -0
- cs_models/resources/SalesEstimateIntervention/schemas.py +17 -0
- cs_models/resources/SalesEstimateTarget/models.py +41 -0
- cs_models/resources/SalesEstimateTarget/schemas.py +17 -0
- {cs_models-0.0.699.dist-info → cs_models-0.0.701.dist-info}/METADATA +1 -1
- {cs_models-0.0.699.dist-info → cs_models-0.0.701.dist-info}/RECORD +14 -14
- {cs_models-0.0.699.dist-info → cs_models-0.0.701.dist-info}/WHEEL +0 -0
- {cs_models-0.0.699.dist-info → cs_models-0.0.701.dist-info}/top_level.txt +0 -0
|
@@ -18,9 +18,13 @@ class SalesEstimateModel(Base):
|
|
|
18
18
|
id = Column(Integer, primary_key=True)
|
|
19
19
|
fiscal_year = Column(Integer, nullable=True)
|
|
20
20
|
request_id = Column(String(20), nullable=True)
|
|
21
|
+
metric = Column(String(50), nullable=True)
|
|
21
22
|
drug_name = Column(String(128), nullable=False, index=True),
|
|
23
|
+
company_name = Column(String(128), nullable=True, index=True),
|
|
22
24
|
currency = Column(String(20), nullable=True)
|
|
23
25
|
fiscal_end_date = Column(DateTime, nullable=True)
|
|
26
|
+
estimate_date = Column(DateTime, nullable=True)
|
|
27
|
+
estimate_count = Column(Integer, nullable=True)
|
|
24
28
|
mean = Column(DECIMAL(13, 2), nullable=True)
|
|
25
29
|
median = Column(DECIMAL(13, 2), nullable=True)
|
|
26
30
|
sd = Column(Float, nullable=True)
|
|
@@ -11,9 +11,13 @@ class SalesEstimateResourceSchema(Schema):
|
|
|
11
11
|
id = fields.Integer(dump_only=True)
|
|
12
12
|
fiscal_year = fields.Integer(allow_none=True)
|
|
13
13
|
request_id = fields.String(allow_none=True)
|
|
14
|
+
metric = fields.String(allow_none=True)
|
|
14
15
|
drug_name = fields.String(required=True)
|
|
16
|
+
company_name = fields.String(allow_none=True)
|
|
15
17
|
currency = fields.String(allow_none=True)
|
|
16
18
|
fiscal_end_date = fields.DateTime(allow_none=True)
|
|
19
|
+
estimate_date = fields.DateTime(allow_none=True)
|
|
20
|
+
estimate_count = fields.Integer(allow_none=True)
|
|
17
21
|
mean = fields.Decimal(allow_none=True)
|
|
18
22
|
median = fields.Decimal(allow_none=True)
|
|
19
23
|
sd = fields.Float(allow_none=True)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from sqlalchemy import (
|
|
2
|
+
Column,
|
|
3
|
+
Integer,
|
|
4
|
+
DateTime,
|
|
5
|
+
ForeignKey,
|
|
6
|
+
)
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
|
|
9
|
+
from ...database import Base
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SalesEstimateCompanyModel(Base):
|
|
13
|
+
__tablename__ = 'sales_estimate_companies'
|
|
14
|
+
|
|
15
|
+
id = Column(Integer, primary_key=True)
|
|
16
|
+
company_sec_id = Column(
|
|
17
|
+
Integer,
|
|
18
|
+
ForeignKey('companies_sec.id'),
|
|
19
|
+
nullable=True,
|
|
20
|
+
)
|
|
21
|
+
company_ous_id = Column(
|
|
22
|
+
Integer,
|
|
23
|
+
ForeignKey('companies_ous.id'),
|
|
24
|
+
nullable=True,
|
|
25
|
+
)
|
|
26
|
+
sales_estimate_id = Column(
|
|
27
|
+
Integer,
|
|
28
|
+
ForeignKey('sales_estimates.id'),
|
|
29
|
+
nullable=False,
|
|
30
|
+
)
|
|
31
|
+
date = Column(DateTime, nullable=True)
|
|
32
|
+
updated_at = Column(
|
|
33
|
+
DateTime,
|
|
34
|
+
nullable=False,
|
|
35
|
+
# https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
|
|
36
|
+
default=lambda: datetime.utcnow(),
|
|
37
|
+
onupdate=lambda: datetime.utcnow(),
|
|
38
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from marshmallow import (
|
|
2
|
+
Schema,
|
|
3
|
+
fields,
|
|
4
|
+
validate,
|
|
5
|
+
pre_load,
|
|
6
|
+
ValidationError,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SalesEstimateCompanyResourceSchema(Schema):
|
|
11
|
+
not_blank = validate.Length(min=1, error='Field cannot be blank')
|
|
12
|
+
|
|
13
|
+
id = fields.Integer(dump_only=True)
|
|
14
|
+
sales_estimate_id = fields.Integer(required=True)
|
|
15
|
+
company_sec_id = fields.Integer(allow_none=True)
|
|
16
|
+
company_ous_id = fields.Integer(allow_none=True)
|
|
17
|
+
date = fields.DateTime(allow_none=True)
|
|
18
|
+
updated_at = fields.DateTime(dump_only=True)
|
|
19
|
+
|
|
20
|
+
@pre_load
|
|
21
|
+
def check_company_ids(self, in_data, **kwargs):
|
|
22
|
+
if self._get_number_of_company_fields(in_data) > 1:
|
|
23
|
+
raise ValidationError('Provide either company_sec_id or '
|
|
24
|
+
'company_ous_id, not both')
|
|
25
|
+
return in_data
|
|
26
|
+
|
|
27
|
+
def _get_number_of_company_fields(self, in_data, **kwargs):
|
|
28
|
+
result = 0
|
|
29
|
+
if 'company_sec_id' in in_data:
|
|
30
|
+
if in_data['company_sec_id'] is not None:
|
|
31
|
+
result += 1
|
|
32
|
+
if 'company_ous_id' in in_data:
|
|
33
|
+
if in_data['company_ous_id'] is not None:
|
|
34
|
+
result += 1
|
|
35
|
+
return result
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import (
|
|
4
|
+
Column,
|
|
5
|
+
Integer,
|
|
6
|
+
DateTime,
|
|
7
|
+
ForeignKey,
|
|
8
|
+
Float,
|
|
9
|
+
Boolean,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from ...database import Base
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SalesEstimateConditionModel(Base):
|
|
16
|
+
__tablename__ = "sales_estimate_conditions"
|
|
17
|
+
|
|
18
|
+
id = Column(Integer, primary_key=True)
|
|
19
|
+
sales_estimate_id = Column(
|
|
20
|
+
Integer,
|
|
21
|
+
ForeignKey('sales_estimates.id'),
|
|
22
|
+
nullable=False,
|
|
23
|
+
)
|
|
24
|
+
condition_id = Column(
|
|
25
|
+
Integer,
|
|
26
|
+
ForeignKey('conditions.id'),
|
|
27
|
+
nullable=False,
|
|
28
|
+
)
|
|
29
|
+
score = Column(
|
|
30
|
+
Float,
|
|
31
|
+
nullable=False,
|
|
32
|
+
)
|
|
33
|
+
preferred = Column(Boolean, nullable=True)
|
|
34
|
+
date = Column(DateTime, nullable=True)
|
|
35
|
+
updated_at = Column(
|
|
36
|
+
DateTime,
|
|
37
|
+
nullable=False,
|
|
38
|
+
# https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
|
|
39
|
+
default=lambda: datetime.utcnow(),
|
|
40
|
+
onupdate=lambda: datetime.utcnow(),
|
|
41
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from marshmallow import (
|
|
2
|
+
Schema,
|
|
3
|
+
fields,
|
|
4
|
+
validate,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SalesEstimateConditionResourceSchema(Schema):
|
|
9
|
+
not_blank = validate.Length(min=1, error='Field cannot be blank')
|
|
10
|
+
|
|
11
|
+
id = fields.Integer(dump_only=True)
|
|
12
|
+
sales_estimate_id = fields.Integer(required=True)
|
|
13
|
+
condition_id = fields.Integer(required=True)
|
|
14
|
+
score = fields.Float(required=True)
|
|
15
|
+
preferred = fields.Boolean(allow_none=True)
|
|
16
|
+
date = fields.DateTime(allow_none=True)
|
|
17
|
+
updated_at = fields.DateTime()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import (
|
|
4
|
+
Column,
|
|
5
|
+
Integer,
|
|
6
|
+
DateTime,
|
|
7
|
+
ForeignKey,
|
|
8
|
+
Boolean,
|
|
9
|
+
Float,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from ...database import Base
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SalesEstimateInterventionModel(Base):
|
|
16
|
+
__tablename__ = "sales_estimate_interventions"
|
|
17
|
+
|
|
18
|
+
id = Column(Integer, primary_key=True)
|
|
19
|
+
sales_estimate_id = Column(
|
|
20
|
+
Integer,
|
|
21
|
+
ForeignKey('sales_estimates.id'),
|
|
22
|
+
nullable=False,
|
|
23
|
+
)
|
|
24
|
+
intervention_id = Column(
|
|
25
|
+
Integer,
|
|
26
|
+
ForeignKey('interventions.id'),
|
|
27
|
+
nullable=False,
|
|
28
|
+
)
|
|
29
|
+
score = Column(
|
|
30
|
+
Float,
|
|
31
|
+
nullable=False,
|
|
32
|
+
)
|
|
33
|
+
preferred = Column(Boolean, nullable=True)
|
|
34
|
+
date = Column(DateTime, nullable=True)
|
|
35
|
+
updated_at = Column(
|
|
36
|
+
DateTime,
|
|
37
|
+
nullable=False,
|
|
38
|
+
# https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
|
|
39
|
+
default=lambda: datetime.utcnow(),
|
|
40
|
+
onupdate=lambda: datetime.utcnow(),
|
|
41
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from marshmallow import (
|
|
2
|
+
Schema,
|
|
3
|
+
fields,
|
|
4
|
+
validate,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SalesEstimateInterventionResourceSchema(Schema):
|
|
9
|
+
not_blank = validate.Length(min=1, error='Field cannot be blank')
|
|
10
|
+
|
|
11
|
+
id = fields.Integer(dump_only=True)
|
|
12
|
+
sales_estimate_id = fields.Integer(required=True)
|
|
13
|
+
intervention_id = fields.Integer(required=True)
|
|
14
|
+
score = fields.Float(required=True)
|
|
15
|
+
preferred = fields.Boolean(allow_none=True)
|
|
16
|
+
date = fields.DateTime(allow_none=True)
|
|
17
|
+
updated_at = fields.DateTime()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import (
|
|
4
|
+
Column,
|
|
5
|
+
Integer,
|
|
6
|
+
DateTime,
|
|
7
|
+
ForeignKey,
|
|
8
|
+
Float,
|
|
9
|
+
Boolean,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from ...database import Base
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SalesEstimateTargetModel(Base):
|
|
16
|
+
__tablename__ = "sales_estimate_targets"
|
|
17
|
+
|
|
18
|
+
id = Column(Integer, primary_key=True)
|
|
19
|
+
sales_estimate_id = Column(
|
|
20
|
+
Integer,
|
|
21
|
+
ForeignKey('sales_estimates.id'),
|
|
22
|
+
nullable=False,
|
|
23
|
+
)
|
|
24
|
+
target_id = Column(
|
|
25
|
+
Integer,
|
|
26
|
+
ForeignKey('targets.id'),
|
|
27
|
+
nullable=False,
|
|
28
|
+
)
|
|
29
|
+
score = Column(
|
|
30
|
+
Float,
|
|
31
|
+
nullable=False,
|
|
32
|
+
)
|
|
33
|
+
preferred = Column(Boolean, nullable=True)
|
|
34
|
+
date = Column(DateTime, nullable=True)
|
|
35
|
+
updated_at = Column(
|
|
36
|
+
DateTime,
|
|
37
|
+
nullable=False,
|
|
38
|
+
# https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
|
|
39
|
+
default=lambda: datetime.utcnow(),
|
|
40
|
+
onupdate=lambda: datetime.utcnow(),
|
|
41
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from marshmallow import (
|
|
2
|
+
Schema,
|
|
3
|
+
fields,
|
|
4
|
+
validate,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SalesEstimateTargetResourceSchema(Schema):
|
|
9
|
+
not_blank = validate.Length(min=1, error='Field cannot be blank')
|
|
10
|
+
|
|
11
|
+
id = fields.Integer(dump_only=True)
|
|
12
|
+
sales_estimate_id = fields.Integer(required=True)
|
|
13
|
+
target_id = fields.Integer(required=True)
|
|
14
|
+
score = fields.Float(required=True)
|
|
15
|
+
preferred = fields.Boolean(allow_none=True)
|
|
16
|
+
date = fields.DateTime(allow_none=True)
|
|
17
|
+
updated_at = fields.DateTime()
|
|
@@ -861,20 +861,20 @@ cs_models/resources/Sales/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
861
861
|
cs_models/resources/Sales/models.py,sha256=gJeTtpVVKo3OKb5fYRuxdLorPrXV7RJh4b0-YFIywDg,954
|
|
862
862
|
cs_models/resources/Sales/schemas.py,sha256=GTA2CNBOxn65mUornpk2eGM4exkPm7W7zO1ZJ4yiLW8,559
|
|
863
863
|
cs_models/resources/SalesEstimate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
864
|
-
cs_models/resources/SalesEstimate/models.py,sha256=
|
|
865
|
-
cs_models/resources/SalesEstimate/schemas.py,sha256=
|
|
864
|
+
cs_models/resources/SalesEstimate/models.py,sha256=h_pZ9FKjVyb7JFPH45wuNQDyYGJw_t7A0LjtbVgU_24,1272
|
|
865
|
+
cs_models/resources/SalesEstimate/schemas.py,sha256=T-he-qQw7mAfbCfoYWG08YhHAofaCSuPp8fdkSaIA1I,913
|
|
866
866
|
cs_models/resources/SalesEstimateCompany/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
867
|
-
cs_models/resources/SalesEstimateCompany/models.py,sha256=
|
|
868
|
-
cs_models/resources/SalesEstimateCompany/schemas.py,sha256=
|
|
867
|
+
cs_models/resources/SalesEstimateCompany/models.py,sha256=wnbMVuQKVv08B-_VOgGtqHgToTbmfTCjdUxPW0Nkcuo,940
|
|
868
|
+
cs_models/resources/SalesEstimateCompany/schemas.py,sha256=EOPE_FWKffdM2i_l-PzhD4wEo9pV7PQZtz9EVehNIBw,1149
|
|
869
869
|
cs_models/resources/SalesEstimateCondition/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
870
|
-
cs_models/resources/SalesEstimateCondition/models.py,sha256=
|
|
871
|
-
cs_models/resources/SalesEstimateCondition/schemas.py,sha256=
|
|
870
|
+
cs_models/resources/SalesEstimateCondition/models.py,sha256=ItKOmBwVe_MyTIUyHFrDdXFV0Vz-FNyevATMdn25AXM,961
|
|
871
|
+
cs_models/resources/SalesEstimateCondition/schemas.py,sha256=GnF9hThDzpExhFf86V9-cLxzT4pNSgSSvKKs0IFqLbs,501
|
|
872
872
|
cs_models/resources/SalesEstimateIntervention/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
873
|
-
cs_models/resources/SalesEstimateIntervention/models.py,sha256=
|
|
874
|
-
cs_models/resources/SalesEstimateIntervention/schemas.py,sha256=
|
|
873
|
+
cs_models/resources/SalesEstimateIntervention/models.py,sha256=4oAbpjc5D27WZaVT4D5BfB3hnc_DQg3VEL8o8ld6bXI,973
|
|
874
|
+
cs_models/resources/SalesEstimateIntervention/schemas.py,sha256=RQXJiNwPRdWkuBp_0oK9RqpZMiKMMxrBcLuuEokhm08,507
|
|
875
875
|
cs_models/resources/SalesEstimateTarget/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
876
|
-
cs_models/resources/SalesEstimateTarget/models.py,sha256=
|
|
877
|
-
cs_models/resources/SalesEstimateTarget/schemas.py,sha256=
|
|
876
|
+
cs_models/resources/SalesEstimateTarget/models.py,sha256=1VKRqnIbN1ldk-UGw4TxmhzRHC-qa4ArxpkYLnkRuYk,949
|
|
877
|
+
cs_models/resources/SalesEstimateTarget/schemas.py,sha256=94kjvgpavcEkvJ9RABMo9w7lRsUgrcWHs5I9-ewCq7A,495
|
|
878
878
|
cs_models/resources/SalesProductsMap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
879
879
|
cs_models/resources/SalesProductsMap/models.py,sha256=kObHYA2q2wNY8QTqZd0mP5nSdFGoqnXRwlzOSSjvdK8,858
|
|
880
880
|
cs_models/resources/SalesProductsMap/schemas.py,sha256=zocpRe3by4_wUKwy-Cp2I190-scyG9wbgjZs37Je728,401
|
|
@@ -1162,7 +1162,7 @@ cs_models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
1162
1162
|
cs_models/utils/alchemy.py,sha256=fhINGFn41owJ2DLXQKXAAtLqeZ1BRzD_qU0wPK_bsGQ,1598
|
|
1163
1163
|
cs_models/utils/utils.py,sha256=bY623DuzycfPQiaOQT2AxfANeWfwr5w76dBuQ813-ns,3664
|
|
1164
1164
|
cs_models/utils/profiling/__init__.py,sha256=N-73vb0M92C975fxgXyBCBjCPELl8Oh21ZY_-tzDnns,569
|
|
1165
|
-
cs_models-0.0.
|
|
1166
|
-
cs_models-0.0.
|
|
1167
|
-
cs_models-0.0.
|
|
1168
|
-
cs_models-0.0.
|
|
1165
|
+
cs_models-0.0.701.dist-info/METADATA,sha256=1ugB4y9IEIRpLg5Qw1vpSm6vFfMRQnupv9BNxFx3ivE,792
|
|
1166
|
+
cs_models-0.0.701.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
1167
|
+
cs_models-0.0.701.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
|
|
1168
|
+
cs_models-0.0.701.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|