FHIR Chat · modeling component (Observation) in HAPI · hapi

Stream: hapi

Topic: modeling component (Observation) in HAPI


view this post on Zulip Peter Robinson (Mar 25 2022 at 17:42):

Hi everybody, I am working on a Java class to model a profiled resource of the GA4GH Phenopacket (http://phenopackets.org/core-ig/StructureDefinition-phenopackets-variant.html). The resource extends Observation and makes use of the components list. I would like to know how to model each of these components in a Java HAPI FHIR class. Is there a good example?

Here is the signature of the class

@ResourceDef(
profile="https://github.com/phenopackets/core-ig/StructureDefinition/PhenopacketsVariant")
public class PhenopacketsVariant extends Observation
// ???
}

Here is the corresponding FSH code:

Profile: PhenopacketsVariant
Parent: http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/variant // Genomics Reporting Variant profile
Id: phenopackets-variant
Title: "Phenopackets Variant"
Description: "A profile of Genomics Reporting Variant profile that represents relevant phenopackets building blocks."

  • ^status = #draft // This would be changed later to active
  • ^version = "0.1.0"
  • ^date = "2021-10-18T06:00:00-04:00"
  • ^publisher = "GA4GH Phenopacket Working Group"
  • ^contact.name = "Aly Khalifa"
    //* ^short = "A phenopackets profile of the genomics reporting Variant profile. It represents
    //phenopackets GeneDescriptor, VariationDescriptor, VcfRecord, and VariantInterpretation building blocks."
    //This is a placeholder for all Must-support elements (MS). Based on a team discussion, all elements should be MS.

  • component[gene-studied] and
    component[ref-sequence-assembly] and
    component[cytogenetic-location] and

view this post on Zulip Peter Robinson (Mar 26 2022 at 15:38):

I think I figured this out. It needs to be like this

/**

 * We want have something like this:
 * Note that 48001-2  Cytogenetic (chromosome) location
 *  <component>
 *     <code>
 *       <coding>
 *         <system value="http://loinc.org"/>
 *         <code value="48001-2"/>
 *       </coding>
 *     </code>
 *     <valueCodeableConcept>
 *       <coding>
 *         <system value="http://loinc.org"/>
 *         <code value="LA21263-1"/>
 *         <display value="10"/>
 *       </coding>
 *     </valueCodeableConcept>
 *   </component>
 * @param loincCode the LOINC code to represent a chromosome, e.g., "LA21263-1" for chromosome 10
 * @param display The display value, e.g., "10" for chromosome 10
 */
public void setCytogeneticLocation(String loincCode, String display) {
    Coding loincCytogeneticCoding = new Coding();
    loincCytogeneticCoding.setSystem(LOINC_SYSTEM)
            .setCode(LOINC_CYTOGENETIC_CHROMOSOME_LOCATION_ID)
            .setDisplay(LOINC_CYTOGENETIC_CHROMOSOME_LOCATION_DISPLAY);
    CodeableConcept cytogeneticCodeableConcept = new CodeableConcept().addCoding(loincCytogeneticCoding);
    Coding chromosomeCoding = new Coding();
    chromosomeCoding.setSystem(LOINC_SYSTEM)
            .setCode(loincCode)
            .setDisplay(display);
    CodeableConcept cc = new CodeableConcept();
    cc.addCoding(chromosomeCoding);
    ObservationComponentComponent occ = new ObservationComponentComponent();
    occ.setCode(cytogeneticCodeableConcept);
    occ.setValue(chromosomeCoding);
    this.addComponent(occ);
}

Last updated: Apr 12 2022 at 19:14 UTC