skip to Main Content

I’m trying to create a fhir REST request to the NHS eReferral system to get back a worklist.
Currently the json in the example is this

{
      "resourceType": "Parameters",
      "meta": {
        "profile": [
          "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-Parameters-1"
        ]
      },
      "parameter": [
        {
          "name": "listType",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1",
                "code": "REFERRALS_FOR_REVIEW"
              }
            ]
          }
        }
      ]
    }

I’ve tried to code this using the fhir c# library here.
https://github.com/FirelyTeam/firely-net-sdk

Like this.

var url = "FHIR/STU3/ReferralRequest/$ers.fetchworklist";

            var bundle = new Parameters();

            bundle.Meta = new Meta();

            bundle.Meta.Profile = new string[] { "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-Parameters-1" };

            bundle.Add("name", new FhirString("listType"));

            var parms = new Parameters()
                .Add("system", new FhirString("https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1"))
                .Add("code", new FhirString("REFERRALS_FOR_REVIEW"));

            bundle.Add("valueCodeableConcept", new Parameters().Add("coding",parms));

         
            var response =  await _fhirClient.OperationAsync(new Uri(EndPointUrl + "FHIR/STU3/ReferralRequest"), "ers.fetchworklist", bundle);

However using fiddler by json is wrong.

{
    "resourceType": "Parameters",
    "meta": {
        "profile": [
            "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-Parameters-1"
        ]
    },
    "parameter": [
        {
            "name": "name",
            "valueString": "listType"
        },
        {
            "name": "valueCodeableConcept",
            "resource": {
                "resourceType": "Parameters",
                "parameter": [
                    {
                        "name": "coding",
                        "resource": {
                            "resourceType": "Parameters",
                            "parameter": [
                                {
                                    "name": "system",
                                    "valueString": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1"
                                },
                                {
                                    "name": "code",
                                    "valueString": "REFERRALS_FOR_REVIEW"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

Basically how do you add a basic value into the parmeter e.g name: listType current bundle.Add("name", new FhirString("listType"));doesn’t do the job.

2

Answers


  1. Chosen as BEST ANSWER

    Think I've found it - it's bundle.Add("name", new CodeableConcept("https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1", "REFERRALS_FOR_REVIEW"));

    Update just to tidy up..

    bundle.Add("listType", new CodeableConcept("https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1", "REFERRALS_FOR_REVIEW"));
    

  2. You have quite a bit of overhead in your code, so I created a new snippet. Please note that Parameters is a resource type, so you would not want to call your variable ‘bundle’ since that would be confusing. Then this particular Parameters resource needs to have 1 parameter added with a name and a CodeableConcept value. This will do the trick:

    Parameters paramResource = new Parameters();
    
    paramResource.Meta = new Meta();
    paramResource.Meta.Profile = new string[] { "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-Parameters-1" };
    
    
    Parameters.ParameterComponent param = new Parameters.ParameterComponent();
    param.Name = "listType";
    param.Value = new CodeableConcept("https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1", "REFERRALS_FOR_REVIEW");
    
    paramResource.Parameter.Add(param);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search