Skip to content

Commit

Permalink
Merge pull request #81 from jy95/big-bang-refactoring
Browse files Browse the repository at this point in the history
refactor: simplify class API - BREAKING CHANGE: public API breaking changes

BREAKING CHANGE: public API breaking changes
  • Loading branch information
jy95 committed Jun 17, 2024
2 parents 207c2bb + e439a43 commit 2abd4b2
Show file tree
Hide file tree
Showing 83 changed files with 333 additions and 436 deletions.
6 changes: 5 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"branches": ["main", {"name": "beta", "prerelease": true}, {"name": "alpha", "prerelease": true}]
"branches": [
"main",
{"name": "beta", "prerelease": true},
{"name": "alpha", "prerelease": true}
]
}
24 changes: 12 additions & 12 deletions __tests__/api.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../src/index";
import { FhirDosageUtils } from "../src/index";

import type { Dosage } from "fhir/r4";

Expand Down Expand Up @@ -30,8 +30,8 @@ describe("API scenarios", () => {
},
};

let language1 = dosagesEn.getLanguage();
let language2 = dosagesFr.getLanguage();
let language1 = dosagesEn.getProperty("language");
let language2 = dosagesFr.getProperty("language");

let result1 = dosagesEn.fromDosageToText(dosage);
let result2 = dosagesFr.fromDosageToText(dosage);
Expand All @@ -51,10 +51,10 @@ describe("API scenarios", () => {
text: "Test string",
};

let order1 = dosagesEn.getDisplayOrder();
let order1 = dosagesEn.getProperty("displayOrder");
let result1 = dosagesEn.fromDosageToText(dosage);
dosagesEn.changeDisplayOrder(["text"]);
let order2 = dosagesEn.getDisplayOrder();
dosagesEn.setProperty("displayOrder", ["text"]);
let order2 = dosagesEn.getProperty("displayOrder");
let result2 = dosagesEn.fromDosageToText(dosage);
expect(order1).not.toBe(order2);
expect(result1).not.toBe(result2);
Expand All @@ -78,21 +78,21 @@ describe("API scenarios", () => {
});

test("changeDisplaySeparator must be applied", async () => {
let sep1 = dosagesEn.getDisplaySeparator();
dosagesEn.changeDisplaySeparator(" | ");
let sep2 = dosagesEn.getDisplaySeparator();
let sep1 = dosagesEn.getProperty("displaySeparator");
dosagesEn.setProperty("displaySeparator", " | ");
let sep2 = dosagesEn.getProperty("displaySeparator");
expect(sep1).not.toBe(sep2);
});

test("changeDateTimeFormatOptions must be applied", async () => {
let opts1 = dosagesEn.getDateTimeFormatOptions();
dosagesEn.changeDateTimeFormatOptions({
let opts1 = dosagesEn.getProperty("dateTimeFormatOptions");
dosagesEn.setProperty("dateTimeFormatOptions", {
day: "2-digit",
hour: "numeric",
minute: "numeric",
second: "2-digit",
});
let opts2 = dosagesEn.getDateTimeFormatOptions();
let opts2 = dosagesEn.getProperty("dateTimeFormatOptions");
expect(opts1).not.toBe(opts2);
});
});
2 changes: 1 addition & 1 deletion __tests__/corner_cases.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../src/index";
import { FhirDosageUtils } from "../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/additionalInstruction.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/asNeeded.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage as DosageR4 } from "fhir/r4";
import type { Dosage as DosageR5 } from "fhir/r5";
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/boundsDuration.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/boundsPeriod.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/boundsRange.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/code.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/countCountMax.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/dayOfWeek.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/doseQuantity.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/doseRange.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/durationDurationMax.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/event.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

// For the WHY, consult this
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format#avoid_comparing_formatted_date_values_to_static_values
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/extension.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/frequencyFrequencyMax.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/maxDosePerLifetime.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/maxDosePerPeriod.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage as DosageR4 } from "fhir/r4";
import type { Dosage as DosageR5 } from "fhir/r5";
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/method.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/modifierExtension.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/offsetWhen.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/patientInstruction.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/periodPeriodMax.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/rateQuantity.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/rateRange.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/rateRatio.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/route.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/site.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/text.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/timeOfDay.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/timingExtension.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromDosageToText/timingRepeatExtension.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../../src/index";
import { FhirDosageUtils } from "../../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/fromMultipleDosageToText.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../src/index";
import { FhirDosageUtils } from "../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
2 changes: 1 addition & 1 deletion __tests__/timing.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For typings autocomplete whatever your IDE
import { expect, test, describe } from "@jest/globals";
import FhirDosageUtils from "../src/index";
import { FhirDosageUtils } from "../src/index";

import type { Dosage } from "fhir/r4";

Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/custom/fromFHIRQuantityUnitToString.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ import SingleDosageToText from "@site/src/components/single_dosage_to_text";

:::tip

Possible cases in production :
Possible cases in production :

1. SNOMED CT - http:https://snomed.info/sct
2. UCUM - http:https://unitsofmeasure.org
3. Other Code System than SNOMED CT / UCUM, such as LOINC - http:https://loinc.org/
3. Other Code System than SNOMED CT / UCUM, such as LOINC - http:https://loinc.org/
4. (Local) Value Set, e.g. https://www.ehealth.fgov.be/standards/fhir/core/ValueSet/be-cd-administration-unit
5. Hardcoded unit without any system

Expand All @@ -60,4 +60,4 @@ To support them all in your `fromFHIRQuantityUnitToString` implementation, here
- Extensions put on [Quantity](https://build.fhir.org/datatypes.html#Quantity), depending of your implementation guide
- ...

:::
:::
3 changes: 2 additions & 1 deletion documentation/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ The library was built with that in mind. Read more [here](demo/custom).

| Version | FHIR |
| -------------------- | ----------- |
| `>= 1.0.0` (current) | `R4 and R5` |
| `>= 2.0.0` (current) | `R4 and R5` |
| `>= 1.0.0` | `R4 and R5` |

</details>

Expand Down
Loading

0 comments on commit 2abd4b2

Please sign in to comment.