dep:
  - v_cancero_1
  - v_listes_3
src: |
  SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIR1'::text AND p_rss.age >= 18::numeric AND (p_rss.ghm_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI000001G'::text)) AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001002D'::text))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIR2'::text AND p_rss.age >= 18::numeric AND (p_rss.ghm_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI000001G'::text)) AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001004D'::text))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIR3'::text AND p_rss.age >= 18::numeric AND (p_rss.ghm_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI000002G'::text)) AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001003D'::text))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIR4'::text AND p_rss.age >= 18::numeric AND (p_rss.ghm_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI000001G'::text)) AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001005D'::text)) AND NOT (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001026D'::text))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIR5'::text AND p_rss.age >= 18::numeric AND (p_rss.ghm_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI000003G'::text)) AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001006D'::text))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIR6'::text AND p_rss.age >= 18::numeric AND (p_rss.ghm_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI000001G'::text)) AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001001D'::text))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'RAD1'::text AND p_rss.age >= 18::numeric AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001008D'::text)) AND (p_rss.oid IN ( SELECT p_rss_diagnostics.rss_id
             FROM pmsi.p_rss_diagnostics
            WHERE (p_rss_diagnostics.diagnostic_id IN ( SELECT v_listes_3.to_id
                     FROM pmsi.v_listes_3
                    WHERE v_listes_3.liste_code = 'CTI001007D'::text))))
  UNION
   SELECT ascii(substr(v_cancero_1.code, 4, 1)) + ascii(substr(v_cancero_1.code, 5, 1)) AS cancero_principal_id,
      v_cancero_1.code AS cancero_principal_code,
      v_cancero_1.texte AS cancero_principal_texte,
      v_cancero_1.texte_court AS cancero_principal_texte_court,
      v_cancero_1.activite_id AS activite_cancero_principal_id,
      v_cancero_1.activite_code AS activite_cancero_principal_code,
      v_cancero_1.activite_texte AS activite_cancero_principal_texte,
      p_rss.oid AS rss_id
     FROM pmsi.p_rss,
      pmsi.v_cancero_1
    WHERE p_rss.etat <> 'S'::bpchar AND v_cancero_1.code = 'CHIM1'::text AND p_rss.age >= 18::numeric AND (p_rss.diagnostic_principal_id IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI001009D'::text)) AND (p_rss.oid IN ( SELECT p_rss_diagnostics.rss_id
             FROM pmsi.p_rss_diagnostics
            WHERE (p_rss_diagnostics.diagnostic_id IN ( SELECT v_listes_3.to_id
                     FROM pmsi.v_listes_3
                    WHERE v_listes_3.liste_code = 'CTI001007D'::text))));