Skip to content

Commit 40123bf

Browse files
committed
add instructions to cmr_to_models and destination_server field
1 parent 63afa9d commit 40123bf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/ej/cmr_to_models.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""
2+
the ej_dump is generated by running create_ej_dump.py and is scp'd to the COSMOS server
3+
this script is then run via the dm shell on the COSMOS server to populate the database
4+
"""
5+
16
import json
27

38
from environmental_justice.models import EnvironmentalJusticeRow
@@ -28,6 +33,7 @@ def sinequa_id_to_url(sinequa_id: str) -> str:
2833

2934

3035
def categorize_processing_level(level):
36+
3137
advanced_analysis_levels = {"0", "Level 0", "NA", "Not Provided", "Not provided"}
3238

3339
basic_analysis_levels = {
@@ -62,16 +68,17 @@ def categorize_processing_level(level):
6268
return "unknown"
6369

6470

65-
ej_dump = json.load(open("ej_dump_20240814_143036.json"))
71+
ej_dump = json.load(open("scripts/ej/ej_dump_20240814_143036.json"))
6672
for dataset in ej_dump:
6773
ej_row = EnvironmentalJusticeRow(
74+
destination_server=EnvironmentalJusticeRow.DestinationServerChoices.DEV,
6875
sde_link=sinequa_id_to_url(concept_id_to_sinequa_id(dataset.get("meta", {}).get("concept-id", ""))),
6976
dataset=dataset.get("umm", {}).get("ShortName", ""),
7077
description=dataset.get("umm", {}).get("Abstract", ""),
7178
limitations=dataset.get("umm", {}).get("AccessConstraints", {}).get("Description", ""),
7279
format=dataset.get("meta", {}).get("format", ""),
7380
temporal_extent=", ".join(dataset.get("umm", {}).get("TemporalExtents", [{}])[0].get("SingleDateTimes", [])),
74-
intended_use=categorize_processing_level(dataset.get("umm", {}).get("ProcessingLevel")),
81+
intended_use=categorize_processing_level(dataset.get("umm", {}).get("ProcessingLevel", {}).get("Id", "")),
7582
source_link=generate_source_link(dataset.get("umm", {}).get("DOI", {})),
7683
indicators=dataset["indicators"], # Not provided in the data
7784
geographic_coverage="", # Not provided in the data

0 commit comments

Comments
 (0)