A Reusable Search Control for FHIR

A Reusable Search Control for FHIR

This article is contributed. See the original author and article here.

 


Searching a FHIR resource is simple.  But what if you want to create a highly reusable search form?  In this article we walk through a highly reusable search control.


FHIR Search Scenario


Let’s say we have a list of patients.  Our app displays patients in a table (first 3 rows displayed below):





















ID



Name



Date of Birth



0001



Joe Patient



01/13/81



0002



Jane Patient



02/13/80



 


If we have 1000 patients, we might want to allow users to search by ID and Name.


First Attempt


In the past we were tempted to create custom Blazor forms like:


SameerDoshi_0-1639695945263.png


 


Then on submit of this form we could assemble a search criteria.


 


 

 public async Task<IList<Patient>> SearchPatient(string givenName, string familyName, string identifier )
        {
            Bundle bundle;

            if (!string.IsNullOrEmpty(identifier))
            {
                bundle = await _fhirClient.SearchByIdAsync<Patient>(identifier);

                if (bundle != null)
                    return bundle.Entry.Select(p => (Patient)p.Resource).ToList();
            }

            if (!string.IsNullOrEmpty(familyName))
            {
                bundle = await _fhirClient.SearchAsync<Patient>(criteria: new[] { $"family:contains={familyName}" });

                if (bundle != null)
                    return bundle.Entry.Select(p => (Patient)p.Resource).ToList();
            }

            return await GetPatientsAsync();           
        }

 


 


 


Great!  But there’s trouble ahead as soon as we start adding more search criteria.


A Growing Form


Now let’s say we want to support searching by birth date.  Our first thought might be to add another field and end up with a form like this.


SameerDoshi_1-1639695945267.png


 


Our form is quickly growing.   And so is our submit code.


 


 

 public async Task<IList<Patient>> SearchPatient(string givenName, string familyName, string identifier, string birthdate )
        {
            Bundle bundle;

            if (!string.IsNullOrEmpty(identifier))
            {
                bundle = await _fhirClient.SearchByIdAsync<Patient>(identifier);

                if (bundle != null)
                    return bundle.Entry.Select(p => (Patient)p.Resource).ToList();
            }

            if (!string.IsNullOrEmpty(familyName))
            {
                bundle = await _fhirClient.SearchAsync<Patient>(criteria: new[] { $"family:contains={familyName}dateofbirth:contains{birthdate}" });

                if (bundle != null)
                    return bundle.Entry.Select(p => (Patient)p.Resource).ToList();
            }

            return await GetPatientsAsync();           
        }

 


 


Now what happens if we want to add search by Telephone, address, or by anything in the Patient object?   Our form is going to get longer and longer.  Pretty soon it’s going to be gigantic!  Even worse we can’t reuse this component for searching other FHIR resources.  For example, our search for Questionnaires will look 100% different!   After all Questionnaires don’t have Family Names, or Birthdates.


A better approach


Instead, we started to use a much simpler form:


SameerDoshi_2-1639695945267.png


 


The code for this component is similarly simple:


 


 

private async Task<IList<Patient>> SearchPatient(IDictionary<string, string> searchParameters)
        {
            var searchResults = new List<Patient>();
            IList<string> filterStrings = new List<string>();
            foreach (var parameter in searchParameters)
            {
                if (!string.IsNullOrEmpty(parameter.Value))
                {
                    filterStrings.Add($"{parameter.Key}:contains={parameter.Value}");
                }
            }
            Bundle bundle = await _fhirService.SearchAsync<Patient>(criteria: filterStrings.ToArray<string>());

            if (bundle != null)
            {
                searchResults = bundle.Entry.Select(p => (Patient)p.Resource).ToList();
            }
            return searchResults;
        }

 


 


But the magic is that each Resource that uses the component uses a method like this to build search criteria:


 


So now using that simple component our users can search for id like this:
Id:0001


Search for Birthdate like this:
birthdate:01/26/82


Or do a combined search:
Id:0001 birthdate:01/26/82


 


And for Questionnaires we can use the same component and search for a Questionnaire with complex search terms like:


Name:health description:nutrition


 


See it in Action


View our implementation of this component in FHIR Blaze- our sample FHIR + Blazor app.


Caveats


Ux: Though we have a simplified form- it’s no longer clear what available search fields.  How is your user supposed to know that “family:” is how one searches for last name?   To resolve this, we recommend visual hints or auto complete. For example, below the text box you could include simple text explaining the most likely search terms as well as linking to a document with all the terms defined.


Performance: Since our search routine uses “contains” our search uses much more Rus than if we included an exact search term.  Consider including keyword to allow exact searches. 


Spaces:  Our search routine does a simple split.  This means we can’t search for anything with a space (ex: a family name of “De Luis”.   Consider modifying our sample code to more intelligently split search terms.


Cancelling search:  Our code assumes submitting the search with no terms is to cancel the search.  This isn’t apparent and might be confusing.

VMware Releases Security Advisory

This article is contributed. See the original author and article here.

VMware has released a security advisory to address a vulnerability in Workspace ONE UEM console. An attacker could exploit this vulnerability to obtain sensitive information.

CISA encourages users and administrators to review VMware Security Advisory VMSA-2021-0029 and apply the necessary mitigation.
 

NSA and CISA Release Final Part IV of Guidance on Securing 5G Cloud Infrastructures

This article is contributed. See the original author and article here.

CISA has announced the joint National Security Agency (NSA) and CISA publication of the final of a four-part series, Security Guidance for 5G Cloud Infrastructures. Part IV: Ensure Integrity of Cloud Infrastructure focuses on platform integrity, microservices infrastructure integrity, launch time integrity, and build time security to ensure that 5G cloud resources are not modified without authorization. This series was published under the Enduring Security Framework (ESF), a public-private cross-sector working group led by NSA and CISA.

CISA encourages 5G providers, integrators, and network operators to review the guidance and consider the recommendations. See CISA’s 5G Security and Resilience webpage for more information.

Look beyond the award when you hire a lawyer

Look beyond the award when you hire a lawyer

This article was originally posted by the FTC. See the original article here.

If you suddenly need to hire a lawyer, you might start searching online. When you do, you’re likely to see lawyers and law firms with fancy-looking seals and badges on their websites claiming they’re among the best in their field. Before you move forward, know that some of these seals or badges might be “vanity” or “ego” awards that lawyers can buy.

It can be tricky to tell whether an award is earned through merit or is simply a marketing ploy, but a few questions can help. How long has this award been in existence? What requirements does someone have to meet to earn the award? How many awards are given out each year? Is a marketing company awarding it? Try searching online for the name of whoever’s giving the award plus words like “vanity,” “ego,” “marketing,” and “scam” to find out.

When choosing a lawyer, be sure to look beyond any seals or badges on lawyers’ websites:

  • Ask for recommendations from people you trust who already have experience hiring lawyers. Online reviews can be made up or written by people with personal ties to the lawyers.
  • Lawyers must pass a state bar exam to practice law in the U.S., and they often have to be admitted to the bar in the state where they practice. Check the state bar association to see if the attorney is active, inactive, disciplined, or disbarred.
  • Look for actual accomplishments and past work experience. Many court documents are public record and you can see if the lawyer you’re considering has experience handling your type of legal issue.

And check out ftc.gov/hiring-lawyer for more information on how to hire the right kind of lawyer and what to ask about lawyers’ fees.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.