github.com/hscells/guru@v0.0.0-20200207042420-2dabeb950d69/medgen_test.go (about)

     1  package guru
     2  
     3  import (
     4  	"bytes"
     5  	"encoding/xml"
     6  	"fmt"
     7  	"testing"
     8  )
     9  
    10  var data = `<eSummaryResult>
    11      <DocumentSummarySet status="OK">
    12          <DbBuild>Build190315-0747.1</DbBuild>
    13          <DocumentSummary uid="428">
    14              <ConceptId>C0004031</ConceptId>
    15              <Title>Allergic bronchopulmonary aspergillosis</Title>
    16              <Definition></Definition>
    17              <SemanticId>T047</SemanticId>
    18              <SemanticType>Disease or Syndrome</SemanticType>
    19              <Suppressed/>
    20              <ConceptMeta>
    21                  <Names>
    22                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="PM" type="syn">Allergic Aspergilloses, Bronchopulmonary</Name>
    23                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="PM" type="syn">Allergic Aspergillosis, Bronchopulmonary</Name>
    24                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="PM" type="syn">Aspergilloses, Bronchopulmonary Allergic</Name>
    25                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="MH" type="syn">Aspergillosis, Allergic Bronchopulmonary</Name>
    26                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="PM" type="syn">Bronchopulmonary Allergic Aspergilloses</Name>
    27                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="PM" type="syn">Bronchopulmonary Allergic Aspergillosis</Name>
    28                      <Name SCUI="C84547" CODE="C84547" SAB="NCI" TTY="PT" type="syn">Allergic Bronchopulmonary Aspergillosis</Name>
    29                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="ET" type="syn">Bronchopulmonary Aspergillosis, Allergic</Name>
    30                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="ET" type="syn">Allergic Bronchopulmonary Aspergillosis</Name>
    31                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="ET" type="syn">Allergic Bronchopulmonary Aspergilloses</Name>
    32                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="ET" type="syn">Aspergillosis, Bronchopulmonary Allergic</Name>
    33                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="ET" type="syn">Bronchopulmonary Aspergilloses, Allergic</Name>
    34                      <Name SDUI="D001229" SCUI="M0001851" CODE="D001229" SAB="MSH" TTY="ET" type="syn">Aspergilloses, Allergic Bronchopulmonary</Name>
    35                      <Name SCUI="37981002" CODE="37981002" SAB="SNOMEDCT_US" TTY="PT" type="preferred">Allergic bronchopulmonary aspergillosis</Name>
    36                      <Name SCUI="37981002" CODE="37981002" SAB="SNOMEDCT_US" TTY="SY" type="syn">ABPA - Allergic bronchopulmonary aspergillosis</Name>
    37                      <Name SDUI="Orphanet_1164" CODE="AN0440356" SAB="ORDO" TTY="PT" type="preferred">Allergic bronchopulmonary aspergillosis</Name>
    38                      <Name SDUI="Orphanet_1164" CODE="AN0450565" SAB="ORDO" TTY="SYN" type="syn">ABPA</Name>
    39                      <Name SDUI="Orphanet_1164" CODE="AN0450566" SAB="ORDO" TTY="SYN" type="syn">Allergic aspergillosis</Name>
    40                      <Name SDUI="Orphanet_1164" CODE="AN0450567" SAB="ORDO" TTY="SYN" type="syn">Hinson-Pepys disease</Name>
    41                  </Names>
    42                  <Definitions>
    43                      <Definition source="NCI">An immune reaction to aspergillus in patients usually suffering from asthma or cystic fibrosis.</Definition>
    44                  </Definitions>
    45                  <ModesOfInheritance>
    46                      <ModeOfInheritance uid="141047" CUI="C0443147" TUI="T170">
    47                          <Name>Autosomal dominant inheritance</Name>
    48                          <SemanticType>Intellectual Product</SemanticType>
    49                          <Definition>A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele.</Definition>
    50                          <SAB>HPO</SAB>
    51                          <SAB>OMIM</SAB>
    52                          <SAB>ORDO</SAB>
    53                      </ModeOfInheritance>
    54                      <ModeOfInheritance uid="832438" CUI="CN227390" TUI="T170">
    55                          <Name>not inherited</Name>
    56                          <SemanticType>Intellectual Product</SemanticType>
    57                          <Definition>Describes a disorder that is not inherited.</Definition>
    58                          <SAB>ORDO</SAB>
    59                      </ModeOfInheritance>
    60                  </ModesOfInheritance>
    61                  <PharmacologicResponse/>
    62                  <PharmacologicResponse/>
    63                  <OMIM/>
    64                  <ClinicalFeatures>
    65                      <ClinicalFeature uid="867388" CUI="C4021753" TUI="T046" SDUI="HP:0002715">
    66                          <Name>Abnormality of the immune system</Name>
    67                          <SemanticType>Pathologic Function</SemanticType>
    68                          <Definition>An abnormality of the immune system.</Definition>
    69                      </ClinicalFeature>
    70                  </ClinicalFeatures>
    71                  <PhenotypicAbnormalities>
    72                      <Category CUI="C4021753" name="Abnormality of the immune system">
    73                          <ClinicalFeature uid="867388" CUI="C4021753" TUI="T046">
    74                              <SemanticType>Pathologic Function</SemanticType>
    75                              <Name>Abnormality of the immune system</Name>
    76                              <Definition>An abnormality of the immune system.</Definition>
    77                          </ClinicalFeature>
    78                      </Category>
    79                  </PhenotypicAbnormalities>
    80                  <RelatedDisorders/>
    81                  <SNOMEDCT>
    82                      <Name SAUI="1229371018" SCUI="37981002" SAB="SNOMEDCT_US" TTY="SY">ABPA - Allergic bronchopulmonary aspergillosis</Name>
    83                      <Name SAUI="63349014" SCUI="37981002" SAB="SNOMEDCT_US" TTY="PT">Allergic bronchopulmonary aspergillosis</Name>
    84                  </SNOMEDCT>
    85                  <AssociatedGenes/>
    86                  <ORDO>
    87                  </ORDO>
    88                  <SemanticTypes>
    89                      <SemanticType TUI="T047">Disease or Syndrome</SemanticType>
    90                  </SemanticTypes>
    91              </ConceptMeta>
    92              <ModificationDate/>
    93              <Merged/>
    94          </DocumentSummary>
    95      </DocumentSummarySet>
    96  </eSummaryResult>`
    97  
    98  func TestName(t *testing.T) {
    99  	var summary CeSummaryResult
   100  	err := xml.NewDecoder(bytes.NewBufferString(data)).Decode(&summary)
   101  	if err != nil {
   102  		panic(err)
   103  	}
   104  	fmt.Println(summary)
   105  }