kyauy commited on
Commit
4bd4fd8
·
1 Parent(s): 35fc1b6

feat(output): #1 add PhenoGenius output format

Browse files
Files changed (1) hide show
  1. lf_app.py +17 -1
lf_app.py CHANGED
@@ -595,7 +595,6 @@ def reformat_to_letter(text, _nlp):
595
  def convert_df(df):
596
  return df.to_csv(sep="\t", index=False).encode("utf-8")
597
 
598
-
599
  @st.cache_data(max_entries=60)
600
  def convert_df_no_header(df):
601
  return df.to_csv(sep="\t", index=False, header=None).encode("utf-8")
@@ -612,6 +611,14 @@ def convert_json(df):
612
  else:
613
  return json.dumps(dict_return)
614
 
 
 
 
 
 
 
 
 
615
  @st.cache_data(max_entries=30)
616
  def add_biometrics(text, _nlp):
617
  cutsentence_with_biometrics = []
@@ -918,3 +925,12 @@ if submit_button or st.session_state.load_state:
918
  key="download-summarization-json",
919
  )
920
 
 
 
 
 
 
 
 
 
 
 
595
  def convert_df(df):
596
  return df.to_csv(sep="\t", index=False).encode("utf-8")
597
 
 
598
  @st.cache_data(max_entries=60)
599
  def convert_df_no_header(df):
600
  return df.to_csv(sep="\t", index=False, header=None).encode("utf-8")
 
611
  else:
612
  return json.dumps(dict_return)
613
 
614
+ @st.cache_data(max_entries=60)
615
+ def convert_list_phenogenius(df):
616
+ if len(df) > 0:
617
+ return ",".join(df['HPO ID'].to_list())
618
+ else:
619
+ return "No HPO in letters."
620
+
621
+
622
  @st.cache_data(max_entries=30)
623
  def add_biometrics(text, _nlp):
624
  cutsentence_with_biometrics = []
 
925
  key="download-summarization-json",
926
  )
927
 
928
+ st.download_button(
929
+ "Download summarized letter in PhenoGenius list of HPO format",
930
+ convert_list_phenogenius(clinphen_df),
931
+ nom + "_" + prenom + "_summarized_letter_list_phenogenius.tsv",
932
+ "text",
933
+ key="download-summarization-phenogenius",
934
+ )
935
+
936
+