Skip to content

Commit

Permalink
escapes html chars in ebi search dump
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyRogers committed Nov 16, 2023
1 parent d18573c commit 28908ca
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion emgapi/management/commands/ebi_search_analysis_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_analysis_context(self, analysis: AnalysisJob):
try:
indexable_value = float(indexable_value.strip())
except ValueError:
logger.warning(
logger.debug(
f"Could not float-parse supposedly numeric field {indexable_name} : {indexable_value}")
continue
sample_metadata[
Expand Down
30 changes: 15 additions & 15 deletions emgapi/templates/ebi_search/analysis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,57 @@
<additional_fields>
<field name="experiment_type">assembly</field>
<field name="pipeline_version">{{ analysis.pipeline.release_version }}</field>
<field name="sample_name">{{ analysis.sample.sample_name | safe }}</field>
<field name="project_name">{{ analysis.study.study_name | safe }}</field>
<field name="biome_name">{{ analysis.study.biome.biome_name | safe }}</field>
<field name="sample_name">{{ analysis.sample.sample_name | escape }}</field>
<field name="project_name">{{ analysis.study.study_name | escape }}</field>
<field name="biome_name">{{ analysis.study.biome.biome_name | escape }}</field>

{% if analysis.sample.species %}
<field name="species">{{ analysis.sample.species | safe }}</field>
<field name="species">{{ analysis.sample.species | escape }}</field>
{% endif %}

{% if analysis.sample.environment_feature %}
<field name="feature">{{ analysis.sample.environment_feature | safe }}</field>
<field name="feature">{{ analysis.sample.environment_feature | escape }}</field>
{% endif %}

{% if analysis.sample.environment_material %}
<field name="material">{{ analysis.sample.environment_material | safe }}</field>
<field name="material">{{ analysis.sample.environment_material | escape }}</field>
{% endif %}

<field name="sample_alias">{{ analysis.sample.sample_alias | safe }}</field>
<field name="project_name">{{ analysis.study.study_name | safe }}</field>
<field name="sample_alias">{{ analysis.sample.sample_alias | escape }}</field>
<field name="project_name">{{ analysis.study.study_name | escape }}</field>

<hierarchical_field name="biome">
{% for biome_element in analysis_biome %}
{% if forloop.first %}
<root>{{ biome_element | safe }}</root>
<root>{{ biome_element | escape }}</root>
{% else %}
<child>{{ biome_element | safe }}</child>
<child>{{ biome_element | escape }}</child>
{% endif %}
{% endfor %}
</hierarchical_field>

{% for metadata_key, metadata_value in sample_metadata.items %}
<field name="{{ metadata_key | safe }}">{{ metadata_value | safe }}</field>
<field name="{{ metadata_key | escape }}">{{ metadata_value | escape }}</field>
{% endfor %}

{% for taxonomy_lineage_elements in analysis_taxonomies %}
<hierarchical_field name="organism">
{% for taxonomy_element in taxonomy_lineage_elements %}
{% if forloop.first %}
<root>{{ taxonomy_element | safe }}</root>
<root>{{ taxonomy_element | escape }}</root>
{% else %}
<child>{{ taxonomy_element | safe }}</child>
<child>{{ taxonomy_element | escape }}</child>
{% endif %}
{% endfor %}
</hierarchical_field>
{% endfor %}

{% for go_slim in analysis_go_entries %}
<field name="go_term">{{ go_slim.description | safe }}</field>
<field name="go_term">{{ go_slim.description | escape }}</field>
{% endfor %}

{% for ips in analysis_ips_entries %}
<field name="interpro_entry">{{ ips.description | safe }}</field>
<field name="interpro_entry">{{ ips.description | escape }}</field>
{% endfor %}
</additional_fields>
<cross_references>
Expand Down
10 changes: 5 additions & 5 deletions emgapi/templates/ebi_search/projects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{% for addition in additions %}
{% with addition.study as study %}
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="{{ study.accession }}">
<name>{{ study.study_name | safe }}</name>
<description>{{ study.study_abstract | safe }}</description>
<name>{{ study.study_name | escape }}</name>
<description>{{ study.study_abstract | escape }}</description>
<dates>
<date type="creation_date" value="{{ study.first_created|date:'Y-m-d' }}"/>
<date type="last_modification_date" value="{{ study.last_update|date:'Y-m-d' }}"/>
Expand All @@ -19,13 +19,13 @@
<hierarchical_field name="biome">
{% for biome_element in addition.biome_list %}
{% if forloop.first %}
<root>{{ biome_element | safe }}</root>
<root>{{ biome_element | escape }}</root>
{% else %}
<child>{{ biome_element | safe }}</child>
<child>{{ biome_element | escape }}</child>
{% endif %}
{% endfor %}
</hierarchical_field>
<field name="centre_name">{{ study.centre_name | safe }}</field>
<field name="centre_name">{{ study.centre_name | escape }}</field>
</additional_fields>
<cross_references>
<ref dbkey="{{ study.project_id }}" dbname="ena_project"/>
Expand Down
2 changes: 1 addition & 1 deletion emgcli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "2.4.38"
__version__: str = "2.4.39"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ max-line-length = 119
"""

[tool.bumpversion]
current_version = "2.4.38"
current_version = "2.4.39"

[[tool.bumpversion.files]]
filename = "emgcli/__init__.py"

0 comments on commit 28908ca

Please sign in to comment.