streamlit-octostar-utils 0.2.10__py3-none-any.whl → 0.2.12__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.
- streamlit_octostar_utils/api_crafter/nifi.py +15 -14
- streamlit_octostar_utils/ontology/inheritance.py +13 -0
- {streamlit_octostar_utils-0.2.10.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/METADATA +1 -1
- {streamlit_octostar_utils-0.2.10.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/RECORD +6 -6
- {streamlit_octostar_utils-0.2.10.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/WHEEL +1 -1
- {streamlit_octostar_utils-0.2.10.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/licenses/LICENSE +0 -0
@@ -23,7 +23,7 @@ from octostar.client import make_client
|
|
23
23
|
from ..core.dict import recursive_update_dict, travel_dict, jsondict_hash
|
24
24
|
from ..core.timestamp import now, string_to_datetime
|
25
25
|
from .fastapi import DefaultErrorRoute, Route
|
26
|
-
from ..ontology.inheritance import is_child_concept as is_child_concept_fn
|
26
|
+
from ..ontology.inheritance import is_child_concept as is_child_concept_fn, get_label_keys
|
27
27
|
from ..ontology.expand_entities import expand_entities
|
28
28
|
|
29
29
|
RELATIONSHIP_ENTITY_NAME = "os_relationship"
|
@@ -69,6 +69,7 @@ class NifiEntityModel(BaseModel):
|
|
69
69
|
class OntologyInfoModel(BaseModel):
|
70
70
|
parents: List[str]
|
71
71
|
relationships: List[str]
|
72
|
+
label_keys: List[str]
|
72
73
|
|
73
74
|
class ContentsPointerModel(BaseModel):
|
74
75
|
location: NifiContentsPointerLocationModel
|
@@ -806,15 +807,8 @@ class NifiEntity(object):
|
|
806
807
|
|
807
808
|
@property
|
808
809
|
def label(self):
|
809
|
-
|
810
|
-
|
811
|
-
label_fields = self.context.ontology["concepts"][
|
812
|
-
self.record.get("os_concept") or self.record.get("entity_type")
|
813
|
-
]["labelKeys"]
|
814
|
-
label_fields = [field for field in label_fields if field]
|
815
|
-
label = " ".join(
|
816
|
-
[(self.record.get(field) or "") for field in label_fields]
|
817
|
-
).strip()
|
810
|
+
label_keys = self.request["ontology_info"]["label_keys"]
|
811
|
+
label = " ".join([(self.record.get(field) or "") for field in label_keys]).strip()
|
818
812
|
if not label:
|
819
813
|
label = None
|
820
814
|
return label
|
@@ -923,14 +917,21 @@ class NifiEntity(object):
|
|
923
917
|
now_time = now()
|
924
918
|
random_id = str(uuid.uuid4())
|
925
919
|
username = self.jwt_data["username"]
|
920
|
+
if entity_type == self.record["entity_type"]:
|
921
|
+
ont_parents = self.request["ontology_info"]["parents"]
|
922
|
+
ont_relationships = self.request["ontology_info"]["relationships"]
|
923
|
+
ont_label_keys = self.request["ontology_info"]["label_keys"]
|
924
|
+
else:
|
925
|
+
ont_parents = self.context.ontology["concepts"][entity_type]["parents"]
|
926
|
+
ont_relationships = self.context.ontology["concepts"][entity_type]["relationships"]
|
927
|
+
ont_label_keys = get_label_keys(entity_type, self.context.ontology)
|
926
928
|
child_request = {
|
927
929
|
"jwt": self.request["jwt"],
|
928
930
|
"ontology_name": self.request["ontology_name"],
|
929
931
|
"ontology_info": {
|
930
|
-
"parents":
|
931
|
-
"relationships":
|
932
|
-
|
933
|
-
],
|
932
|
+
"parents": ont_parents,
|
933
|
+
"relationships": ont_relationships,
|
934
|
+
"label_keys": ont_label_keys,
|
934
935
|
},
|
935
936
|
"entity_timestamp": None,
|
936
937
|
"sync_params": {},
|
@@ -1,2 +1,15 @@
|
|
1
1
|
def is_child_concept(type, parent_type, ontology):
|
2
2
|
return type == parent_type or parent_type in ontology["concepts"][type]["parents"]
|
3
|
+
|
4
|
+
def get_label_keys(type, ontology):
|
5
|
+
parents = set(ontology["concepts"][type]["parents"])
|
6
|
+
parents.add(type)
|
7
|
+
parents = list(parents)
|
8
|
+
parents.reverse()
|
9
|
+
label_keys = {} # for guaranteed insertion order
|
10
|
+
for parent in parents:
|
11
|
+
for label_key in ontology["concepts"][parent]["labelKeys"]:
|
12
|
+
if not label_key:
|
13
|
+
continue
|
14
|
+
label_keys[label_key] = None
|
15
|
+
return list(label_keys.keys())
|
{streamlit_octostar_utils-0.2.10.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/RECORD
RENAMED
@@ -2,7 +2,7 @@ streamlit_octostar_utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-Y
|
|
2
2
|
streamlit_octostar_utils/api_crafter/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
3
3
|
streamlit_octostar_utils/api_crafter/celery.py,sha256=BXOTGN9egdD75qf-PkccLGAoniilB9PZ_NRchFIjWdw,30051
|
4
4
|
streamlit_octostar_utils/api_crafter/fastapi.py,sha256=RKQrStPzG1I1pxsPJvGs_DRrnjlMJbVmu9ObMF2LgZ0,14368
|
5
|
-
streamlit_octostar_utils/api_crafter/nifi.py,sha256=
|
5
|
+
streamlit_octostar_utils/api_crafter/nifi.py,sha256=6PSWIFKjv8nzlFGH9IFRI3VrYsISNjDIPyi1RvLJoKk,45810
|
6
6
|
streamlit_octostar_utils/api_crafter/parser/__init__.py,sha256=YeYWF6sdQiCFV_RKNW2t9Vs6KJExE2pbXxWTe_DOayY,107
|
7
7
|
streamlit_octostar_utils/api_crafter/parser/combine_fields.py,sha256=ddc44xkajw8MU0peAX_263DL7rPXbTKbHUjpOhRgvyU,8790
|
8
8
|
streamlit_octostar_utils/api_crafter/parser/entities_parser.py,sha256=zOQoN-p1Gz6ZzxvoX4M1b4Fi3mfmQr5zaNUcp_8gCjw,30016
|
@@ -28,7 +28,7 @@ streamlit_octostar_utils/octostar/context.py,sha256=TpucK48EbeVy4vDqKd9UULEtr1JO
|
|
28
28
|
streamlit_octostar_utils/octostar/permissions.py,sha256=G5nZQLR-k-5_Xeto4nDTb32828Ga-SHm1mvSB9tz-t4,1565
|
29
29
|
streamlit_octostar_utils/ontology/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
30
30
|
streamlit_octostar_utils/ontology/expand_entities.py,sha256=bBt32Dnts3VSzu13QQtPyfYe05IRodD9WfnhNTiBg_w,22749
|
31
|
-
streamlit_octostar_utils/ontology/inheritance.py,sha256=
|
31
|
+
streamlit_octostar_utils/ontology/inheritance.py,sha256=8GA2an1hbHfa6p993tIyfFLrewJHRUIFOw7dmvL8geU,583
|
32
32
|
streamlit_octostar_utils/ontology/validation.py,sha256=0cXxEq8vQ63qxn4WianTioTcsmpsg4jEXVyI4R6x1gE,1051
|
33
33
|
streamlit_octostar_utils/style/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
34
34
|
streamlit_octostar_utils/style/common.py,sha256=TKfjV9-sIoJChGM7Ewg3uPsz5sMmPxFwmc0o3L4D8Qo,1496
|
@@ -36,7 +36,7 @@ streamlit_octostar_utils/threading/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzp
|
|
36
36
|
streamlit_octostar_utils/threading/async_task_manager.py,sha256=q7N6YZwUvIYMzkSHmsJNheNVCv93c03H6Hyg9uH8pvk,4747
|
37
37
|
streamlit_octostar_utils/threading/session_callback_manager.py,sha256=LvZVP4g6tvKtYmI13f2j1sX_7hm61Groqp5xJine9_k,3973
|
38
38
|
streamlit_octostar_utils/threading/session_state_hot_swapper.py,sha256=6eeCQI6A42hp4DmW2NQw2rbeR-k9N8DhfBKQdN_fbLU,811
|
39
|
-
streamlit_octostar_utils-0.2.
|
40
|
-
streamlit_octostar_utils-0.2.
|
41
|
-
streamlit_octostar_utils-0.2.
|
42
|
-
streamlit_octostar_utils-0.2.
|
39
|
+
streamlit_octostar_utils-0.2.12.dist-info/METADATA,sha256=F_7r20YG6UyKEMKxD4yxdm6vs7xbBeW0hakEMAI6kwg,2330
|
40
|
+
streamlit_octostar_utils-0.2.12.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
41
|
+
streamlit_octostar_utils-0.2.12.dist-info/licenses/LICENSE,sha256=dkwVPyV03fPHHtERnF6RnvRXcll__tud9gWca1RcgnQ,1073
|
42
|
+
streamlit_octostar_utils-0.2.12.dist-info/RECORD,,
|
File without changes
|