@openmrs/esm-fast-data-entry-app 1.0.0-pre.11 → 1.0.0-pre.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/132.js +1 -0
- package/dist/147.js +2 -0
- package/dist/{502.js.LICENSE.txt → 147.js.LICENSE.txt} +0 -30
- package/dist/247.js +1 -0
- package/dist/294.js +1 -2
- package/dist/536.js +2 -0
- package/dist/{382.js.LICENSE.txt → 536.js.LICENSE.txt} +0 -0
- package/dist/595.js +1 -2
- package/dist/595.js.LICENSE.txt +2 -0
- package/dist/634.js +2 -0
- package/dist/634.js.LICENSE.txt +5 -0
- package/dist/776.js +1 -0
- package/dist/804.js +1 -0
- package/dist/852.js +1 -0
- package/dist/906.js +1 -2
- package/dist/935.js +2 -0
- package/dist/935.js.LICENSE.txt +23 -0
- package/dist/947.js +1 -0
- package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +142 -124
- package/dist/openmrs-esm-fast-data-entry-app.old +1 -2
- package/package.json +29 -33
- package/src/FormEntry.tsx +42 -0
- package/src/Loader.tsx +16 -0
- package/src/Root.tsx +7 -3
- package/src/empty-state/EmptyDataIllustration.tsx +51 -0
- package/src/empty-state/EmptyState.tsx +29 -0
- package/src/empty-state/styles.scss +55 -0
- package/src/forms/FormWorkflow.tsx +135 -0
- package/src/forms/FormsRoot.tsx +12 -10
- package/src/forms/FormsTable.tsx +22 -5
- package/src/forms/PatientCard.tsx +37 -0
- package/src/forms/PatientInfo.test.tsx +9 -0
- package/src/forms/PatientInfo.tsx +140 -0
- package/src/forms/patient-info.scss +59 -0
- package/src/forms/styles.scss +13 -0
- package/src/forms/useGetPatient.ts +23 -0
- package/src/index.ts +13 -1
- package/src/loader.scss +9 -0
- package/tsconfig.json +26 -23
- package/.husky/pre-commit +0 -6
- package/.husky/pre-push +0 -6
- package/dist/24.js +0 -3
- package/dist/24.js.LICENSE.txt +0 -16
- package/dist/24.js.map +0 -1
- package/dist/294.js.map +0 -1
- package/dist/296.js +0 -2
- package/dist/296.js.map +0 -1
- package/dist/299.js +0 -2
- package/dist/299.js.map +0 -1
- package/dist/382.js +0 -3
- package/dist/382.js.map +0 -1
- package/dist/415.js +0 -2
- package/dist/415.js.map +0 -1
- package/dist/502.js +0 -3
- package/dist/502.js.map +0 -1
- package/dist/595.js.map +0 -1
- package/dist/69.js +0 -2
- package/dist/69.js.map +0 -1
- package/dist/777.js +0 -2
- package/dist/777.js.map +0 -1
- package/dist/860.js +0 -2
- package/dist/860.js.map +0 -1
- package/dist/906.js.map +0 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.map +0 -1
- package/src/patient-getter/patient-getter.resource.ts +0 -31
- package/src/patient-getter/patient-getter.test.tsx +0 -28
- package/src/patient-getter/patient-getter.tsx +0 -28
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { openmrsFetch, fhir } from "@openmrs/esm-framework";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a somewhat silly resource function. It searches for a patient
|
|
5
|
-
* using the REST API, and then immediately gets the data using the FHIR
|
|
6
|
-
* API for the first patient found. OpenMRS API endpoints are generally
|
|
7
|
-
* hit using `openmrsFetch`. For FHIR endpoints we use the FHIR API
|
|
8
|
-
* object.
|
|
9
|
-
*
|
|
10
|
-
* See the `fhir` object API docs: https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/docs/API.md#fhir
|
|
11
|
-
* See the docs for the underlying fhir.js Client object: https://github.com/FHIR/fhir.js#api
|
|
12
|
-
* See the OpenMRS FHIR Module docs: https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module
|
|
13
|
-
* See the OpenMRS REST API docs: https://rest.openmrs.org/#openmrs-rest-api
|
|
14
|
-
*
|
|
15
|
-
* @param query A patient name or ID
|
|
16
|
-
* @returns The first matching patient
|
|
17
|
-
*/
|
|
18
|
-
export async function getPatient(query) {
|
|
19
|
-
const searchResult = await openmrsFetch(
|
|
20
|
-
`/ws/rest/v1/patient?q=${query}&limit=1`,
|
|
21
|
-
{
|
|
22
|
-
method: "GET",
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
return (
|
|
26
|
-
await fhir.read<fhir.Patient>({
|
|
27
|
-
type: "Patient",
|
|
28
|
-
patient: searchResult.data.results[0].uuid,
|
|
29
|
-
})
|
|
30
|
-
).data;
|
|
31
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { PatientGetter } from "./patient-getter";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is an idiomatic mock of a backend resource. We generally mock
|
|
8
|
-
* resource fetching functions like `getPatient`, rather than mocking
|
|
9
|
-
* `fetch` or anything lower-level.
|
|
10
|
-
*/
|
|
11
|
-
jest.mock("./patient-getter.resource.ts", () => ({
|
|
12
|
-
getPatient: jest.fn(() =>
|
|
13
|
-
Promise.resolve({
|
|
14
|
-
name: [{ id: "abc123", given: "Joeboy", family: "Testguy" }],
|
|
15
|
-
gender: "male",
|
|
16
|
-
birthDate: "1997-05-21",
|
|
17
|
-
})
|
|
18
|
-
),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
describe(`<PatientGetter />`, () => {
|
|
22
|
-
it("gets a patient when the button is clicked", async () => {
|
|
23
|
-
render(<PatientGetter />);
|
|
24
|
-
userEvent.click(screen.getByRole("button"));
|
|
25
|
-
const resultText = await screen.findByText(/joeboy/i);
|
|
26
|
-
expect(resultText).toHaveTextContent("Joeboy Testguy / male / 1997-05-21");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Components that make queries delegate the query-making logic to a
|
|
3
|
-
* `.resource.ts` function. This component simply calls `getPatient`
|
|
4
|
-
* and sets a state variable using the result.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useState } from "react";
|
|
8
|
-
import { Trans } from "react-i18next";
|
|
9
|
-
import Button from "carbon-components-react/es/components/Button";
|
|
10
|
-
import { Tile } from "carbon-components-react/es/components/Tile";
|
|
11
|
-
import { getPatient } from "./patient-getter.resource";
|
|
12
|
-
|
|
13
|
-
export function PatientGetter() {
|
|
14
|
-
const [patient, setPatient] = useState<fhir.Patient>();
|
|
15
|
-
const patientName = "test";
|
|
16
|
-
return (
|
|
17
|
-
<div>
|
|
18
|
-
<Button onClick={() => getPatient(patientName).then(setPatient)}>
|
|
19
|
-
<Trans key="getPatient">Get a patient named</Trans> 'test'
|
|
20
|
-
</Button>
|
|
21
|
-
<Tile>
|
|
22
|
-
{patient
|
|
23
|
-
? `${patient.name[0].given} ${patient.name[0].family} / ${patient.gender} / ${patient.birthDate}`
|
|
24
|
-
: null}
|
|
25
|
-
</Tile>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|