Sha256: 0a61961d7e2dc982c77ab659eaa136fdca276ad7917145ea24439d692843dba0

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

module Tnql
  grammar TumourType
    rule behaviour
      space behaviour_detail word_break
    end

    rule behaviour_detail
      ('behaviour' space number / 'noninvasive' / 'non-invasive' / 'invasive' / 'metastatic') <Nodes::BehaviourDetailNode>
    end

    rule tumour_type
      space (site_group / names_type / sites) word_break
    end

    rule site_group
      ('brain' / 'breast' / 'endocrine' / 'gynaecological'
      / 'haematological' / 'head' space 'and' space 'neck'
      / 'lower' space 'gi' / 'lung' / 'other' / 'sarcoma'
      / 'skin' / 'upper' space 'gi' / 'urological') <Nodes::SiteGroupNode>
    end

    rule names_type
      ( melanoma / non_melanoma ) word_break
    end

    rule melanoma
      'melanoma' <Nodes::MelanomaNode>
    end

    rule non_melanoma
      ('nmsc' / 'non-melanoma' / 'non' space 'melanoma') <Nodes::NonMelanomaNode>
    end

    rule sites
      first:site rest:more_sites* <Nodes::SitesNode>
    end

    rule more_sites
      ','? space? ('and' space)? site <Nodes::AdditionalSiteNode>
    end

    rule site
      (icd_site / snomed_site) <Nodes::SingleSiteNode>
    end

    rule icd_site
      [cd] [0-9] [0-9] '.'? [0-9]?
    end

    rule snomed_site
      't' [0-9fxy] [0-9fxy] [0-9fxy]? [0-9fxy]? [0-9y]?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tnql-1.1.2 lib/tnql/grammars/tumour_type.treetop
tnql-1.1.1 lib/tnql/grammars/tumour_type.treetop
tnql-1.1.0 lib/tnql/grammars/tumour_type.treetop
tnql-1.0.4 lib/tnql/grammars/tumour_type.treetop
tnql-1.0.3 lib/tnql/grammars/tumour_type.treetop
tnql-1.0.2 lib/tnql/grammars/tumour_type.treetop
tnql-1.0.1 lib/tnql/grammars/tumour_type.treetop
tnql-1.0.0 lib/tnql/grammars/tumour_type.treetop