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

[FhirPath] Add support for Quantity arithmetic #1442

Closed
ewoutkramer opened this issue Jul 22, 2020 · 1 comment · Fixed by #2595
Closed

[FhirPath] Add support for Quantity arithmetic #1442

ewoutkramer opened this issue Jul 22, 2020 · 1 comment · Fixed by #2595
Assignees

Comments

@ewoutkramer
Copy link
Member

No description provided.

@marcovisserFurore
Copy link
Member

We have to implement the following in Hl7.Fhir.ElementModel.Types.Quantity:

        public static bool operator +(Quantity a, Quantity b) => throw Error.NotSupported("Adding two quantites is not yet supported");
        public static bool operator -(Quantity a, Quantity b) => throw Error.NotSupported("Subtracting two quantites is not yet supported");

        public static bool operator *(Quantity a, Quantity b) => throw Error.NotSupported("Multiplying two quantites is not yet supported");
        public static bool operator /(Quantity a, Quantity b) => throw Error.NotSupported("Dividing two quantites is not yet supported");

The method TryCompareTo has already been implemented.

Steps for implementing the arithmetic operations:

  • first try to canonicalize both of the quantities to align the units
  • When the units are aligned, then do the arithmetic operation

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 a pull request may close this issue.

2 participants