khonlieu
08/19/2024, 8:14 PMid: ID! and id: String!? For example currently to get the update call to work, we have pass both type of ids when we make an update. Here's an example mutation call.
mutation updateObservation(
$id: ID!
$stringID: String
$patientId: String
$encounterId: String
$value: String
$type: String
$date: String
) {
ObservationUpdate(
id: $id
res: {
id: $stringIDk
resourceType: "Observation"
code: { text: $type }
valueString: $value
effectiveDateTime: $date
status: "final"
subject: { reference: $patientId }
encounter: { reference: $encounterId }
category: { text: "Vital Signs" }
}
) {
id
code {
text
}
valueString
effectiveDateTime
method {
text
}
}
}
{
"id": "fff601cd-068f-4bbf-cccc-7cc60dca1815",
"stringID": "fff601cd-068f-4bbf-cccc-7cc60dca1815",
"date": "2024-08-19T17:50:03.337Z",
"encounterId": "Encounter/87237e5d-a72c-49fe-a0ed-00a528ceb2a5",
"patientId": "Patient/878db98e-39b1-4664-ffff-ac756415fc09",
"type": "Wt",
"value": "100"
}
You'll notice that the values for the keys id and stringID have identical values, but atm, we have to do that inorder to not get an error response from the graphql API, which says this
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"details": {
"text": "Variable \"$id\" of type \"ID!\" used in position expecting type \"String\"."
}
}
],
}
Looking at Graphiql, it says the string version of the id under res is not required, but in fact the implementation of the update repo service needs it. It's used here:
if (resourceId !== resourceArgs.id) {
return [badRequest('Incorrect ID')];
} cc @rahul1