Skip to content

Commit

Permalink
adding enums
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaeng72 committed Oct 25, 2024
1 parent 9174681 commit 1845d8d
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 28 deletions.
2 changes: 1 addition & 1 deletion common-app-lib/src/cmr/common_app/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(defconfig collection-umm-version
"Defines the latest collection umm version accepted by ingest - it's the latest official version.
This environment variable needs to be manually set when newer UMM version becomes official"
{:default "1.18.1"})
{:default "1.18.2"})

(defconfig launchpad-token-enforced
"Flag for whether or not launchpad token is enforced."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"$ref": "umm-cmn-json-schema.json#/definitions/EntryTitleType"
},
"DOI": {
"description": "This element stores the DOI (Digital Object Identifier) that identifies the collection. Note: The values should start with the directory indicator which in ESDIS' case is 10. If the DOI was registered through ESDIS, the beginning of the string should be 10.5067. The DOI URL is not stored here; it should be stored as a RelatedURL. The DOI organization that is responsible for creating the DOI is described in the Authority element. For ESDIS records the value of https://doi.org/ should be used. For those that want to specify that a DOI is not applicable or unknown use the second option.",
"$ref": "umm-cmn-json-schema.json#/definitions/DoiType"
"description": "This element stores the DOI (Digital Object Identifier) that identifies the collection. Note: The values should start with the directory indicator which in ESDIS' case is 10. If the DOI was registered through ESDIS, the beginning of the string should be 10.5067. The DOI URL is not stored here; it should be stored as a RelatedURL. The DOI organization that is responsible for creating the DOI is described in the Authority element. For ESDIS records the value of https://doi.org/ should be used. For those that want to specify that a DOI is not applicable or unknown use the second option.",
"$ref": "umm-cmn-json-schema.json#/definitions/DoiType"
},
"OtherIdentifiers": {
"description": "Provides additional or provider defined identifiers of the collection.",
Expand Down Expand Up @@ -318,10 +318,10 @@
"type": "boolean"
},
"EULAIdentifierType": {
"description": "Allows an End User License Agreement to be associated with a collection. This allows a service to check if an end user has accepted a EULA for this collection (data set) before it will allow data to be downloaded or used.",
"type": "string",
"minLength": 1,
"maxLength": 40
"description": "Allows an End User License Agreement to be associated with a collection. This allows a service to check if an end user has accepted a EULA for this collection (data set) before it will allow data to be downloaded or used.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"UseConstraintsType": {
"description": "This element defines how the data may or may not be used after access is granted to assure the protection of privacy or intellectual property. This includes license text, license URL, or any special restrictions, legal prerequisites, terms and conditions, and/or limitations on using the data set. Data providers may request acknowledgement of the data from users and claim no responsibility for quality and completeness of data.",
Expand All @@ -343,7 +343,7 @@
"items": {
"$ref": "#/definitions/EULAIdentifierType"
},
"minItems": 1
"minItems": 1
}
},
"required": ["Description"]
Expand All @@ -355,7 +355,7 @@
"properties": {
"Description": {
"$ref": "#/definitions/UseConstraintsDescType"
},
},
"LicenseURL": {
"description": "This element holds the URL and associated information to access the License on the web. If this element is used the LicenseText element cannot be used.",
"$ref": "umm-cmn-json-schema.json#/definitions/OnlineResourceType"
Expand All @@ -369,7 +369,7 @@
"items": {
"$ref": "#/definitions/EULAIdentifierType"
},
"minItems": 1
"minItems": 1
}
},
"required": ["LicenseURL"]
Expand Down Expand Up @@ -397,12 +397,12 @@
"items": {
"$ref": "#/definitions/EULAIdentifierType"
},
"minItems": 1
"minItems": 1
}
},
"required": ["LicenseText"]
}
]},
]},
"DirectoryNameType": {
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -1417,7 +1417,7 @@
"CollectionProgressEnum": {
"description": "This element describes the production status of the data set. There are five choices for Data Providers: PLANNED refers to data sets to be collected in the future and are thus unavailable at the present time. For Example: The Hydro spacecraft has not been launched, but information on planned data sets may be available. ACTIVE refers to data sets currently in production or data that is continuously being collected or updated. For Example: data from the AIRS instrument on Aqua is being collected continuously. COMPLETE refers to data sets in which no updates or further data collection will be made. For Example: Nimbus-7 SMMR data collection has been completed. DEPRECATED refers to data sets that have been retired, but still can be retrieved. Usually newer products exist that replace the retired data set. NOT APPLICABLE refers to data sets in which a collection progress is not applicable such as a calibration collection. There is a sixth value of NOT PROVIDED that should not be used by a data provider. It is currently being used as a value when a correct translation cannot be done with the current valid values, or when the value is not provided by the data provider.",
"type": "string",
"enum": ["ACTIVE", "PLANNED", "COMPLETE", "DEPRECATED", "NOT APPLICABLE", "NOT PROVIDED"]
"enum": ["ACTIVE", "PLANNED", "COMPLETE", "DEPRECATED", "NOT PROVIDED", "PREPRINT", "INREVIEW", "SUPERSEDED"]
},
"LocationKeywordType": {
"description": "This element defines a hierarchical location list. It replaces SpatialKeywords. The controlled vocabulary for location keywords is maintained in the Keyword Management System (KMS). Each tier must have data in the tier above it.",
Expand All @@ -1427,11 +1427,11 @@
"Category":{
"description": "Top-level controlled keyword hierarchical level that contains the largest general location where the collection data was taken from.",
"$ref": "umm-cmn-json-schema.json#/definitions/KeywordStringType"
},
},
"Type":{
"description": "Second-tier controlled keyword hierarchical level that contains the regional location where the collection data was taken from",
"$ref": "umm-cmn-json-schema.json#/definitions/KeywordStringType"
},
},
"Subregion1":{
"description": "Third-tier controlled keyword hierarchical level that contains the regional sub-location where the collection data was taken from",
"$ref": "umm-cmn-json-schema.json#/definitions/KeywordStringType"
Expand Down Expand Up @@ -1811,7 +1811,7 @@
"Type": {
"description": "This element describes to what DOI is associated.",
"type": "string",
"enum": ["Child Dataset", "Collaborative/Other Agency", "Field Campaign", "Parent Dataset", "Related Dataset"]
"enum": ["Child Dataset", "Collaborative/Other Agency", "Field Campaign", "Parent Dataset", "Related Dataset", "IsPreviousVersionOf", "IsNewVersionOf"]
}
},
"required": ["DOI"]
Expand All @@ -1829,7 +1829,7 @@
},
"Title": {
"description": "The title of the DOI landing page. The title describes the DOI object to a user, so they don't have to look it up themselves to understand the association.",
"$ref": "umm-cmn-json-schema.json#/definitions/TitleType"
"$ref": "umm-cmn-json-schema.json#/definitions/TitleType"
},
"Authority": {
"description": "The DOI organization that is responsible for creating the DOI is described in the Authority element. For ESDIS records the value of https://doi.org/ should be used.",
Expand Down
2 changes: 2 additions & 0 deletions umm-spec-lib/resources/xml-schemas/dif10/UmmCommon_1.2.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ technical contact
<xs:enumeration value="Parent Dataset"/>
<xs:enumeration value="Related Dataset"/>
<xs:enumeration value="Other"/>
<xs:enumeration value="IsPreviousVersionOf"/>
<xs:enumeration value="IsNewVersionOf"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AssociatedDOITypeOtherEnum">
Expand Down
2 changes: 2 additions & 0 deletions umm-spec-lib/resources/xml-schemas/echo10/MetadataCommon.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,8 @@
<xs:enumeration value="Parent Dataset"/>
<xs:enumeration value="Related Dataset"/>
<xs:enumeration value="Other"/>
<xs:enumeration value="IsPreviousVersionOf"/>
<xs:enumeration value="IsNewVersionOf"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Expand Down
33 changes: 32 additions & 1 deletion umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,35 @@
[_context collection & _]
;; File sizes from positive numbers to numbers, only need to migrate version.
(-> collection
(m-spec/update-version :collection "1.18.0")))
(m-spec/update-version :collection "1.18.0")))

(defmethod interface/migrate-umm-version [:collection "1.18.1" "1.18.2"]
[_context collection & _]
;; Migrating up version 1.18.1 to 1.18.2
;; Add AssociatedDOIs/Type enums: IsPreviousVersionOf and IsNewVersionOf
;; Add PREPRINT, INREVIEW, and SUPERSEDED enums to CollectionProgress
;; Remove NOT APPLICABLE enum from CollectionProgress
(-> collection
(m-spec/update-version :collection "1.18.2")))

;; TODO what does this method actually do? Is it to update the actual data?
;(defmethod interface/migrate-umm-version [:collection "1.18.2" "1.18.1"]
; [_context collection & _]
; ;; Migrating down version 1.18.2 to 1.18.1
; ;; Remove AssociatedDOIs/Type enums: IsPreviousVersionOf and IsNewVersionOf
; ;; Remove PREPRINT, INREVIEW, and SUPERSEDED enums to CollectionProgress
; ;; Add back in NOT APPLICABLE enum in CollectionProgress
; (util/remove-nils-empty-maps-seqs
; (-> collection
; (m-spec/update-version :collection "1.18.1")
; (as-> rc
; (let [sct (get-in rc [:AssociatedDOIs :Type])]
; (if (or (= "IsPreviousVersionOf" sct)
; (= "IsNewVersionOf" sct))
; (update-in rc [:AssociatedDOIs] dissoc :Type)
; rc)))
; ;; Change CollectionProgress enum to NOT APPLICABLE if its value is PREPRINT, INREVIEW, or SUPERSEDED
; (let [CollectionProgress (:CollectionProgress collection)]
; (if (or (= "PREPRINT" CollectionProgress) (= "INREVIEW" CollectionProgress) (= "SUPERSEDED" CollectionProgress))
; (assoc collection :CollectionProgress "NOT APPLICABLE")
; collection)))))
12 changes: 8 additions & 4 deletions umm-spec-lib/src/cmr/umm_spec/models/umm_collection_models.clj
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,21 @@
;; The title of the collection or service described by the metadata.
EntryTitle

;; This element describes the production status of the data set. There are five choices for Data
;; This element describes the production status of the data set. There are multiple choices for Data
;; Providers: PLANNED refers to data sets to be collected in the future and are thus unavailable
;; at the present time. For Example: The Hydro spacecraft has not been launched, but information
;; on planned data sets may be available. ACTIVE refers to data sets currently in production or
;; data that is continuously being collected or updated. For Example: data from the AIRS
;; instrument on Aqua is being collected continuously. COMPLETE refers to data sets in which no
;; updates or further data collection will be made. For Example: Nimbus-7 SMMR data collection
;; has been completed. DEPRECATED refers to data sets that have been retired, but still can be
;; retrieved. Usually newer products exist that replace the retired data set. NOT APPLICABLE
;; refers to data sets in which a collection progress is not applicable such as a calibration
;; collection. There is a sixth value of NOT PROVIDED that should not be used by a data provider.
;; retrieved. Usually newer products exist that replace the retired data set.
;; PREPRINT: Refers to datasets which are made available prior to completion of validation and review processes to support manuscript publication processes and open science.
;; Preprint datasets are provisional and should not be used for production applications.
;; INREVIEW: Refers to datasets which are made available to support science team final review. In Review datasets are provisional and should not be used for production applications.
;; Note that if restricted access is needed, an INREVIEW dataset may also have an Access Control List applied.
;; SUPERSEDED: Refers to datasets which remain publicly available, but for which a newer version is available.
;; There is a sixth value of NOT PROVIDED that should not be used by a data provider.
;; It is currently being used as a value when a correct translation cannot be done with the
;; current valid values, or when the value is not provided by the data provider.
CollectionProgress
Expand Down
8 changes: 7 additions & 1 deletion umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
[cmr.umm-spec.umm-to-xml-mappings.dif10.spatial :as spatial]
[cmr.umm-spec.util :as u]))

;; TODO?
(def coll-progress-mapping
"Mapping from known collection progress values to values supported for DIF10 Dataset_Progress."
{"COMPLETE" "COMPLETE"
"ACTIVE" "IN WORK"
"PLANNED" "PLANNED"
"DEPRECATED" "COMPLETE"})
"DEPRECATED" "COMPLETE"
"NOT PROVIDED" "NOT PROVIDED"
"PREPRINT" "PREPRINT"
"INREVIEW" "INREVIEW"
"SUPERSEDED" "SUPERSEDED"
})

(def platform-types
"The set of values that DIF 10 defines for platform types as enumerations in its schema"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"ACTIVE" "onGoing"
"PLANNED" "planned"
"DEPRECATED" "deprecated"
"NOT APPLICABLE" "NOT APPLICABLE"})
"NOT PROVIDED" "notprovided"
"PREPRINT" "PREPRINT"
"INREVIEW" "INREVIEW"
"SUPERSEDED" "SUPERSEDED"})

(defn generate-collection-progress
"Returns ISO CollectionProgress element from UMM-C collection c."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
"Field Campaign" ["fieldCampaign" "Field_Campaign"]
"Parent Dataset" ["parentDataset" "Parent_Dataset"]
"Related Dataset" ["relatedDataset" "Related_Dataset"]
"Other" ["other" "Other"]})
"Other" ["other" "Other"]
"IsPreviousVersionOf" ["isPreviousVersionOf" "Is_Previous_Version_Of"]
"IsNewVersionOf" ["isNewVersionOf" "Is_New_Version_Of"]})

(defn generate-associated-dois
"Generate from a UMM-C record the AssociatedDOIs into the ISO MENDS/SMAP form."
Expand Down
2 changes: 1 addition & 1 deletion umm-spec-lib/src/cmr/umm_spec/versioning.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"1.15" "1.15.1" "1.15.2" "1.15.3" "1.15.4" "1.15.5"
"1.16" "1.16.1" "1.16.2" "1.16.3" "1.16.4" "1.16.5" "1.16.6" "1.16.7"
"1.17.0" "1.17.1" "1.17.2" "1.17.3"
"1.18.0" "1.18.1"]
"1.18.0" "1.18.1" "1.18.2"]
:granule ["1.4" "1.5" "1.6" "1.6.1" "1.6.2" "1.6.3" "1.6.4" "1.6.5" "1.6.6"]
:variable ["1.0" "1.1" "1.2" "1.3" "1.4" "1.5" "1.6" "1.7" "1.8" "1.8.1" "1.8.2" "1.9.0"]
:service ["1.0" "1.1" "1.2" "1.3" "1.3.1" "1.3.2" "1.3.3" "1.3.4" "1.4" "1.4.1" "1.5.0" "1.5.1" "1.5.2" "1.5.3"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
[cmr.umm-spec.versioning :as umm-spec-versioning]
[cmr.umm.dif.date-util :refer [parse-dif-end-date]]))

;; TODO how do we know which values are supported for this version?
(def coll-progress-mapping
"Mapping from values supported for DIF10 Data_Set_Progress to UMM CollectionProgress."
{"COMPLETE" "COMPLETE"
Expand Down
1 change: 1 addition & 0 deletions umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif9.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[cmr.umm-spec.versioning :as umm-spec-versioning]
[cmr.umm.dif.date-util :refer [parse-dif-end-date]]))

;; TODO
(def coll-progress-mapping
"Mapping from values supported for DIF9 Data_Set_Progress to UMM CollectionProgress."
{"COMPLETE" "COMPLETE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
(:import
(clojure.data.xml Element)))

;; TODO
(def coll-progress-mapping
"Mapping from values supported for ECHO10 CollectionState to UMM CollectionProgress."
{"COMPLETE" "COMPLETE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
[cmr.umm-spec.xml-to-umm-mappings.iso19115-2.tiling-system :as tiling]
[cmr.umm-spec.versioning :as umm-spec-versioning]))

;; TODO
(def coll-progress-mapping
"Mapping from values supported for ISO19115 ProgressCode to UMM CollectionProgress."
{"COMPLETED" "COMPLETE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@
"fieldcampaign" "Field Campaign"
"parentdataset" "Parent Dataset"
"relateddataset" "Related Dataset"
"other" "Other"})
"other" "Other"
"ispreviousversionof" "IsPreviousVersionOf"
"isnewversionof" "IsNewVersionOf"})

(defn parse-associated-dois
"Parse out the associated DOIs from the ISO MENDS/SMAP document."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2962,7 +2962,9 @@
;; Test the migration of collections from 1.16.7 to 1.16.6.
(deftest migrate-1-16-7-to-1-16-6
(are3 [expected sample-collection]
(let [result (vm/migrate-umm {} :collection "1.16.7" "1.16.6" sample-collection)]
(let [_ (print "sample collection is -- ") ;; {:CollectionDataType LOW_LATENCY}
_ (print sample-collection)
result (vm/migrate-umm {} :collection "1.16.7" "1.16.6" sample-collection)]
(is (= expected (:CollectionDataType result))))

"Migrating CollectionDataType"
Expand Down Expand Up @@ -3835,3 +3837,21 @@
:MetadataSpecification {:URL "https://cdn.earthdata.nasa.gov/umm/collection/v1.18.0",
:Name "UMM-C",
:Version "1.18.0"}}))

;; TODO
;(deftest migrate-1-18-1-to-1-18-2
; ;; Test migration up from 1.18.1 to 1.18.2
; (are3 [expected sample-collection]
; (let [result (vm/migrate-umm {} :collection "1.18.1" "1.18.2" sample-collection)]
; (is (= expected result)))
;
; "Adding preprint to collectionprogress"
;
;
; )
;)

;; TODO
;(deftest migrate-1-18-2-to-1-18-1
; ;; Test migration down from 1.18.2 to 1.18.1
;)

0 comments on commit 1845d8d

Please sign in to comment.