-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bibliography API and listing functionality #320
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #320 +/- ##
==========================================
- Coverage 60.29% 59.53% -0.76%
==========================================
Files 29 29
Lines 4181 4298 +117
Branches 491 497 +6
==========================================
+ Hits 2521 2559 +38
- Misses 1169 1242 +73
- Partials 491 497 +6 ☔ View full report in Codecov by Sentry. |
I bumped the version to 1.5.9.0, so I expect this to be merged in after #318. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks great and trident list --bibliography
behaves as expected. I think, though, that the default table output is too wide. Maybe some columns can be omitted here (Journal? Author?).
I'll later test the server-client interaction with this new API feature.
@@ -1,5 +1,5 @@ | |||
name: poseidon-hs | |||
version: 1.5.7.4 | |||
version: 1.5.9.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably 1.6.1.0 as things stand right now on the master branch.
"Bibliography field " ++ bibFieldKey ++ "is not present in any bibliography entry" | ||
_ -> return () | ||
|
||
let tableH = ["BibKey", "Title", "Author", "Year", "Journal", "Doi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doi -> DOI
This PR finally adds a new Server API
/bibliography
as well as a new command-line optiontrident list --bibliography
to gather bibliography information.The feature is straight-forward in terms of usability.
In terms of implementation, I have made some additional changes to the Aeson interface specifically for the Server Communication. Specifically I looked a bit closer how Aeson encodes for
Nothing
s inMaybe
types, and found out that by default these get encoded asnull
in objects. This is slightly wasteful, as null-fields can also simply be omitted in a given object. When decoding into Haskell types again, we anyway use the operator.:?
, which takes care of interpreting missing keys in objects asNothing
s. I have therefore added a small function calledremoveNulls
inServerClient.hs
to remove null-fields from objects. Not sure how big the effect is, but it was simple enough and I'm glad I now understandMaybe
-encoding in Aeson better. The newest version of Aeson (>2.2.2.0) actually adds an encoding operator to remove null-values, which will eventually make my function redundant, but that latest version isn't even in the latest LTS, so it'll be some time.Running the new bibliography function on the Community-Archive reveals some gaps in our bibliography records, which we can easily fix with a bit of curation work.