Skip to content

Commit

Permalink
Rename summary,summaries to overview,overviews.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwiker committed Dec 4, 2023
1 parent dc1ac7f commit dfcebd8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/fmu/sumo/explorer/objects/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
class Case(Document):
"""Class for representing a case in Sumo"""

def __init__(self, sumo: SumoClient, metadata: Dict, summary: Dict,
def __init__(self, sumo: SumoClient, metadata: Dict, overview: Dict,
pit: Pit = None):
super().__init__(metadata)
self._summary = summary
self._overview = overview
self._pit = pit
self._sumo = sumo
self._utils = Utils(sumo)
Expand All @@ -31,9 +31,9 @@ def name(self) -> str:
return self._get_property(["fmu", "case", "name"])

@property
def summary(self):
"""Summary of case contents."""
return self._summary
def overview(self):
"""Overview of case contents."""
return self._overview

@property
def status(self) -> str:
Expand Down
24 changes: 12 additions & 12 deletions src/fmu/sumo/explorer/objects/case_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"exclude": []
}

def _make_summary_query(ids, pit):
def _make_overview_query(ids, pit):
query = {
"query": {
"terms": {
Expand Down Expand Up @@ -92,7 +92,7 @@ def __init__(self, sumo: SumoClient, query: Dict = None, pit: Pit = None):
pit (Pit): point in time
"""
super().__init__("case", sumo, query, _CASE_FIELDS, pit)
self._summaries = {}
self._overviews = {}

@property
def names(self) -> List[str]:
Expand Down Expand Up @@ -151,34 +151,34 @@ async def fields_async(self) -> List[str]:
def __getitem__(self, index: int) -> Case:
doc = super().__getitem__(index)
uuid = doc["_id"]
summary = self._summaries[uuid]
return Case(self._sumo, doc, summary, self._pit)
overview = self._overviews[uuid]
return Case(self._sumo, doc, overview, self._pit)

async def getitem_async(self, index: int) -> Case:
doc = await super().getitem_async(index)
uuid = doc["_id"]
summary = self._summaries[uuid]
return Case(self._sumo, doc, summary, self._pit)
overview = self._overviews[uuid]
return Case(self._sumo, doc, overview, self._pit)

def _postprocess_batch(self, hits, pit):
ids = [hit["_id"] for hit in hits]
query = _make_summary_query(ids, pit)
query = _make_overview_query(ids, pit)
res = self._sumo.post("/search", json=query)
data = res.json()
aggs = data["aggregations"]
self._insert_summaries(aggs)
self._insert_overviews(aggs)
return

async def _postprocess_batch_async(self, hits, pit):
ids = [hit["_id"] for hit in hits]
query = _make_summary_query(ids, pit)
query = _make_overview_query(ids, pit)
res = await self._sumo.post_async("/search", json=query)
data = res.json()
aggs = data["aggregations"]
self._insert_summaries(aggs)
self._insert_overviews(aggs)
return

def _insert_summaries(self, aggs):
def _insert_overviews(self, aggs):
def extract_bucket_keys(bucket, name):
return [b["key"] for b in bucket[name]["buckets"]]
for bucket in aggs["cases"]["buckets"]:
Expand All @@ -199,7 +199,7 @@ def extract_bucket_keys(bucket, name):
"maxreal": maxreal,
"numreal": numreal
}
self._summaries[caseid] = {
self._overviews[caseid] = {
"iteration_names": iteration_names,
"iteration_uuids": iteration_uuids,
"data_types": data_types,
Expand Down

0 comments on commit dfcebd8

Please sign in to comment.