Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: csv parsers fail with html tag containing fields #11

Open
bsipocz opened this issue Jun 1, 2022 · 0 comments
Open

BUG: csv parsers fail with html tag containing fields #11

bsipocz opened this issue Jun 1, 2022 · 0 comments

Comments

@bsipocz
Copy link

bsipocz commented Jun 1, 2022

I see this error in astroquery for a while, and traced it back to parsing the alias field, where it has a HTML tag. Neither cvs, google spreadsheet nor astropy's Table.read could parse it correctly. All the while the JSON format seems to work as expected.

I'm not sure whether this is a database entry issue or API issue. Likely the former as other objects parse OK, though idealy the API could do a sanity check for the values.

However, we didn't receive any user complaints, and I'm not sure so I just go ahead and will remove the data_format kwarg, as it shouldn't really matter to the astroquery end user what format was used in the query for the server.

<a id="PSNJ09554214+6940260">PSN J09554214+6940260</a>,iPTF14jj"

https://api.astrocats.space/SN2014J?format=csv

event,radiolink,references,maxabsmag,hostoffsetang,galactocentricvelocity,discoverdate,redshift,boundprobability,masses,maxappmag,host,instruments,xraylink,hostra,maxdate,claimedtype,lumdist,spectralink,color,ebv,velocity,download,alias,dec,name,spectraltype,propermotiondec,ra,photolink,propermotionra,discoverer,catalog,hostoffsetdist,escapevelocity,hostdec,stellarclass
SN2014J,0,"2012PASP..124..668Y,2015arXiv151006596G,2014AJ....148....1Z,2018PASP..130f4101V,2019MNRAS.490.3882S",-18.4,55.63,,2014/01/21,"0.000677,0.000739,0.000841",,,8.98,"NGC 3034,M82","IRAC (I1, I2), UVOT (W2, W1, M2, U, B, V), VLA, CLEAR, U, B, g, g', V, r, r', R, i, i', I, z, z'",,09:55:52,2014/01/31,"Ia,Ia-HV",2.998,"133,-8.49,351",,0.1358,300,e,"SN2014J,PSN J09554214+6940260,<a id="PSNJ09554214+6940260">PSN J09554214+6940260</a>,iPTF14jj","+69:40:25.9,+69:40:26.0",SN2014J,,,"09:55:42.12,09:55:42.14","1482,-15.1,442",,"Fossey et al.,Steve J. Fossey",sne,0.8813,,+69:40:47,

Edit: downstream workaround ended up being removing the HTML tag: astropy/astroquery#2423

https://api.astrocats.space/SN2014J?format=json

{"SN2014J": {"radiolink": ["0"], "references": ["2012PASP..124..668Y,2015arXiv151006596G,2014AJ....148....1Z,2018PASP..130f4101V,2019MNRAS.490.3882S"], "maxabsmag": [{"value": "-18.4"}], "hostoffsetang": [{"value": "55.63"}], "galactocentricvelocity": [], "discoverdate": [{"value": "2014/01/21"}], "redshift": [{"value": "0.000677"}, {"value": "0.000739"}, {"value": "0.000841"}], "boundprobability": [], "masses": [], "maxappmag": [{"value": "8.98"}], "host": [{"value": "NGC 3034"}, {"value": "M82"}], "instruments": ["IRAC (I1, I2), UVOT (W2, W1, M2, U, B, V), VLA, CLEAR, U, B, g, g', V, r, r', R, i, i', I, z, z'"], "xraylink": [], "hostra": [{"value": "09:55:52"}], "maxdate": [{"value": "2014/01/31"}], "claimedtype": [{"value": "Ia"}, {"value": "Ia-HV"}], "lumdist": [{"value": "2.998"}], "spectralink": ["133,-8.49,351"], "color": [], "ebv": [{"value": "0.1358"}], "velocity": [{"value": "300", "kind": "host"}], "download": ["e"], "alias": [{"value": "SN2014J"}, {"value": "PSN J09554214+6940260"}, {"value": "<a id=\"PSNJ09554214+6940260\">PSN J09554214+6940260</a>"}, {"value": "iPTF14jj"}], "dec": [{"value": "+69:40:25.9"}, {"value": "+69:40:26.0"}], "name": ["SN2014J"], "spectraltype": [], "propermotiondec": [], "ra": [{"value": "09:55:42.12"}, {"value": "09:55:42.14"}], "photolink": ["1482,-15.1,442"], "propermotionra": [], "discoverer": [{"value": "Fossey et al."}, {"value": "Steve J. Fossey"}], "catalog": ["sne"], "hostoffsetdist": [{"value": "0.8813"}], "escapevelocity": [], "hostdec": [{"value": "+69:40:47"}], "stellarclass": []}}
@bsipocz bsipocz changed the title BUG: csv parsers fail with too complex fields BUG: csv parsers fail with html tag containing fields Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant