Skip to content

Building pages fails when disorder name is not present #274

@caufieldjh

Description

@caufieldjh

The render_all_disorders function encounters a KeyError if there is not a disorder["name"].

The schema uses name as an identifier in this and other classes but it is not required, so if it needs to be used to render a filename then there will need to be a backup option.
Or this can be a required value for disorder pages.

Example (from https://github.com/monarch-initiative/dismech/actions/runs/21783332536/job/62850730249):

Run just gen-pages
uv run python -m dismech.render --all
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/runner/work/dismech/dismech/src/dismech/render.py", line 622, in <module>
    main()
    ~~~~^^
  File "/home/runner/work/dismech/dismech/src/dismech/render.py", line 613, in main
    render_all_disorders(input_dir, output_dir, template_path)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/dismech/dismech/src/dismech/render.py", line 570, in render_all_disorders
    output_path = output_dir / f'{slugify(disorder["name"])}.html'
                                          ~~~~~~~~^^^^^^^^
KeyError: 'name'
Rendered comorbidity: com_Atopic_Dermatitis__Type_2_Diabetes_Mellitus -> pages/comorbidities/com_Atopic_Dermatitis__Type_2_Diabetes_Mellitus.html
Rendered comorbidity: com_Type_2_Diabetes_Mellitus__Lichen_Simplex_Chronicus__Prurigo_Nodularis -> pages/comorbidities/com_Type_2_Diabetes_Mellitus__Lichen_Simplex_Chronicus__Prurigo_Nodularis.html
Rendered: 22q11.2 Deletion Syndrome -> pages/disorders/22q11.2_Deletion_Syndrome.html
error: Recipe `gen-pages` failed on line 383 with exit code 1
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions