NCIOCPL / glossary-api

API for Dictionary of Cancer Terms, Dictionary of Genetics Terms, and other Glossary documents.
0 stars 5 forks source link

Story: Get Term Exact Match endpoint #129

Closed blairlearn closed 3 years ago

blairlearn commented 3 years ago

As a developer, I want to fetch an exact match for a term, so that my application does not need to do a search and then check whether any of the results are the exact term name.

ESTIMATE 20

Acceptance Criteria

  Background:
  ## Set the url of all requests to magic variable apiHost
  * url apiHost
  ## Set a variable named metastaticResponse that contains the Json for metastatic term
  * def metastaticResponse = {
     "termId": 44058,
     "language": "en",
     "dictionary": "Cancer.gov",
     "audience": "Patient",
     "termName": "metastatic",
     "firstLetter": "m",
     "prettyUrlName": "metastatic",
     "pronunciation": {
       "key": "(meh-tuh-STA-tik)",
       "audio": "https://nci-media-dev.cancer.gov/audio/pdq/704104.mp3"
     },
     "definition": {
       "html": "Having to do\n          with metastasis, which is the spread of cancer from the\n          primary site (place where it started) to other places in\n          the body.",
       "text": "Having to do\n          with metastasis, which is the spread of cancer from the\n          primary site (place where it started) to other places in\n          the body."
     },
     "relatedResources": [
       {
         "Url": "https://www.cancer.gov/types/metastatic-cancer",
         "Type": "External",
         "Text": "Metastatic Cancer"
      }
     ],
     "media": [
       {
         "Type": "Image",
         "ImageSources": [
           {
             "Size": "original",
             "Src": "https://nci-media-dev.cancer.gov/images/pdq/CDR764135.jpg"
           },
           {
             "Size": "571",
             "Src": "https://nci-media-dev.cancer.gov/images/pdq/CDR764135-571.jpg"
           },
           {
             "Size": "750",
             "Src": "https://nci-media-dev.cancer.gov/images/pdq/CDR764135-750.jpg"
           }
         ],
         "Ref": "CDR0000764135",
         "Alt": "Metastasis; drawing shows primary cancer that has spread from the colon to other parts of the body (the liver and the lung). An inset shows cancer cells spreading from the primary cancer, through the blood and lymph system, to another part of the body where a metastatic tumor has formed.",
         "Caption": "Metastasis. In metastasis, cancer cells break away from where they first formed (primary cancer), travel through the blood or lymph system, and form new tumors (metastatic tumors) in other parts of the body. The metastatic tumor is the same type of cancer as the primary tumor. "
       },
       {
         "Type": "Video",
         "Hosting": "youtube",
         "Ref": "CDR0000787719",
         "UniqueId": "fQwar_-QdiQ",
         "Template": "Video75NoTitle",
         "Title": "Metastasis: How Cancer Spreads",
         "Caption": "Many cancer deaths are caused when cancer moves from the original tumor and spreads to other tissues and organs. This is called metastatic cancer. This animation shows how cancer cells travel from the place in the body where they first formed to other parts of the body."
       }
     ]
   }

  Scenario: get a definition by Term Name returning only the requested fields
    ## Set path to  /Terms/Exact/{dictionary}/{audience}/{language}/{term-name}
    Given path 'Terms', 'Cancer.gov', 'Patient', 'en', 'metastatic'
      ## Add ?requestedFields parameter
      And param requestedFields = = 'termId', 'termName'
    When method get
    Then status 200
    ## Test to make sure response is only our requested fields
    And match response == { "termId": metastaticResponse.termId, "termName": metastaticResponse.termName }

  Scenario: get a definition by Term Name returning ALL fields
    ## Endpoint /Terms/Exact/{dictionary}/{audience}/{language}/{term-name}
    Given path 'Terms', 'Cancer.gov', 'Patient', 'en', 'metastatic'
    When method get
    Then status 200
    And match response == metastaticResponse

Resources:

Notes

Some complementary notes if necessary:


Solution

Prerequisites

Tasks

Technical Notes