pulibrary / pdc-osti

2 stars 0 forks source link

One record submissions will throw errors #1

Open kmcelwee opened 4 years ago

kmcelwee commented 4 years ago

Response structure differs if there's only one submission:

-        return {'record': {'osti_id': '1488485',
-          'accession_num': '88435/dsp01z316q451j',
-          'product_nos': 'None',
-          'title': 'Toward fusion plasma scenario planning for NSTX-U using machine-learning-accelerated models',
-          'contract_nos': 'AC02-09CH11466',
-          'other_identifying_nos': None,
-          'doi': '10.11578/1488485',
-          'doi_status': 'PENDING',
-          'status': 'SUCCESS',
-          'status_message': None,
-          '@status': 'UPDATED'}}
+        return {
+            "record": [
+                {
+                    "osti_id": "1488485",
+                    "accession_num": "88435/dsp01z316q451j",
+                    "product_nos": "None",
+                    "title": "Fake title 1: Toward fusion plasma scenario planning",
+                    "contract_nos": "AC02-09CH11466",
+                    "other_identifying_nos": None,
+                    "doi": "10.11578/1488485",
+                    "doi_status": "PENDING",
+                    "status": "SUCCESS",
+                    "status_message": None,
+                    "@status": "UPDATED"
+                },
+                {
+                    "osti_id": "1491154",
+                    "accession_num": "88435/dsp012v23vx30c",
+                    "product_nos": "None",
+                    "title": "MHD-blob correlations in NSTX",
+                    "contract_nos": "AC02 09CH11466; FG02-97ER54392; AC52-07NA27344",
+                    "other_identifying_nos": None,
+                    "doi": "10.11578/1491154",
+                    "doi_status": "PENDING",
+                    "status": "SUCCESS",
+                    "status_message": None,
+                    "@status": "UPDATED"
+                }
+            ]
+        }
kmcelwee commented 3 years ago

The DOE team took note of this issue (see above). Thankfully this situation is rare.