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

Come up with a way to allow for localization of species #506

Open
Sheeri opened this issue Jan 25, 2022 · 1 comment
Open

Come up with a way to allow for localization of species #506

Sheeri opened this issue Jan 25, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@Sheeri
Copy link
Collaborator

Sheeri commented Jan 25, 2022

For Global and Agency Administrators only.

Agencies -> Form Data -> species

Right now this is just a text entry. However, we would like to be able to globally follow a species. As this is a free-form text field, an agency or global administrator can put anything in this field. We want to associate it with a species - for example, Orcinus orca is the Latin name for "Killer Whale", which in French is "Orque".

This will take a lot of work to implement and it would be great if the mobile apps did not have to be changed (I am not sure that's possible, however!).

@Sheeri Sheeri added the enhancement New feature or request label Jan 25, 2022
@Sheeri
Copy link
Collaborator Author

Sheeri commented Jan 25, 2022

One idea is to store each species as an object instead of a string - right now "species" is an array in the "MenuData" collection, for example:

Current format:

> db.MenuData.find({agency: "Test Agency"}).pretty()
{
	"_id" : ObjectId("xxxxxxxxxxxxxxx"),
	"agency" : "Test Agency",
	"species" : [
		"Atún negro",
		"Marlín Negro",
		"Tiburón Cornuda Gigante",
	],
       "activity": [ ....

But if they were stored as objects, they could be something like this:

{
	"_id" : ObjectId("xxxxxxxxxxxxxxx"),
	"agency" : "A Spanish Agency",
	"species" : [
		{ local: "Atún negro", latin: "Katsuwonus pelamis" },
                 { local: "Marlín Negro", latin: "Makaira indica"},
                 { local: "Tiburón Cornuda Gigante", latin: "Sphyrna mokarran"},
	],
       "activity": [ ....

{
	"_id" : ObjectId("xxxxxxxxxxxxxxx"),
	"agency" : "An English Agency",
	"species" : [
		{ local: "Skipjack Tuna", latin: "Katsuwonus pelamis" },
                 { local: "Black Marlin", latin: "Makaira indica"},
                 { local: "Great hammerhead", latin: "Sphyrna mokarran"},
	],
       "activity": [ ....

That way, we can cross-reference using MenuData.species.latin, but display using MenuData.species.local.

This would change how the boarding records look, though only slightly. Here's how the species show up in the boarding reports right now:

> db.BoardingReports.findOne()
{
	"_id" : ObjectId("60a5696793e5d06ad86dde58"),
	"agency" : "WildAid",
	"inspection" : {
		"activity" : {
			"name" : "Fishing"
		"actualCatch" : [
			{
				"fish" : "Skipjack Tuna",
				"number" : NumberLong(1),
				"unit" : "lbs",
				"weight" : 1
			},
			{
				"fish" : "Black Marlin",
				"number" : NumberLong(2),
				"unit" : "lbs",
				"weight" : 40
			}
		],
...
...rest of inspection and other fields...
...
	"date" : ISODate("2021-05-19T19:39:19.383Z")
}

And it could be transformed to

> db.BoardingReports.findOne()
{
	"_id" : ObjectId("60a5696793e5d06ad86dde58"),
	"agency" : "WildAid",
	"inspection" : {
		"activity" : {
			"name" : "Fishing"
		"actualCatch" : [
			{
				"fish" : "Skipjack Tuna",
				"latin" : "Katsuwonus pelamis",
				"number" : NumberLong(1),
				"unit" : "lbs",
				"weight" : 1
			},
			{
				"fish" : "Black Marlin",
				"latin" : "Makaira indica",
				"number" : NumberLong(2),
				"unit" : "lbs",
				"weight" : 40
			}
		],
...
...rest of inspection and other fields...
...
	"date" : ISODate("2021-05-19T19:39:19.383Z")
}

In this example, the mobile apps would have to be changed to parse the new MenuData format, and store both the fish and the latin name in the BoardingReports collection. And of course anything in the web app that references MenuData.species, or BoardingReports.inspection.actualCatch would need changing.

(one way to do this would be to have a new field in MenuData, called "catch", which can be used by the mobile apps when they're ready, and "species" could be removed when both mobile apps have implemented it.

I'm open to other options of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant