namc-utah / NAMCr

NAMC Database and Analysis R API
MIT License
0 stars 0 forks source link

Special Characters and NAMCr #30

Open philipbaileynar opened 2 years ago

philipbaileynar commented 2 years ago

@courtwrightj01 original issue

the edits to the samples query to be able to query by siteName appeared to work really well for me last week but this week now I am getting an error

samples= query("samples",siteName='NB-LS-9132') 
Retrieving data: Error: 2.36: unrecognized character -

Similarly I swear I have been able to save notes just fine using the setModelResult but this week if I try to save notes with commas included the note fails to save.

philipbaileynar commented 2 years ago

Researching this issue now I see that @courtwrightj01 has two things wrong with her request:

  1. The argument is siteNames (not siteName)
  2. The siteNames parameter is a list not an individual site name.

@courtwrightj01 please re-test with these fixes and close this issue if it works.

Note the API endpoint is working correctly when called with the correct parameters. And note there are no special characters in any of the fields.

{
  samples(limit: 501, offset: 0, siteNames: ["NB-LS-9132"]) {
    records {
      sampleId
      boxId
      customerName
      siteId
      siteName
      siteLatitude
      siteLongitude
      waterbodyName
      usState
      visitId
      customerSiteCode
      sampleDate
      sampleLatitude
      sampleLongitude
      sampleType
      sampleMethod
      habitatId
      habitatName
      area
      fieldSplit
      labSplit
      jarCount
      qualitative
      mesh
      createdDate
      updatedDate
      qaSampleId
    }
    nextOffset
  }
}

returns:

{
  "data": {
    "samples": {
      "records": [
        {
          "sampleId": 157606,
          "boxId": 1761,
          "customerName": "BLM-Aquatic Assessment Inventory Monitoring (AIM)",
          "siteId": 13643,
          "siteName": "NB-LS-9132",
          "siteLatitude": 39.065664,
          "siteLongitude": -116.191856,
          "waterbodyName": "NB-LS-9132: Willow Creek",
          "usState": "Nevada",
          "visitId": "NB-LS-9132_2015-09-11",
          "customerSiteCode": "NB-LS-9132",
          "sampleDate": "2015-09-11",
          "sampleLatitude": null,
          "sampleLongitude": null,
          "sampleType": "Benthic",
          "sampleMethod": "Surber net",
          "habitatId": 8,
          "habitatName": "Reachwide",
          "area": 0.651,
          "fieldSplit": 1,
          "labSplit": 0.5938,
          "jarCount": 1,
          "qualitative": false,
          "mesh": null,
          "createdDate": "2021-11-17T04:18:48.264249+00:00",
          "updatedDate": "2022-03-23T20:46:23.803322+00:00",
          "qaSampleId": null
        }
      ],
      "nextOffset": null
    }
  }
}