Skip to content

Commit 9a33e62

Browse files
committed
feat(DataMart): AdminAreaOfInterest only retrieves geostore ID
It used to grab the whole geostore and then just use the ID, which was wasteful.
1 parent 9bd4aaf commit 9a33e62

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

app/models/pydantic/datamart.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from app.models.pydantic.responses import Response
99

1010
from .base import StrictBaseModel
11-
from ...crud.geostore import build_gadm_geostore
11+
from ...crud.geostore import get_gadm_geostore_id
1212

1313

1414
class AreaOfInterest(StrictBaseModel, ABC):
@@ -35,16 +35,15 @@ class AdminAreaOfInterest(AreaOfInterest):
3535

3636
async def get_geostore_id(self) -> UUID:
3737
admin_level = sum(1 for field in (self.country, self.region, self.subregion) if field is not None) - 1
38-
geostore = await build_gadm_geostore(
38+
geostore_id = await get_gadm_geostore_id(
3939
admin_provider=self.provider,
4040
admin_version=self.version,
4141
adm_level=admin_level,
42-
simplify=None,
4342
country_id=self.country,
4443
region_id=self.region,
4544
subregion_id=self.subregion,
4645
)
47-
return UUID(geostore.id)
46+
return UUID(geostore_id)
4847

4948

5049
class AnalysisStatus(str, Enum):

0 commit comments

Comments
 (0)