2021-08-21 update: Moved to dedicated project at https://www.drupal.org/project/schema_medical_entity

###

Our client needed support for MedicalEntity and several related subtypes. I went ahead and built out a full submodule for this, posted here as a patch. Its also available at https://www.drupal.org/sandbox/natemow/3116005 -- code review available at https://pareview.sh/pareview/https-git.drupal.org-sandbox-natemow-311600....

Hopefully this patch can be applied as-is but let me know if there are any changes that you'd like to see first.

The module creates the following Schema.org object types:

  • Schema.org/MedicalEntity
  • Schema.org/AnatomicalStructure
  • Schema.org/AnatomicalSystem
  • Schema.org/LifestyleModification
  • Schema.org/MedicalCause
  • Schema.org/MedicalCondition
  • Schema.org/MedicalContraindication
  • Schema.org/MedicalDevice
  • Schema.org/MedicalGuideline
  • Schema.org/MedicalIndication
  • Schema.org/MedicalIntangible
  • Schema.org/MedicalProcedure
  • Schema.org/MedicalRiskEstimator
  • Schema.org/MedicalRiskFactor
  • Schema.org/MedicalStudy
  • Schema.org/MedicalTest
  • Schema.org/Substance
  • Schema.org/SuperficialAnatomy

Comments

natemow created an issue. See original summary.

natemow’s picture

Issue summary: View changes
natemow’s picture

StatusFileSize
new101.56 KB

Patch updated with a bug fix in schema_medical_condition.

natemow’s picture

Issue summary: View changes
natemow’s picture

Issue summary: View changes
StatusFileSize
new188.72 KB

Expanded to include all 17 subtypes and their property implementations (mostly text-based for now).

natemow’s picture

Issue summary: View changes
natemow’s picture

johan.gant’s picture

StatusFileSize
new188.72 KB

This is great, thanks for your time putting this together. I noticed a fatal PHP error when using with 8.x-2.x when editing the default metatags:

Error: Class 'Drupal\\schema_metatag\\Plugin\\metatag\\Tag\\SchemaTypeBase' not found in schema_metatag/schema_medical_entity/schema_medical_condition/src/Plugin/metatag/Tag/SchemaMedicalConditionType.php on line 22

I found other classes extending SchemaNameBase, so I quickly re-rolled the patch and it seems to work. I'm not massively familiar with the set up of the broader class hierarchy right now so I'm not 100% confident of the fix, per se.

Sharing the patch here regardless, while I have the time to do so.

karens’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Patch (to be ported) » Needs work

All new features are going into 8.2. This patch needs a little work to adjust to that version. See documentation for 8.2.

drupaldope’s picture

I pretty much need this.
Is there a way to make this work with either 8.1 or 8.2? which patches, files should I use?
many thanks!

ciprian.jitaru’s picture

StatusFileSize
new190.57 KB

I've updated the patch to work with 8.2

ciprian.jitaru’s picture

StatusFileSize
new188.47 KB

Fixed some Annotations errors.

damienmckenna’s picture

Status: Needs work » Needs review
karens’s picture

Status: Needs review » Closed (won't fix)

This module is getting too big. This feature could be added by creating a separate module to provide it which then keeps it from adding to the overhead of everyone who won't use it. I suggest doing that.

Vlad Stratulat’s picture

@KarenS, why don't you want to have all types of Schemas in the same place?
Your modules add Schema.org Metatag after all and following https://schema.org, we can have https://schema.org/MedicalEntity or any other medical related schemas.
Your module is not named Schema.org Article or Schema.org Person, so why having separate module for Schema.org MedicalEntity?

ciprian.jitaru’s picture

StatusFileSize
new190.59 KB

Hello, I've added some missing commas in the annotations.

drupaldope’s picture

excellent, thank you very much!

natemow’s picture

StatusFileSize
new190.93 KB

Patch #16 updated to include D9 compatibility in .info.yml files. Thanks all for pushing this forward!

natemow’s picture

Issue summary: View changes

Went ahead and promoted my sandbox to a full project per @KarenS recs. A 2.2 release was added at https://www.drupal.org/project/schema_medical_entity ...all community contributions from this thread have been rolled in as well. @ciprianjitaru I also added you a maintainer on the project.

@vlad-stratulat I understand your point, and half-agree. But the volume of types in the schema.org hierarchy is growing all the time too -- which ultimately will result in a monolithic project here. I think we'd do well to break things up a bit...maybe a project per top-level type or something.