Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockClient graphql returns StructureDefinition #1273

Closed
reshmakh opened this issue Dec 10, 2022 · 1 comment
Closed

MockClient graphql returns StructureDefinition #1273

reshmakh opened this issue Dec 10, 2022 · 1 comment
Labels
bug Something isn't working fhir-datastore Related to the FHIR datastore, includes API and FHIR operations

Comments

@reshmakh
Copy link
Member

The MockClient.graphql call is always returning a Structure Definition, even though I've pre-created the appropriate resources

QUERY = 
`\
{
  List(id: $ID) {
    id
    title
    entry {
      item {
        resource {
          ...on ServiceRequest {
            id,
            orderDetail {
              text
            }
            DiagnosticReportList(_reference: based_on) {
              id
              status
            }
          }
        }
      }
    }
  }
}
`


Test Setup: 
 const medplum = new MockClient();
    ctx.client = medplum;

    // Create Orders
    // By default, use the fields from the HomerServiceRequest mock, but
    // overwrite id, orderDetail, category, and identifier (barcodeId)
    ctx.orders = Array.from({ length: 4 }, (_, i) => ({
      ...deepCopy(HomerServiceRequest),
      id: `order${i}`,
      orderDetail: [{ text: 'LAB_PROCESSED' }],
      category: { text: 'Ro' },
      identifier: [{ system: 'kit/barcodeId', value: `${i}` }],
    }));

    ctx.orders.forEach((e: ServiceRequest) => {
      medplum.createResource(e);
    });

    const orderList: List = {
      resourceType: 'List',
      id: 'List-0',
      status: 'current',
      mode: 'working',
      source: createReference(DrAliceSmith),
      entry: ctx.orders.map((order: ServiceRequest) => {
        return {
          item: createReference(order),
        };
      }),
    };

    ctx.list = await medplum.createResource(orderList);


Return Value: 
OrderList {
  "StructureDefinitionList": [
    {
      "resourceType": "StructureDefinition",
      "id": "DiagnosticReport",
      "name": "DiagnosticReport",
      "description": "The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.",
      "type": "DiagnosticReport",
      "snapshot": {
        "element": [
          {
            "id": "DiagnosticReport",
            "path": "DiagnosticReport",
            "definition": "The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.",
            "min": 0,
            "max": "*"
          },
          {
            "id": "DiagnosticReport.id",
            "path": "DiagnosticReport.id",
            "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.",
            "min": 0,
            "max": "1",
            "type": [
              {
                "code": "http:https://hl7.org/fhirpath/System.String"
              }
            ]
          },
          {
            "id": "DiagnosticReport.meta",
            "path": "DiagnosticReport.meta",
            "definition": "The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.",
            "min": 0,
            "max": "1",
            "type": [
              {
                "code": "Meta"
              }
            ]
          },
          {
            "id": "DiagnosticReport.implicitRules",
            "path": "DiagnosticReport.implicitRules",
            "definition": "A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.",
            "min": 0,
            "max": "1",
            "type": [
              {
                "code": "uri"
              }
            ]
          },
@reshmakh reshmakh added bug Something isn't working fhir-datastore Related to the FHIR datastore, includes API and FHIR operations labels Dec 10, 2022
@codyebberson
Copy link
Member

Dup of #1715

Fixed in #1435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fhir-datastore Related to the FHIR datastore, includes API and FHIR operations
Projects
None yet
Development

No branches or pull requests

2 participants