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

Remove separate treatment queries #9

Merged
merged 23 commits into from
Mar 26, 2024
Merged

Conversation

nleanba
Copy link
Collaborator

@nleanba nleanba commented Mar 22, 2024

See factsmission/synospecies#128

Note that this is a significant and breaking API change.
Do not merge without also updating synospecies.

These Types have changed:

export type TreatmentDetails = {
  materialCitations: MaterialCitation[];
  date?: number;
  creators?: string;
  title?: string;
};

export type Treatment = {
  url: string;
  details: Promise<TreatmentDetails>;
};

export type TaxonName = {
  uri: string;
  treatments: {
    aug: Set<Treatment>;
    cite: Set<Treatment>;
  };
  loading: boolean;
};

type Treatments = {
  def: Set<Treatment>;
  aug: Set<Treatment>;
  dpr: Set<Treatment>;
  cite: Set<Treatment>;
};
export type JustifiedSynonym = {
  taxonConceptUri: string;
  taxonName: TaxonName;
  taxonConceptAuthority?: string;
  justifications: JustificationSet;
  treatments: Treatments;
  loading: boolean;
};

The type TreatmentSet has been removed.

Also SynonymGroup has gained two new fields:

export default class SynonymGroup implements AsyncIterable<JustifiedSynonym> {
  ...
  treatments: Map<string, Treatment> = new Map();
  taxonNames: Map<string, TaxonName> = new Map();
  ...
}

They are primarily for internal use, and notably don't have their own async iterators, but they might still be useful for applications.
Both are only updated when a new taxon concept is found.

@retog
Copy link
Collaborator

retog commented Mar 25, 2024

image
On the left on this PR, on main. Why are no more treatments shown?

@nleanba
Copy link
Collaborator Author

nleanba commented Mar 25, 2024

On the left on this PR, on main. Why are no more treatments shown?

This was because the script in index.html was not updated and ran into errors. I have fixed it now

retog
retog previously requested changes Mar 25, 2024
Copy link
Collaborator

@retog retog left a comment

Choose a reason for hiding this comment

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

Revert back to throwing exceptions, except there's a good reason.

Otherwise it looks good!

SynonymGroup.ts Outdated Show resolved Hide resolved
SynonymGroup.ts Show resolved Hide resolved
@nleanba nleanba requested a review from retog March 26, 2024 09:41
@nleanba nleanba dismissed retog’s stale review March 26, 2024 13:31

Requested changes have been implemented

@nleanba nleanba merged commit 59d543b into main Mar 26, 2024
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.

2 participants