populationgenomics / metamist

Sample level metadata system
MIT License
1 stars 1 forks source link

Update SG meta typing to dict[str, Any] #799

Closed EddieLF closed 2 months ago

EddieLF commented 2 months ago

This updates the sequencing group model to allow the meta dict to take any type of value, not just strings.

While most of the other models with meta fields (e.g. participant, sample) are typed with meta: dict, the meta dict for the model assay is typed: dict[str, Any]. This would match that typing for sequencing group meta.

If we should limit sequencing group meta dicts to only contain string values it would be good to know why. Also not sure if this would require a bumpversion to release.


I encountered this when trying to upsert a sequencing group with a meta dict that included {"haplotag": true}. The HTTP request returned a 422 exception:

File ".../venv/lib/python3.11/site-packages/metamist/rest.py", line 225, in request
    raise ApiException(http_resp=r)
metamist.exceptions.ApiException: (422)
...
HTTP response body: {"detail":[
    {
     "type":"string_type",
     "loc":["body",0,"samples",0,"sequencing_groups",0,"meta","dict[str,str]","haplotag"],
     "msg":"Input should be a valid string",
     "input":true
    }, ...
]
codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.03%. Comparing base (c02ecc3) to head (ac08fe1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #799 +/- ## ======================================= Coverage 77.03% 77.03% ======================================= Files 157 157 Lines 13067 13068 +1 ======================================= + Hits 10066 10067 +1 Misses 3001 3001 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.