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

Engine endpoints #9

Merged
merged 1 commit into from
Mar 30, 2020
Merged

Engine endpoints #9

merged 1 commit into from
Mar 30, 2020

Conversation

zfletch
Copy link
Member

@zfletch zfletch commented Mar 30, 2020

Implement the /engine and /engine/:engine endpoints in both JSON and XML.

The /engine endpoint lists all available engines. The /engine/:engine endpoint lists information about one particular engine.

This PR also adds the strictCase option.

<supportsLanguageCode>grc</supportsLanguageCode>
<supportsLanguageCode>la</supportsLanguageCode>
<supportsLanguageCode>lat</supportsLanguageCode>
<supportsOption>strictCase=^1$</supportsOption>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Perseids version of Morphsvc has the options strictCase and checkPreverbs. I removed checkPreverbs because it doesn't seem to do anything. The functionality is commented out in the Morpheus code.

The Alpheios version supports noAposRetry (code). @balmas do you think it's worth adding this functionality? Was there a particular word or set of words that caused you to add this to the Alpheios version?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the issue from Alpheios that led to this change: alpheios-project/data-models#61

The need (or not) for it depends upon how sensitive you want to be to tokenization and encoding errors. Alpheios tries to work with any Greek text on the web, which means we have to account for various possibilities that might not be so important for Perseids.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that makes sense.

set :port, Config::PORT

namespace '/raw' do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the files changed in this PR are a changed as a result of splitting this up into multiple files. The changes relevant to the engine functionality are:

  • lib/engine.rb
  • lib/engine_list.rb
  • routes/engine.rb

@zfletch zfletch requested a review from balmas March 30, 2020 12:20
code = 404
response = Error.new('unknown engine')
else
code = 200
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replicated the functionality in Morphsvc. But I'm confused about why the /engine endpoints return a 200 ok while the /analysis endpoints return 201 created.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 201 response was a continuation of the concept that what the morphology service was doing was creating a new Annotation resource for each request, as opposed to returning a static document. It's a legacy of the infrastructure it was meant to be a part of. Under the current implementation, it probably makes more sense for it to return 200 for the /analysis endpoint.

Implement the `/engine` and `/engine/:engine` endpoints in both JSON and
XML.

The `/engine` endpoint lists all available engines. The
`/engine/:engine` endpoint lists information about one particular
engine.
Copy link
Collaborator

@balmas balmas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

<supportsLanguageCode>grc</supportsLanguageCode>
<supportsLanguageCode>la</supportsLanguageCode>
<supportsLanguageCode>lat</supportsLanguageCode>
<supportsOption>strictCase=^1$</supportsOption>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the issue from Alpheios that led to this change: alpheios-project/data-models#61

The need (or not) for it depends upon how sensitive you want to be to tokenization and encoding errors. Alpheios tries to work with any Greek text on the web, which means we have to account for various possibilities that might not be so important for Perseids.

code = 404
response = Error.new('unknown engine')
else
code = 200
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 201 response was a continuation of the concept that what the morphology service was doing was creating a new Annotation resource for each request, as opposed to returning a static document. It's a legacy of the infrastructure it was meant to be a part of. Under the current implementation, it probably makes more sense for it to return 200 for the /analysis endpoint.

@zfletch
Copy link
Member Author

zfletch commented Mar 30, 2020

Thanks for reviewing!

@zfletch zfletch merged commit 402cb4b into master Mar 30, 2020
@zfletch zfletch deleted the engines branch March 30, 2020 14:46
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

Successfully merging this pull request may close these issues.

None yet

2 participants