0

I am struggling to word this correctly, but we have a list of laboratory blood tests listed:

  • Comprehensive Blood Panel
  • Basic Blood Panel
  • Liver Blood Panel
  • Cholesterol Panel
  • and many many more

These are all groupings of specific tests. Each of these can have some/any/none of the following lab tests:

  • Blood Chemistry
  • BNP
  • Complete Blood Count
  • Creatinine
  • DNA
  • Sed Rate
  • LFT
  • CRP
  • ESR
  • and so forth...

As per my example, a Basic Panel (metabolic panel) will include Blood Chemistry and maybe a CBC. A Liver Panel will include Blood Chemistry, LFT, etc. A Comprehensive Panel would include all in a Basic Panel and a bunch more.

So we have tests that can be shared between different test panels, where those will all contain the same metadata in each; meaning, a CBC for a Liver Panel will be the same as a Basic Panel.

My question is - would we be better off creating a Custom Post Type for Panels and then having another Custom Post Type for specific tests, and storing the CPT data for Tests as metadata in the Panel; or would we be better using a custom taxonomy?

I want to do this in the most efficient manner, but I do not want people to easily mess this up either. What are the benefits/pitfalls for using one or the other?

EDIT

I should add, I would like to be able to display the Panel, associated Tests, and metadata about each test on the front end of the site if possible.

1 Answer 1

0

For grouping things in a performant way, you typically want to create a CPT with custom taxonomies. It sounds like lab_test would work well as a CPT, and you could add a test_panel custom taxonomy that would group the lab_tests.

The additional data about the lab_tests is less straightforward - it really depends on what type of data you need to store about each test. If it's feasible to capture any or all of this information in a fairly standard set, i.e. you have maybe 20-100 choices for each piece of data, then that would be a good fit for another custom taxonomy. Whenever you are (A) searching by a particular type of data or (B) outputting data from multiple posts on a single URL, if you can use a taxonomy instead of postmeta, it's much more performant. However, if each test has very unique associated data and you're going to end up with hundreds of choices for any one type of data, that may mean postmeta would work better than custom taxonomies.

One other thought - if you're wanting to display all the data about each lab_test on the test_panel URLs, then you don't have to use taxonomies or postmeta at all. You could set up a block template for the lab_test CPT so that each one is structured the same, and just have each CPT's full content output on both the individual lab_test URL and the associated test_panels. Depending on how creative you get with the markup, you could potentially have the same content each place, but hide some of the data - say with an accordion - on the test_panels, so it's all there but only expanded when a user interacts to learn more about an individual lab_test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.