
    i                     |    d dl Z d dlmZ dZddZd ZddZddZed	k    rd
Z	 e
 ee	d                     dS dS )    Ndeepcopyu0  
You are a medical assistant. From the Hungarian medical report below, determine the presence of the following patient conditions / status indicators. A symptom should be marked only if it is explicitly stated in the text, including unambiguous synonymous medical wording. 

**Categories**

{category_lines_with_short_descriptions}

{answers_section}

Critical Hungarian scope rule:
**If a clause lists items ("comma", "és", "vagy", "szóköz", " " separated, even when the separator is missing) and later contains a cue like
"negatív/pozitív/nincs(nincsen)/nem látható/jelen van/kimutatható/nem mutat/nem igazolható/expresszál",
that cue applies to ALL items in the list within the same clause, unless a strong boundary breaks it (.; or new sentence). Clarification (additive, non-destructive):

Abstract example:
"A B C nincs" → A, B, C are all negative.

When a clause (i.e., a phrase not broken by ., ;, or a new sentence) lists multiple findings — even with missing commas or spaces — and ends with a negation like "nincs", "nem látható", "negatív", etc., the negation applies to every item in that list.**

Report:
```
{content}
```

Return the answer in the following format:

Reasoning:
<very short reasoning tied strictly to explicit text evidence>
JSON:
{lines_with_names_formats}

I repeat: Critical Hungarian scope rule:
**If a clause lists items ("comma", "és", "vagy", "szóköz", " " separated, even when the separator is missing) and later contains a cue like
"negatív/pozitív/nincs(nincsen)/nem látható/jelen van/kimutatható/nem mutat/nem igazolható/expresszál",
that cue applies to ALL items in the list within the same clause, unless a strong boundary breaks it (.; or new sentence). Clarification (additive, non-destructive):

Abstract example:
"A B C nincs" → A, B, C are all negative.

When a clause (i.e., a phrase not broken by ., ;, or a new sentence) lists multiple findings — even with missing commas or spaces — and ends with a negation like "nincs", "nem látható", "negatív", etc., the negation applies to every item in that list.**
symptoms.yamlc                     t          | dd          5 }t          j        |          }d d d            n# 1 swxY w Y   |S )Nrzutf-8)encoding)openyaml	safe_load)pathfschemas      #/var/www/sze-llm.hu/auto_prompts.pyload_schemar   /   s}    	dC'	*	*	* #a""# # # # # # # # # # # # # # #Ms   488c                 Z    d| vr| S t          || d                            }i || }|d= |S )Nextendsr   )fielddefaultsbasemergeds       r   resolve_fieldr   5   sE    HU9-.//DFyM    c                 N   |                      di           |                      dg           }fd|D             }||}n8	 t          |          n# t          t          f$ r |Y nw xY wfd|D             }t	          d |D                       }g }|D ]}|d         }|                     dd	          }	|                     d
g           pg }
d	}|
rdd                    |
          z   }|	rd| d|	 | d}n"|
rd| d|                                 dnd| }|                    |           d                    |          }g }|D ]<}|d         }|                     dd          }|                    d| d| d           =dd                    |          z   dz   }|||fS )z{Build prompt sections.

    If `group_id` is not None, only include fields whose `group_id` equals the provided value.
    r   fieldsc                 0    g | ]}t          |          S  )r   ).0r   r   s     r   
<listcomp>z"build_sections.<locals>.<listcomp>F   s#    ???1M!X..???r   Nc                 F    g | ]}|                     d           k    |S group_id)get)r   r   gids     r   r   z"build_sections.<locals>.<listcomp>Q   s/    HHH!quuZ/@/@C/G/GA/G/G/Gr   c              3      K   | ]F}|                     d           dk    o(t          |                     dg                     h dk    V  GdS )typeenumvalues>   Not mentionedNoYesN)r"   set)r   r   s     r   	<genexpr>z!build_sections.<locals>.<genexpr>S   sl         	
f^Ch(;(;$<$<@^@^@^$^     r   labeldescription 
aliases_huz HU aliases: z, z- z ()
keyformat_hintz<value>z  "z": ""z{
z,
z
})r"   int	TypeError
ValueErroranyjoinstripappend)r   r!   r   resolved_allresolvedhas_tristatecategory_linesr   r-   descaliases
alias_partlinecategories_text
json_linesr3   hint	json_textr   r#   s                     @@r   build_sectionsrI   >   sM   
 zz*b))HZZ"%%F???????L 	h--CC:& 	 	 	CCC	HHHH|HHH      L N $ $'
uu]B''%%b))/R
 	>(499W+=+==J 	T4444z444DD ;BS666!1!1!3!36666|E||Dd####ii//O J 2 2huu]I..0000001111

:...6II|33s   A A)(A)c                     t          |          }t          ||          \  }}}|rd}nd}t                              ||| |          S )Nr    uR  **Answers** (only for fields whose expected format is `Yes/No/Not mentioned`)

- `Yes`  (requires a clear positive mention; if it is only loosely indicated that's not enough evidence)
- `No`   (requires a clear negative mention; if it is only loosely indicated that's not enough evidence)
- `Not mentioned` (if the symptom is not explicitly referenced, or just very weakly implied)

For non-tri-state fields (e.g., numeric or free-text fields), follow the field’s required output format shown in the JSON template (e.g., return a number or `null`, or return short bullet points / `No info`).
r/   )&category_lines_with_short_descriptionslines_with_names_formatscontentanswers_section)r   rI   prompt_templateformat)report_textschema_pathr!   r   rE   rH   r?   rN   s           r   build_promptrS   y   si    %%F/=fx/X/X/X,OY 
 !!/>!*'	 "   r   __main__u'   CD10 pozitív, CD56 nincs kimutatható.   r    )r   )N)r   N)r
   copyr   rO   r   r   rI   rS   __name__sampleprintr   r   r   <module>rZ      s          (V     84 84 84 84v   0 z6F 
E,,v
*
*
*+++++	 r   