Skip to content

Commit 6e1ab6e

Browse files
committed
CMR-11141: Adding in a new mime type for PODAAC
1 parent 6d0c402 commit 6e1ab6e

File tree

7 files changed

+91
-8
lines changed

7 files changed

+91
-8
lines changed

ingest-app/src/cmr/ingest/config.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
(defconfig granule-umm-version
4444
"Defines the latest granule umm version accepted by ingest - it's the latest official version.
4545
This environment variable needs to be manually set when newer UMM version becomes official"
46-
{:default "1.6.6"})
46+
{:default "1.6.7"})
4747

4848
(defconfig variable-umm-version
4949
"Defines the latest variable umm version accepted by ingest - it's the latest official version.

system-int-test/test/cmr/system_int_test/ingest/granule/granule_ingest_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@
689689
:identifiers [:identifier "a very nice granule :)"
690690
:identifier-type "a type of identifier"]})})
691691
(data-core/item->concept {:format :umm-json
692-
:version "1.6.6"}))
692+
:version "1.6.7"}))
693693
{:keys [status] :as response} (ingest/ingest-concept granule)]
694694
(is (#{200 201} status) (pr-str response))))
695695

umm-spec-lib/resources/json-schemas/granule/umm/v1.6.7/umm-g-json-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@
12741274
"text/xml", "application/pdf", "application/x-hdf", "application/x-hdf5",
12751275
"application/octet-stream", "application/vnd.google-earth.kmz", "image/jpeg", "image/png",
12761276
"image/vnd.collada+xml", "text/html", "text/plain", "application/zip", "application/gzip", "application/tar",
1277-
"application/tar+gzip", "application/tar+zip", "application/vnd.opendap.dap4.dmrpp+xml", "Not provided"]
1277+
"application/tar+gzip", "application/tar+zip", "application/vnd.opendap.dap4.dmrpp+xml", "application/yaml", "Not provided"]
12781278
},
12791279
"DataFormatType": {
12801280
"description": "The format that granule data confirms to. While the value is listed as open to any text, CMR requires that it confirm to one of the values on the GranuleDataFormat values in the Keyword Management System: https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/GranuleDataFormat",

umm-spec-lib/src/cmr/umm_spec/migration/version/granule.clj

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,27 @@
152152
(if (> (count pge-version) 10)
153153
(assoc pge-version-class :PGEVersion (subs pge-version 0 10))
154154
pge-version-class)))
155+
156+
(defn downgrade-mimetype-to-1-6-6
157+
"This function takes a map and downgrades the application/yaml mime-type
158+
to version 1.6.6 If the metadata contains :Files then it is a nested map and so call
159+
this function again to iterate over its maps.
160+
An updated map is returned."
161+
[archive-and-dist-info-file]
162+
(-> archive-and-dist-info-file
163+
(update :MimeType #(if (= "application/yaml" %)
164+
"Not provided"
165+
%))
166+
(update :Files (fn [files]
167+
(seq (map #(downgrade-mimetype-to-1-6-6 %) files))))
168+
(util/remove-nil-keys)))
169+
170+
(defn downgrade-mimetypes-to-1-6-6
171+
"This function takes a list of maps that contain the field called MimeType and it
172+
iterates through them to downgrade application/yaml mime-type to version 1.6.6. A list of updated
173+
maps is returned."
174+
[list-of-maps]
175+
(seq (map #(downgrade-mimetype-to-1-6-6 %) list-of-maps)))
155176

156177
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157178
;;; Granule Migration Implementations
@@ -302,3 +323,16 @@
302323
[_context g & _]
303324
(-> g
304325
(m-spec/update-version :granule "1.6.6")))
326+
327+
(defmethod interface/migrate-umm-version [:granule "1.6.7" "1.6.6"]
328+
;; Remove the new subtype in each RelatedUrl.
329+
[_context g & _]
330+
(-> g
331+
(update-in [:DataGranule :ArchiveAndDistributionInformation] downgrade-mimetypes-to-1-6-6)
332+
(update :RelatedUrls downgrade-mimetypes-to-1-6-6)
333+
(m-spec/update-version :granule "1.6.6")))
334+
335+
(defmethod interface/migrate-umm-version [:granule "1.6.6" "1.6.7"]
336+
[_context g & _]
337+
(-> g
338+
(m-spec/update-version :granule "1.6.7")))

umm-spec-lib/src/cmr/umm_spec/umm_g/granule.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
(def ^:private umm-g-metadata-specification
1919
"Defines the current UMM-G MetadataSpecification"
20-
{:URL "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6"
20+
{:URL "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.7"
2121
:Name "UMM-G"
22-
:Version "1.6.6"})
22+
:Version "1.6.7"})
2323

2424
(defn- get-date-by-type
2525
"Returns the date of the given type from the given provider dates"

umm-spec-lib/src/cmr/umm_spec/versioning.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"1.16" "1.16.1" "1.16.2" "1.16.3" "1.16.4" "1.16.5" "1.16.6" "1.16.7"
1515
"1.17.0" "1.17.1" "1.17.2" "1.17.3"
1616
"1.18.0" "1.18.1" "1.18.2" "1.18.3" "1.18.4" "1.18.5"]
17-
: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"]
17+
: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" "1.6.7"]
1818
: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"]
1919
: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"
2020
"1.5.0" "1.5.1" "1.5.2" "1.5.3" "1.5.4"]

umm-spec-lib/test/cmr/umm_spec/test/migration/version/granule.clj

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313

1414
(deftest test-version-steps
1515
(with-bindings {#'cmr.umm-spec.versioning/versions
16-
{: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"]}}
16+
{: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" "1.6.7"]}}
1717
(is (= [] (#'vm/version-steps :granule "1.5" "1.5")))
1818
(is (= [["1.4" "1.5"]] (#'vm/version-steps :granule "1.4" "1.5")))
1919
(is (= [["1.5" "1.4"]] (#'vm/version-steps :granule "1.5" "1.4")))
2020
(is (= [["1.4" "1.5"] ["1.5" "1.6"]] (#'vm/version-steps :granule "1.4" "1.6")))
2121
(is (= [["1.4" "1.5"] ["1.5" "1.6"] ["1.6" "1.6.1"]] (#'vm/version-steps :granule "1.4" "1.6.1")))
2222
(is (= [["1.6.1" "1.6.2"] ["1.6.2" "1.6.3"] ["1.6.3" "1.6.4"]] (#'vm/version-steps :granule "1.6.1" "1.6.4")))
2323
(is (= [["1.6.4" "1.6.5"]] (#'vm/version-steps :granule "1.6.4" "1.6.5")))
24-
(is (= [["1.6.5" "1.6.6"]] (#'vm/version-steps :granule "1.6.5" "1.6.6")))))
24+
(is (= [["1.6.5" "1.6.6"]] (#'vm/version-steps :granule "1.6.5" "1.6.6")))
25+
(is (= [["1.6.6" "1.6.7"]] (#'vm/version-steps :granule "1.6.6" "1.6.7")))))
2526

2627
(declare all-migrations-produce-valid-umm-spec umm-record dest-version)
2728
(defspec all-migrations-produce-valid-umm-spec 100
@@ -829,3 +830,51 @@
829830
:Format "NETCDF-4" ;; this has always been a valid format
830831
:MimeType "application/x-netcdf"}]
831832
(:RelatedUrls converted)))))
833+
834+
(def granule-1-6-7
835+
{:MetadataSpecification
836+
{:URL "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.7"
837+
:Name "UMM-G"
838+
:Version "1.6.7"}
839+
:DataGranule {:ArchiveAndDistributionInformation [{:MimeType "application/yaml"} {:MimeType "application/json"}]}
840+
:PGEVersionClass {:PGEName "A PGE Name"
841+
:PGEVersion "12345678901234567890123456789012345678901234567890"}
842+
:RelatedUrls [{:URL "https://acdisc.gesdisc.eosdis.nasa.gov/opendap/Aqua_AIRS_Level3/AIRX3STD.006/"
843+
:Type "GET SERVICE"
844+
:Subtype "ALGORITHM THEORETICAL BASIS DOCUMENT (ATBD)"
845+
:MimeType "application/json"
846+
:Format "JSON"}
847+
{:URL "s3://amazon.something.com/get-data"
848+
:Type "GET DATA"
849+
:Subtype "BROWSE IMAGE SOURCE"
850+
:Format "YAML"
851+
:MimeType "application/yaml"}]})
852+
853+
(deftest migrate-1-6-6-up-to-1-6-7
854+
(let [converted (vm/migrate-umm {} :granule "1.6.6" "1.6.7" granule-1-6-6)]
855+
(is (= {:URL "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.7"
856+
:Name "UMM-G"
857+
:Version "1.6.7"}
858+
(:MetadataSpecification converted))
859+
"Specification must be 1.6.7")))
860+
861+
(deftest migrate-1-6-7-down-to-1-6-6
862+
(let [converted (vm/migrate-umm {} :granule "1.6.7" "1.6.6" granule-1-6-7)]
863+
(is (= {:URL "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6"
864+
:Name "UMM-G"
865+
:Version "1.6.6"}
866+
(:MetadataSpecification converted))
867+
"Specification must be 1.6.6")
868+
(is (= [{:URL "https://acdisc.gesdisc.eosdis.nasa.gov/opendap/Aqua_AIRS_Level3/AIRX3STD.006/"
869+
:Type "GET SERVICE"
870+
:Subtype "ALGORITHM THEORETICAL BASIS DOCUMENT (ATBD)"
871+
:MimeType "application/json"
872+
:Format "JSON"}
873+
{:URL "s3://amazon.something.com/get-data"
874+
:Type "GET DATA"
875+
:Subtype "BROWSE IMAGE SOURCE",
876+
:Format "YAML" ;; this has always been a valid format
877+
:MimeType "Not provided"}]
878+
(:RelatedUrls converted)))
879+
(is (= (get-in converted [:DataGranule :ArchiveAndDistributionInformation])
880+
[{:MimeType "Not provided"} {:MimeType "application/json"}]))))

0 commit comments

Comments
 (0)