diff --git a/packages/client/graphql.schema.json b/packages/client/graphql.schema.json index ea6a1e8c74d..4eaf4b8853f 100644 --- a/packages/client/graphql.schema.json +++ b/packages/client/graphql.schema.json @@ -15140,18 +15140,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "mosipAid", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "otherInformantType", "description": null, @@ -15523,18 +15511,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "mosipAid", - "description": null, - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "otherInformantType", "description": null, diff --git a/packages/client/src/forms/register/mappings/event-specific-fields/birth/mutation/registration-mappings.ts b/packages/client/src/forms/register/mappings/event-specific-fields/birth/mutation/registration-mappings.ts index be0cf4b2bae..4328580a695 100644 --- a/packages/client/src/forms/register/mappings/event-specific-fields/birth/mutation/registration-mappings.ts +++ b/packages/client/src/forms/register/mappings/event-specific-fields/birth/mutation/registration-mappings.ts @@ -26,10 +26,6 @@ export function setBirthRegistrationSectionTransformer( draftData[sectionId].registrationNumber } - if (draftData[sectionId].mosipAid) { - transformedData[sectionId].mosipAid = draftData[sectionId].mosipAid - } - if (!transformedData[sectionId].status) { transformedData[sectionId].status = [ { diff --git a/packages/client/src/forms/register/mappings/event-specific-fields/birth/query/registration-mappings.ts b/packages/client/src/forms/register/mappings/event-specific-fields/birth/query/registration-mappings.ts index 9d7817a622c..31f290ae004 100644 --- a/packages/client/src/forms/register/mappings/event-specific-fields/birth/query/registration-mappings.ts +++ b/packages/client/src/forms/register/mappings/event-specific-fields/birth/query/registration-mappings.ts @@ -34,31 +34,3 @@ export function getBirthRegistrationSectionTransformer( transformStatusData(transformedData, queryData[sectionId].status, sectionId) } } - -export function mosipAidTransformer( - transformedData: IFormData, - queryData: any, - sectionId: string, - targetSectionId?: string, - targetFieldName?: string -) { - if (queryData[sectionId].mosipAid) { - transformedData[targetSectionId || sectionId][ - targetFieldName || 'mosipAid' - ] = queryData[sectionId].mosipAid - } -} - -export function mosipAidLabelTransformer( - transformedData: IFormData, - queryData: any, - sectionId: string, - targetSectionId?: string, - targetFieldName?: string -) { - if (queryData[sectionId].mosipAid) { - transformedData[targetSectionId || sectionId][ - targetFieldName || 'mosipAIDLabel' - ] = 'MOSIP Application ID' - } -} diff --git a/packages/client/src/forms/register/mappings/mutation/field-mappings.ts b/packages/client/src/forms/register/mappings/mutation/field-mappings.ts index 40fe86eb9d8..7de338f82c0 100644 --- a/packages/client/src/forms/register/mappings/mutation/field-mappings.ts +++ b/packages/client/src/forms/register/mappings/mutation/field-mappings.ts @@ -123,33 +123,6 @@ export const fieldToIdentityTransformer = return transformedData } -export const nidVerificationFieldToIdentityTransformer = ( - transformedData: TransformedData, - draftData: IFormData, - sectionId: string, - field: IFormField -) => { - fieldToIdentityTransformer('id', 'MOSIP_PSUT_TOKEN_ID')( - transformedData, - draftData, - sectionId, - field - ) - const sectionData = transformedData[sectionId] - const existingIdentity = sectionData.identifier.find( - (identifier: IdentityType) => - identifier.type && identifier.type === 'MOSIP_PSUT_TOKEN_ID' - ) - if (existingIdentity) { - const modifiedFields = draftData[sectionId][ - 'fieldsModifiedByNidUserInfo' - ] as string[] | undefined - existingIdentity['fieldsModifiedByIdentity'] = - modifiedFields?.join(',') ?? '' - } - return transformedData -} - interface IAddress { [key: string]: any } diff --git a/packages/client/src/forms/register/mappings/query/field-mappings.ts b/packages/client/src/forms/register/mappings/query/field-mappings.ts index 1628ff15b41..55f243b38eb 100644 --- a/packages/client/src/forms/register/mappings/query/field-mappings.ts +++ b/packages/client/src/forms/register/mappings/query/field-mappings.ts @@ -18,7 +18,6 @@ import { DeathRegistration, MarriageRegistration, Address, - IdentityType, EventRegistration } from '@client/utils/gateway' import { @@ -241,36 +240,6 @@ export const identityToFieldTransformer = return transformedData } -export const identityToNidVerificationFieldTransformer = ( - transformedData: IFormData, - queryData: QueryData, - sectionId: SectionId, - field: IFormField -) => { - identityToFieldTransformer('id', 'MOSIP_PSUT_TOKEN_ID')( - transformedData, - queryData, - sectionId, - field - ) - const existingIdentity = queryData[sectionId]?.identifier?.find( - (identity: IdentityType) => - (identity.type as string) === 'MOSIP_PSUT_TOKEN_ID' - ) - if (!transformedData[sectionId]) { - transformedData[sectionId] = {} - } - - if (existingIdentity) { - const modifiedFields = existingIdentity[ - 'fieldsModifiedByIdentity' - ] as string[] - transformedData[sectionId].fieldsModifiedByNidUserInfo = modifiedFields - } - - return transformedData -} - export const addressQueryTransformer = (config: { useCase: string @@ -625,52 +594,6 @@ export const nestedValueToFieldTransformer = return transformedData } -export const nestedIdentityValueToFieldTransformer = - (nestedField: SectionId) => - ( - transformedData: IFormData, - queryData: QueryData, - sectionId: SectionId, - field: IFormField - ) => { - if (!queryData[sectionId] || !queryData[sectionId][nestedField]) { - return transformedData - } - const clonedData = cloneDeep(transformedData) - if (!clonedData[nestedField]) { - clonedData[nestedField] = {} - } - - identityToFieldTransformer('id', 'MOSIP_PSUT_TOKEN_ID')( - clonedData, - queryData[sectionId], - nestedField, - field - ) - - if (clonedData[nestedField][field.name] === undefined) { - return transformedData - } - transformedData[sectionId][field.name] = clonedData[nestedField][field.name] - - const existingIdentity = queryData[sectionId][nestedField].identifier?.find( - (identity: IdentityType) => - (identity.type as string) === 'MOSIP_PSUT_TOKEN_ID' - ) - if (!transformedData[sectionId]) { - transformedData[sectionId] = {} - } - - if (existingIdentity) { - const modifiedFields = existingIdentity[ - 'fieldsModifiedByIdentity' - ] as string[] - transformedData[sectionId].fieldsModifiedByNidUserInfo = modifiedFields - } - - return transformedData - } - export const booleanTransformer = ( transformedData: IFormData, queryData: QueryData, diff --git a/packages/client/src/tests/forms.json b/packages/client/src/tests/forms.json index 07a7aefd20e..97b038b363e 100644 --- a/packages/client/src/tests/forms.json +++ b/packages/client/src/tests/forms.json @@ -18,11 +18,6 @@ "operation": "registrationNumberTransformer" }, { "fieldName": "qrCode", "operation": "QRCodeTransformer" }, - { "fieldName": "mosipAid", "operation": "mosipAidTransformer" }, - { - "fieldName": "mosipAIDLabel", - "operation": "mosipAidLabelTransformer" - }, { "fieldName": "certificateDate", "operation": "certificateDateTransformer", @@ -1106,51 +1101,6 @@ } } }, - { - "name": "informantNidVerification", - "type": "NID_VERIFICATION_BUTTON", - "label": { - "defaultMessage": "National ID number (in English)", - "description": "Option for form field: Type of ID", - "id": "form.field.label.iDTypeNationalID" - }, - "required": true, - "initialValue": "", - "validator": [], - "conditionals": [ - { - "action": "hide", - "expression": "const nationalIdSystem =\n offlineCountryConfig &&\n offlineCountryConfig.systems.find(s => s.integratingSystemType === 'MOSIP');\n !nationalIdSystem ||\n !nationalIdSystem.settings.openIdProviderBaseUrl ||\n !nationalIdSystem.settings.openIdProviderClientId ||\n !nationalIdSystem.settings.openIdProviderClaims;\n " - }, - { - "action": "hide", - "expression": "((values.informantType===\"MOTHER\") || (values.informantType===\"FATHER\") || (!values.informantType))" - } - ], - "mapping": { - "mutation": { - "operation": "nidVerificationFieldToIdentityTransformer" - }, - "query": { - "operation": "identityToNidVerificationFieldTransformer" - } - }, - "labelForVerified": { - "defaultMessage": "Authenticated", - "description": "label for unverified nid state", - "id": "form.field.nidVerified" - }, - "labelForUnverified": { - "defaultMessage": "Authenticate", - "description": "label for verified nid state", - "id": "form.field.nidNotVerified" - }, - "labelForOffline": { - "defaultMessage": "National ID authentication is currently not available offline.", - "description": "Label for indicating offline status for the user. NID verification is not currently available offline.", - "id": "form.field.nidVerificationOngoing" - } - }, { "name": "primaryAddress", "type": "SUBSECTION_HEADER", diff --git a/packages/client/src/tests/schema.graphql b/packages/client/src/tests/schema.graphql index 351d3bee0c9..67a49e5ff27 100644 --- a/packages/client/src/tests/schema.graphql +++ b/packages/client/src/tests/schema.graphql @@ -1456,7 +1456,6 @@ type Registration { _fhirID: ID draftId: String trackingId: String - mosipAid: String registrationNumber: String paperFormID: String page: String @@ -1490,7 +1489,6 @@ input RegistrationInput { _fhirID: ID draftId: String trackingId: String - mosipAid: String registrationNumber: String paperFormID: String page: String diff --git a/packages/client/src/utils/gateway.ts b/packages/client/src/utils/gateway.ts index 346bcd017b6..33794b49fd7 100644 --- a/packages/client/src/utils/gateway.ts +++ b/packages/client/src/utils/gateway.ts @@ -1702,7 +1702,6 @@ export type Registration = { inCompleteFields?: Maybe informantType?: Maybe informantsSignature?: Maybe - mosipAid?: Maybe otherInformantType?: Maybe page?: Maybe paperFormID?: Maybe @@ -1736,7 +1735,6 @@ export type RegistrationInput = { informantType?: InputMaybe informantsSignature?: InputMaybe location?: InputMaybe - mosipAid?: InputMaybe otherInformantType?: InputMaybe page?: InputMaybe paperFormID?: InputMaybe @@ -3234,7 +3232,6 @@ export type FetchBirthRegistrationForReviewQuery = { type?: RegistrationType | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null duplicates?: Array<{ __typename?: 'DuplicatesInfo' compositionId?: string | null @@ -3581,7 +3578,6 @@ export type FetchBirthRegistrationForCertificateQuery = { informantsSignature?: string | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null status?: Array<{ __typename?: 'RegWorkflow' type?: RegStatus | null @@ -4761,7 +4757,6 @@ export type FetchMarriageRegistrationForReviewQuery = { type?: RegistrationType | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null duplicates?: Array<{ __typename?: 'DuplicatesInfo' compositionId?: string | null @@ -5116,7 +5111,6 @@ export type FetchMarriageRegistrationForCertificateQuery = { type?: RegistrationType | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null duplicates?: Array<{ __typename?: 'DuplicatesInfo' compositionId?: string | null @@ -7838,7 +7832,6 @@ export type FetchViewRecordByCompositionQuery = { type?: RegistrationType | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null duplicates?: Array<{ __typename?: 'DuplicatesInfo' compositionId?: string | null @@ -8224,7 +8217,6 @@ export type FetchViewRecordByCompositionQuery = { type?: RegistrationType | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null duplicates?: Array<{ __typename?: 'DuplicatesInfo' compositionId?: string | null @@ -8542,7 +8534,6 @@ export type FetchViewRecordByCompositionQuery = { type?: RegistrationType | null trackingId?: string | null registrationNumber?: string | null - mosipAid?: string | null duplicates?: Array<{ __typename?: 'DuplicatesInfo' compositionId?: string | null diff --git a/packages/client/src/utils/referenceApi.test.ts b/packages/client/src/utils/referenceApi.test.ts index b19385c4209..de1e0f8bd83 100644 --- a/packages/client/src/utils/referenceApi.test.ts +++ b/packages/client/src/utils/referenceApi.test.ts @@ -513,65 +513,6 @@ const parsedFacilities = { } } -const statuses = { - PENDING: 'pending', - ACTIVE: 'active', - DISABLED: 'disabled', - DEACTIVATED: 'deactivated' -} - -const mockFetchConfig = { - config: { - API_GATEWAY_URL: 'http://localhost:7070/', - CONFIG_API_URL: 'http://localhost:2021', - LOGIN_URL: 'http://localhost:3020', - AUTH_URL: 'http://localhost:4040', - RESOURCES_URL: 'http://localhost:3040', - APPLICATION_NAME: 'Farajaland CRVS', - FIELD_AGENT_AUDIT_LOCATIONS: 'DISTRICT', - DECLARATION_AUDIT_LOCATIONS: 'DISTRICT', - EXTERNAL_VALIDATION_WORKQUEUE: false, - PHONE_NUMBER_PATTERN: '/^0(7|9)[0-9]{1}[0-9]{7}$/', - SENTRY: 'https://f892d643aab642108f44e2d1795706bc@sentry.io/1774604', - NID_NUMBER_PATTERN: '/^[0-9]{9}$/', - COUNTRY: 'zmb', - CURRENCY: { - isoCode: 'ZMW', - languagesAndCountry: ['en-ZM'] - }, - LANGUAGES: 'en', - INTEGRATIONS: [ - { - name: 'MOSIP', - status: statuses.ACTIVE - } - ] - }, - certificates: [ - { - svgCode: '' - }, - { - svgCode: '' - } - ], - systems: [ - { - name: 'MOSIP', - status: statuses.ACTIVE - } - ] -} - -const certificates = [ - { - svgCode: '' - }, - { - svgCode: '' - } -] - describe('referenceApi', () => { beforeEach(() => { fetch.resetMocks() @@ -593,13 +534,4 @@ describe('referenceApi', () => { const data = await referenceApi.loadFacilities() expect(data).toEqual(parsedFacilities) }) - - it('retrieves the config from the server', async () => { - fetch.mockResponseOnce(JSON.stringify(mockFetchConfig)) - const data = await referenceApi.loadConfig() - expect(data).toEqual({ - ...mockFetchConfig, - certificates - }) - }) }) diff --git a/packages/client/src/views/DataProvider/birth/queries.ts b/packages/client/src/views/DataProvider/birth/queries.ts index d92e431c83b..2ef0c66c575 100644 --- a/packages/client/src/views/DataProvider/birth/queries.ts +++ b/packages/client/src/views/DataProvider/birth/queries.ts @@ -180,7 +180,6 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = gql` type trackingId registrationNumber - mosipAid } attendantAtBirth weightAtBirth @@ -474,7 +473,6 @@ export const GET_BIRTH_REGISTRATION_FOR_CERTIFICATE = gql` } trackingId registrationNumber - mosipAid } attendantAtBirth weightAtBirth diff --git a/packages/client/src/views/DataProvider/marriage/queries.ts b/packages/client/src/views/DataProvider/marriage/queries.ts index 4c7eef18a50..2eb8d12cb2a 100644 --- a/packages/client/src/views/DataProvider/marriage/queries.ts +++ b/packages/client/src/views/DataProvider/marriage/queries.ts @@ -192,7 +192,6 @@ const GET_MARRIAGE_REGISTRATION_FOR_REVIEW = gql` type trackingId registrationNumber - mosipAid } typeOfMarriage eventLocation { @@ -499,7 +498,6 @@ const GET_MARRIAGE_REGISTRATION_FOR_CERTIFICATE = gql` type trackingId registrationNumber - mosipAid } typeOfMarriage eventLocation { diff --git a/packages/client/src/views/RegisterForm/duplicate/DuplicateFormTabs.test.tsx b/packages/client/src/views/RegisterForm/duplicate/DuplicateFormTabs.test.tsx index 88e13f55923..d3d27c28941 100644 --- a/packages/client/src/views/RegisterForm/duplicate/DuplicateFormTabs.test.tsx +++ b/packages/client/src/views/RegisterForm/duplicate/DuplicateFormTabs.test.tsx @@ -182,7 +182,6 @@ const viewRecordMock = { type: 'BIRTH', trackingId: 'BGVLQSH', registrationNumber: null, - mosipAid: null, __typename: 'Registration' }, history: [ diff --git a/packages/client/src/views/ViewRecord/ViewRecord.test.tsx b/packages/client/src/views/ViewRecord/ViewRecord.test.tsx index a4e24c6e5c1..7a79eec43d6 100644 --- a/packages/client/src/views/ViewRecord/ViewRecord.test.tsx +++ b/packages/client/src/views/ViewRecord/ViewRecord.test.tsx @@ -212,7 +212,6 @@ describe('View Record for loading and success state', () => { type: 'DEATH', trackingId: 'DHN9T01', registrationNumber: '2022DHN9T01', - mosipAid: null, __typename: 'Registration' }, history: [ diff --git a/packages/client/src/views/ViewRecord/query.ts b/packages/client/src/views/ViewRecord/query.ts index 9fcd5e40099..1bfe0030d5d 100644 --- a/packages/client/src/views/ViewRecord/query.ts +++ b/packages/client/src/views/ViewRecord/query.ts @@ -55,7 +55,6 @@ export const FETCH_VIEW_RECORD_BY_COMPOSITION = gql` type trackingId registrationNumber - mosipAid } history { date diff --git a/packages/commons/src/fhir/patient.ts b/packages/commons/src/fhir/patient.ts index bddb6294ce9..e3a5a23a4a7 100644 --- a/packages/commons/src/fhir/patient.ts +++ b/packages/commons/src/fhir/patient.ts @@ -46,7 +46,6 @@ export type OpenCRVSPatientName = Omit & { export const SUPPORTED_PATIENT_IDENTIFIER_CODES = [ 'PASSPORT', 'NATIONAL_ID', - 'MOSIP_PSUT_TOKEN_ID', 'DECEASED_PATIENT_ENTRY', 'BIRTH_PATIENT_ENTRY', 'DRIVING_LICENSE', diff --git a/packages/commons/src/fhir/task.ts b/packages/commons/src/fhir/task.ts index 070d9d55b72..b37d48791a5 100644 --- a/packages/commons/src/fhir/task.ts +++ b/packages/commons/src/fhir/task.ts @@ -47,10 +47,6 @@ export type TrackingID = Nominal export type RegistrationNumber = Nominal export type TaskIdentifier = - | { - system: 'http://opencrvs.org/specs/id/mosip-aid' - value: string - } | { system: 'http://opencrvs.org/specs/id/draft-id' value: string diff --git a/packages/commons/src/fhir/transformers/index.ts b/packages/commons/src/fhir/transformers/index.ts index 2cd04f46949..edc4fc668a0 100644 --- a/packages/commons/src/fhir/transformers/index.ts +++ b/packages/commons/src/fhir/transformers/index.ts @@ -2553,10 +2553,6 @@ const builders: IFieldBuilders = { } return setResourceIdentifier(taskResource, `${trackingId}`, fieldValue) }, - mosipAid: (fhirBundle, fieldValue, context) => { - const taskResource = selectOrCreateTaskRefResource(fhirBundle, context) - return setResourceIdentifier(taskResource, 'mosip-aid', fieldValue) - }, registrationNumber: (fhirBundle, fieldValue, context) => { let regNumber: | 'birth-registration-number' diff --git a/packages/commons/src/fhir/transformers/input.ts b/packages/commons/src/fhir/transformers/input.ts index 683563e4020..43890b41993 100644 --- a/packages/commons/src/fhir/transformers/input.ts +++ b/packages/commons/src/fhir/transformers/input.ts @@ -181,7 +181,6 @@ export interface Registration { _fhirID?: string draftId?: string trackingId?: string - mosipAid?: string registrationNumber?: string paperFormID?: string page?: string diff --git a/packages/gateway/src/features/registration/__snapshots__/type-resolvers.test.ts.snap b/packages/gateway/src/features/registration/__snapshots__/type-resolvers.test.ts.snap index 02451a6d6a3..5db255f469c 100644 --- a/packages/gateway/src/features/registration/__snapshots__/type-resolvers.test.ts.snap +++ b/packages/gateway/src/features/registration/__snapshots__/type-resolvers.test.ts.snap @@ -438,7 +438,6 @@ Object { "inCompleteFields": null, "informantType": "MOTHER", "informantsSignature": null, - "mosipAid": null, "otherInformantType": null, "page": null, "paperFormID": null, @@ -872,7 +871,6 @@ Object { "inCompleteFields": null, "informantType": "SPOUSE", "informantsSignature": null, - "mosipAid": null, "otherInformantType": null, "page": null, "paperFormID": null, @@ -1384,7 +1382,6 @@ Object { "inCompleteFields": null, "informantType": "GROOM", "informantsSignature": null, - "mosipAid": null, "otherInformantType": null, "page": null, "paperFormID": null, diff --git a/packages/gateway/src/features/registration/schema.graphql b/packages/gateway/src/features/registration/schema.graphql index eab611f0358..0e95bbd8646 100644 --- a/packages/gateway/src/features/registration/schema.graphql +++ b/packages/gateway/src/features/registration/schema.graphql @@ -359,8 +359,6 @@ input RegistrationInput { draftId: String # long uuid for preventing an event from duplicate submission # short uuid easy to remember trackingId: String - # ID generated by MOSIP that customer can use to check up on a birth reg ID application - mosipAid: String # BRN (Birth Registration Number) DRN (Death Registration Number) - Format to be decided registrationNumber: String paperFormID: String @@ -391,8 +389,6 @@ type Registration { # -> Task draftId: String # short uuid easy to remember trackingId: String # -> .identifier - # ID generated by MOSIP that customer can use to check up on a birth reg ID application - mosipAid: String # BRN (Birth Registration Number) DRN (Death Registration Number) - Format to be decided registrationNumber: String # -> .identifier paperFormID: String # -> .identifier diff --git a/packages/gateway/src/features/registration/type-resolvers.ts b/packages/gateway/src/features/registration/type-resolvers.ts index 407a8af2c8c..adea50cede8 100644 --- a/packages/gateway/src/features/registration/type-resolvers.ts +++ b/packages/gateway/src/features/registration/type-resolvers.ts @@ -731,27 +731,6 @@ export const typeResolvers: GQLResolver = { return (foundIdentifier && foundIdentifier.value) || null }, - async mosipAid(task: Task) { - const mosipAidType = - task && - task.code && - task.code.coding && - task.code.coding[0] && - task.code.coding[0].code - - if (mosipAidType !== 'BIRTH') { - return null - } - - const foundIdentifier = - task.identifier && - task.identifier.find( - (identifier: Identifier) => - identifier.system === `${OPENCRVS_SPECIFICATION_URL}id/mosip-aid` - ) - - return (foundIdentifier && foundIdentifier.value) || null - }, async attachments(task: Task, _, context) { if (!task.focus) { throw new Error( diff --git a/packages/gateway/src/graphql/schema.d.ts b/packages/gateway/src/graphql/schema.d.ts index 31096478dd8..c4249b7df93 100644 --- a/packages/gateway/src/graphql/schema.d.ts +++ b/packages/gateway/src/graphql/schema.d.ts @@ -657,7 +657,6 @@ export interface GQLRegistration { _fhirID?: string draftId?: string trackingId?: string - mosipAid?: string registrationNumber?: string paperFormID?: string page?: string @@ -1070,7 +1069,6 @@ export interface GQLRegistrationInput { _fhirID?: string draftId?: string trackingId?: string - mosipAid?: string registrationNumber?: string paperFormID?: string page?: string @@ -5401,7 +5399,6 @@ export interface GQLRegistrationTypeResolver { _fhirID?: RegistrationTo_fhirIDResolver draftId?: RegistrationToDraftIdResolver trackingId?: RegistrationToTrackingIdResolver - mosipAid?: RegistrationToMosipAidResolver registrationNumber?: RegistrationToRegistrationNumberResolver paperFormID?: RegistrationToPaperFormIDResolver page?: RegistrationToPageResolver @@ -5465,15 +5462,6 @@ export interface RegistrationToTrackingIdResolver< ): TResult } -export interface RegistrationToMosipAidResolver { - ( - parent: TParent, - args: {}, - context: Context, - info: GraphQLResolveInfo - ): TResult -} - export interface RegistrationToRegistrationNumberResolver< TParent = any, TResult = any diff --git a/packages/gateway/src/graphql/schema.graphql b/packages/gateway/src/graphql/schema.graphql index c254f048bd2..dbb0ca72acc 100644 --- a/packages/gateway/src/graphql/schema.graphql +++ b/packages/gateway/src/graphql/schema.graphql @@ -778,7 +778,6 @@ type Registration { _fhirID: ID draftId: String trackingId: String - mosipAid: String registrationNumber: String paperFormID: String page: String @@ -1167,7 +1166,6 @@ input RegistrationInput { _fhirID: ID draftId: String trackingId: String - mosipAid: String registrationNumber: String paperFormID: String page: String diff --git a/packages/search/src/features/search/utils.ts b/packages/search/src/features/search/utils.ts index 708d98ac87a..d7550b9f785 100644 --- a/packages/search/src/features/search/utils.ts +++ b/packages/search/src/features/search/utils.ts @@ -757,7 +757,6 @@ export const findPatientPrimaryIdentifier = (patient: Patient) => [ 'PASSPORT', 'NATIONAL_ID', - 'MOSIP_PSUT_TOKEN_ID', 'DECEASED_PATIENT_ENTRY', 'BIRTH_PATIENT_ENTRY', 'DRIVING_LICENSE', diff --git a/packages/workflow/src/__mocks__/constants.ts b/packages/workflow/src/__mocks__/constants.ts index 1785c5a3700..76446ad0368 100644 --- a/packages/workflow/src/__mocks__/constants.ts +++ b/packages/workflow/src/__mocks__/constants.ts @@ -17,7 +17,6 @@ export const DOCUMENTS_URL = 'http://localhost:9050' export const NOTIFICATION_SERVICE_URL = 'http://localhost:2020/' export const APPLICATION_CONFIG_URL = 'http://localhost:2021/' export const COUNTRY_CONFIG_URL = 'http://localhost:3040' -export const MOSIP_TOKEN_SEEDER_URL = 'http://localhost:8085' export const WEBHOOKS_URL = 'http://localhost:2525/' export function getDefaultLanguage() { return 'en' diff --git a/packages/workflow/src/constants.ts b/packages/workflow/src/constants.ts index 285caf6631e..8896c7181b4 100644 --- a/packages/workflow/src/constants.ts +++ b/packages/workflow/src/constants.ts @@ -21,8 +21,6 @@ export const SEARCH_URL = process.env.SEARCH_URL || 'http://localhost:9090/' export const WEBHOOKS_URL = process.env.WEBHOOKS_URL || 'http://localhost:2525/' export const METRICS_URL = process.env.METRICS_URL || 'http://localhost:1050/' -export const MOSIP_TOKEN_SEEDER_URL = - process.env.MOSIP_TOKEN_SEEDER_URL || 'http://localhost:8085' export const COUNTRY_CONFIG_URL = process.env.COUNTRY_CONFIG_URL || 'http://localhost:3040' export const CERT_PUBLIC_KEY_PATH = diff --git a/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.test.ts b/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.test.ts index 5f25a79e018..59723dc9e33 100644 --- a/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.test.ts +++ b/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.test.ts @@ -8,30 +8,14 @@ * * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ -import { server as mswServer } from '@test/setupServer' -import { rest } from 'msw' import { setupRegistrationWorkflow, - setupLastRegUser, - validateDeceasedDetails + setupLastRegUser } from '@workflow/features/registration/fhir/fhir-bundle-modifier' import { OPENCRVS_SPECIFICATION_URL } from '@workflow/features/registration/fhir/constants' -import { - testFhirBundle, - mosipSuccessMock, - mosipConfigMock, - mosipDeceasedPatientMock, - mosipBirthPatientBundleMock, - mosipUpdatedDeceasedPatientMock -} from '@workflow/test/utils' +import { testFhirBundle } from '@workflow/test/utils' import { Practitioner, Task } from '@opencrvs/commons/types' import { cloneDeep } from 'lodash' -import * as jwt from 'jsonwebtoken' -import { readFileSync } from 'fs' -import * as fetchAny from 'jest-fetch-mock' -import { MOSIP_TOKEN_SEEDER_URL } from '@workflow/constants' - -const fetch = fetchAny as any describe('Verify fhir bundle modifier functions', () => { describe('SetupRegistrationWorkflow', () => { @@ -217,55 +201,3 @@ describe('Verify fhir bundle modifier functions', () => { }) }) }) - -describe('validateDeceasedDetails functions', () => { - let token: string - let authHeader: { Authorization: string } - beforeEach(async () => { - fetch.resetMocks() - token = jwt.sign({ scope: ['register'] }, readFileSync('./test/cert.key'), { - algorithm: 'RS256', - issuer: 'opencrvs:auth-service', - audience: 'opencrvs:workflow-user' - }) - - authHeader = { - Authorization: `Bearer ${token}` - } - }) - it('Validates deceased details and modifies bundle', async () => { - mswServer.use( - rest.get('http://localhost:2021/integrationConfig', (_, res, ctx) => { - return res(ctx.json(mosipConfigMock)) - }) - ) - - mswServer.use( - rest.post(`${MOSIP_TOKEN_SEEDER_URL}/authtoken/json`, (_, res, ctx) => - res(ctx.json(mosipSuccessMock)) - ) - ) - - mswServer.use( - rest.get('http://localhost:3447/fhir/Patient', (_, res, ctx) => - res(ctx.json(mosipBirthPatientBundleMock)) - ) - ) - - mswServer.use( - rest.put( - 'http://localhost:3447/fhir/Patient/1c9add9b-9215-49d7-bfaa-226c82ac47d2', - (_, res, ctx) => res(ctx.json({})) - ) - ) - - const validateResponse = await validateDeceasedDetails( - mosipDeceasedPatientMock, - authHeader - ) - expect(validateResponse).toEqual(mosipUpdatedDeceasedPatientMock) - }) - afterAll(async () => { - jest.clearAllMocks() - }) -}) diff --git a/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.ts b/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.ts index c1f6bd98650..c471f6add58 100644 --- a/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.ts +++ b/packages/workflow/src/features/registration/fhir/fhir-bundle-modifier.ts @@ -25,7 +25,7 @@ import { resourceIdentifierToUUID, SupportedPatientIdentifierCode } from '@opencrvs/commons/types' -import { APPLICATION_CONFIG_URL, COUNTRY_CONFIG_URL } from '@workflow/constants' +import { COUNTRY_CONFIG_URL } from '@workflow/constants' import { OPENCRVS_SPECIFICATION_URL, RegStatus @@ -33,11 +33,8 @@ import { import { getSectionEntryBySectionCode } from '@workflow/features/registration/fhir/fhir-template' import { fetchExistingRegStatusCode, - getFromFhir, - getRegStatusCode, - updateResourceInHearth + getRegStatusCode } from '@workflow/features/registration/fhir/fhir-utils' -import { getMosipUINToken } from '@workflow/features/registration/utils' import { getPractitionerRef } from '@workflow/features/user/utils' import { ITokenPayload } from '@workflow/utils/auth-utils' import fetch from 'node-fetch' @@ -205,166 +202,3 @@ export function updatePatientIdentifierWithRN( return patient }) } - -interface Integration { - name: string - status: string - integratingSystemType: 'MOSIP' | 'OTHER' -} - -const statuses = { - PENDING: 'pending', - ACTIVE: 'active', - DISABLED: 'disabled', - DEACTIVATED: 'deactivated' -} - -export async function validateDeceasedDetails( - patient: Saved, - authHeader: { Authorization: string } -): Promise> { - /* - In OCRVS-1637 https://github.com/opencrvs/opencrvs-core/pull/964 we attempted to create a longitudinal - record of life events by an attempt to use an existing person in gateway if an identifier is supplied that we already - have a record of in our system, rather than creating a new patient every time. - - However this supplied identifier cannot be trusted. This could lead to links between persons being abused or the wrong indivdual - being marked as deceased. - - Any external identifier must be justifiably verified as authentic by a National ID system such as MOSIP or equivalent - */ - - const configResponse: Integration[] | undefined = await fetch( - `${APPLICATION_CONFIG_URL}integrationConfig`, - { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - ...authHeader - } - } - ) - .then((response) => { - return response.json() - }) - .catch((error) => { - return Promise.reject( - new Error(`Config request failed: ${error.message}`) - ) - }) - logger.info('validateDeceasedDetails response successful') - if (configResponse?.length) { - const mosipIntegration = configResponse.filter((integration) => { - return integration.integratingSystemType === 'MOSIP' - })[0] - if (mosipIntegration && mosipIntegration.status === statuses.ACTIVE) { - logger.info('validateDeceasedDetails: MOSIP ENABLED') - try { - const mosipTokenSeederResponse = await getMosipUINToken(patient) - logger.info(`MOSIP responded successfully`) - if ( - (mosipTokenSeederResponse.errors && - mosipTokenSeederResponse.errors.length) || - !mosipTokenSeederResponse.response.authToken - ) { - logger.info( - `MOSIP token request failed with errors: ${JSON.stringify( - mosipTokenSeederResponse.errors - )}` - ) - } else if (mosipTokenSeederResponse.response.authStatus === false) { - logger.info( - `MOSIP token request failed with false authStatus: ${JSON.stringify( - mosipTokenSeederResponse.errors - )}` - ) - } else { - const birthPatientBundle: Bundle = await getFromFhir( - `/Patient?identifier=${mosipTokenSeederResponse.response.authToken}` - ) - logger.info( - `Patient bundle returned by MOSIP Token Seeder search. Bundle id: ${birthPatientBundle.id}` - ) - let birthPatient: Partial & Pick = { - resourceType: 'Patient' - } - if ( - birthPatientBundle && - birthPatientBundle.entry && - birthPatientBundle.entry.length - ) { - birthPatientBundle.entry.forEach((entry) => { - const bundlePatient = entry.resource as Patient - const selectedIdentifier = bundlePatient.identifier?.filter( - (identifier) => { - return ( - identifier.type?.coding?.[0].code === - 'MOSIP_PSUT_TOKEN_ID' && - identifier.value === - mosipTokenSeederResponse.response.authToken - ) - } - )[0] - if (selectedIdentifier) { - birthPatient = bundlePatient - } - }) - } - logger.info(`birthPatient id: ${JSON.stringify(birthPatient.id)}`) - if ( - birthPatient && - birthPatient.identifier && - birthPatient.resourceType - ) { - // If existing patient can be found - // mark existing OpenCRVS birth patient as deceased with link to this patient - // Keep both Patient copies as a history of name at birth, may not be that recorde for name at death etc ... - // One should not overwrite the other - birthPatient.deceasedBoolean = true - birthPatient.identifier.push({ - type: { - coding: [ - { - system: `${OPENCRVS_SPECIFICATION_URL}identifier-type`, - code: 'DECEASED_PATIENT_ENTRY' - } - ] - }, - value: patient.id - }) - - await updateResourceInHearth(birthPatient) - // mark patient with link to the birth patient - patient.identifier?.push({ - type: { - coding: [ - { - system: `${OPENCRVS_SPECIFICATION_URL}identifier-type`, - code: 'BIRTH_PATIENT_ENTRY' - } - ] - }, - value: birthPatient.id! - }) - } - } - } catch (err) { - logger.info(`MOSIP token seeder request failed: ${JSON.stringify(err)}`) - } - } - } else { - // mosip not enabled - /* - TODO: Any internal OpenCRVS identifier (BRN) must be justifiably verified as authentic. - - If the form is enabled to submit a BRN in deceased form ... - OpenCRVS needs a robust MOSIP-like verification model on the BRN - We have to validate the bundle carefully against internal checks to find a legitimate birth patient. - - Ensure patient has link to the birth record if it exists. - - */ - // - } - return patient -} diff --git a/packages/workflow/src/features/registration/utils.test.ts b/packages/workflow/src/features/registration/utils.test.ts index af04631409f..001ed3612e2 100644 --- a/packages/workflow/src/features/registration/utils.test.ts +++ b/packages/workflow/src/features/registration/utils.test.ts @@ -10,19 +10,13 @@ */ import { generateTrackingIdForEvents, - convertStringToASCII, - getMosipUINToken + convertStringToASCII } from '@workflow/features/registration/utils' -import { - mosipDeceasedPatientMock, - mosipSuccessMock -} from '@workflow/test/utils' import * as fetchAny from 'jest-fetch-mock' import { EVENT_TYPE } from '@workflow/features/registration/fhir/constants' import { Bundle } from '@opencrvs/commons/types' import { server as mswServer } from '@test/setupServer' import { rest } from 'msw' -import { MOSIP_TOKEN_SEEDER_URL } from '@workflow/constants' const fetch = fetchAny as any @@ -88,18 +82,3 @@ describe('Verify utility functions', () => { expect(ascii).toBe('66538771897469') }) }) - -describe('getMosipUINToken functions', () => { - beforeAll(() => { - fetch.mockClear() - }) - it('Calls mosip token seeder function and returns success', async () => { - mswServer.use( - rest.post(`${MOSIP_TOKEN_SEEDER_URL}/authtoken/json`, (_, res, ctx) => - res(ctx.json(mosipSuccessMock)) - ) - ) - const mosipResponse = await getMosipUINToken(mosipDeceasedPatientMock) - expect(mosipResponse).toEqual(mosipSuccessMock) - }) -}) diff --git a/packages/workflow/src/features/registration/utils.ts b/packages/workflow/src/features/registration/utils.ts index 06aeee71607..44e5081ded3 100644 --- a/packages/workflow/src/features/registration/utils.ts +++ b/packages/workflow/src/features/registration/utils.ts @@ -12,17 +12,14 @@ import { Bundle, BundleEntry, Composition, - Patient, Resource, Saved, Task, TrackingID } from '@opencrvs/commons/types' -import { COUNTRY_CONFIG_URL, MOSIP_TOKEN_SEEDER_URL } from '@workflow/constants' +import { COUNTRY_CONFIG_URL } from '@workflow/constants' import { EVENT_TYPE } from '@workflow/features/registration/fhir/constants' -import { concatenateName } from '@workflow/features/registration/fhir/fhir-utils' import { getTaskEventType } from '@workflow/features/task/fhir/utils' -import { logger } from '@opencrvs/commons' import fetch from 'node-fetch' import * as ShortUIDGen from 'short-uid' @@ -115,100 +112,6 @@ export function isInProgressDeclaration(fhirBundle: Bundle) { ) } -interface IMosipAuthData { - vid?: string - name?: string - gender?: string - phoneNumber?: string - dob?: string // Format "1998/01/01" - emailId?: string - fullAddress?: string -} - -interface IMosipRequest { - deliverytype?: 'sync' - output?: string | '' - lang: 'eng' - authdata: IMosipAuthData -} - -interface IMosipSeederPayload { - id: string | '' - version: string | '' - metadata: string | '' - requesttime: string | '' - request: IMosipRequest -} - -interface IMosipErrors { - errorCode: string - errorMessage: string - actionMessage: string -} - -interface IMosipSeederResponseContent { - authStatus: boolean - authToken: string -} - -interface IMosipSeederResponse { - id: 'mosip.identity.auth' - version: 'v1' - responseTime: string - transactionID: string - response: IMosipSeederResponseContent - errors: IMosipErrors[] -} - -export async function getMosipUINToken( - patient: Patient -): Promise { - logger.info(`getMosipUINToken for Patient id ${patient.id}`) - let submittedNationalIDInForm = '' - const identifiers = patient?.identifier?.filter( - (identifier: fhir3.Identifier) => { - return identifier.type?.coding?.[0].code === 'NATIONAL_ID' - } - ) - if (identifiers) { - submittedNationalIDInForm = `${identifiers[0].value}` - } - const payload: IMosipSeederPayload = { - id: '', - version: '', - metadata: '', - requesttime: new Date().toISOString(), - request: { - lang: 'eng', - authdata: { - vid: submittedNationalIDInForm, - name: concatenateName(patient.name), - gender: patient.gender, - dob: patient.birthDate?.replace(/-/g, '/') - // TODO: send informant contact phone number? We dont ask for deceased's phone number in Civil Reg form currently - // TODO: send address in a way MOSIP can understand - } - } - } - const res = await fetch(`${MOSIP_TOKEN_SEEDER_URL}/authtoken/json`, { - method: 'POST', - body: JSON.stringify(payload), - headers: { - 'Content-Type': 'application/json' - } - }) - - if (!res.ok) { - logger.info( - `Unable to retrieve system mosip UIN token. Error: ${res.status} status received` - ) - } - - const body = await res.json() - - return body -} - function getResourceByType( bundle: Bundle, type: string diff --git a/packages/workflow/src/records/state-transitions.ts b/packages/workflow/src/records/state-transitions.ts index d190b5cd1f4..8b884c559d1 100644 --- a/packages/workflow/src/records/state-transitions.ts +++ b/packages/workflow/src/records/state-transitions.ts @@ -60,8 +60,7 @@ import { invokeRegistrationValidation, setupLastRegOffice, setupLastRegUser, - updatePatientIdentifierWithRN, - validateDeceasedDetails + updatePatientIdentifierWithRN } from '@workflow/features/registration/fhir/fhir-bundle-modifier' import { EventRegistrationPayload } from '@workflow/features/registration/handler' import { ASSIGNED_EXTENSION_URL } from '@workflow/features/task/fhir/constants' @@ -522,16 +521,6 @@ export async function toRegistered( }) } - if (event === EVENT_TYPE.DEATH) { - /** using first patient because for death event there is only one patient */ - patientsWithRegNumber[0] = await validateDeceasedDetails( - patientsWithRegNumber[0], - { - Authorization: request.headers.authorization - } - ) - } - const patientIds = patientsWithRegNumber.map((p) => p.id) const patientsEntriesWithRN = record.entry.filter((e) => patientIds.includes(e.resource.id) diff --git a/packages/workflow/src/test/utils.ts b/packages/workflow/src/test/utils.ts index 0892f84e12d..7193ce5b35f 100644 --- a/packages/workflow/src/test/utils.ts +++ b/packages/workflow/src/test/utils.ts @@ -350,141 +350,6 @@ export const fieldAgentPractitionerMock = JSON.stringify({ ] }) -type PatientIdentifier = NonNullable[number] - -const drnIdentifier = { - type: { - coding: [ - { - system: 'http://opencrvs.org/specs/identifier-type', - code: 'DEATH_REGISTRATION_NUMBER' - } - ] - }, - value: '2022DSNEYUG' -} satisfies PatientIdentifier - -const nidIdentifier = { - value: '654654666', - type: { - coding: [ - { - system: 'http://opencrvs.org/specs/identifier-type', - code: 'NATIONAL_ID' - } - ] - } -} satisfies PatientIdentifier - -const brnIdentifier = { - type: { - coding: [ - { - system: 'http://opencrvs.org/specs/identifier-type', - code: 'BIRTH_REGISTRATION_NUMBER' - } - ] - }, - value: '2022BSNEYUG' -} satisfies PatientIdentifier - -const mosipPsutTokenIdentifier = { - type: { - coding: [ - { - system: 'http://opencrvs.org/specs/identifier-type', - code: 'MOSIP_PSUT_TOKEN_ID' - } - ] - }, - value: '257803821990055124230310596669133515' -} as fhir3.CodeableConcept - -const birthPatientIdentifier = { - type: { - coding: [ - { - system: 'http://opencrvs.org/specs/identifier-type', - code: 'BIRTH_PATIENT_ENTRY' - } - ] - }, - value: '1c9add9b-9215-49d7-bfaa-226c82ac47d2' -} as fhir3.CodeableConcept - -export const mosipDeceasedPatientMock: Saved = { - resourceType: 'Patient', - active: true, - id: '1c9add9b-9215-49d7-bfaa-226c82ac47d1' as UUID, - name: [ - { - use: 'en', - given: ['Sakib Al'], - family: 'Hasan' - } - ], - gender: 'male', - deceased: true, - birthDate: '1990-09-01', - identifier: [nidIdentifier, drnIdentifier] -} - -export const mosipUpdatedDeceasedPatientMock = { - resourceType: 'Patient', - active: true, - id: '1c9add9b-9215-49d7-bfaa-226c82ac47d1', - name: [ - { - use: 'en', - given: ['Sakib Al'], - family: 'Hasan' - } - ], - gender: 'male', - deceased: true, - birthDate: '1990-09-01', - identifier: [nidIdentifier, drnIdentifier, birthPatientIdentifier] -} - -const mosipBirthPatientMock = { - resourceType: 'Patient', - active: true, - id: '1c9add9b-9215-49d7-bfaa-226c82ac47d2', - name: [ - { - use: 'bn', - given: ['Sakib Al'], - family: ['Hasan'] - } - ], - gender: 'male', - birthDate: '1990-09-01', - multipleBirthInteger: 1, - identifier: [brnIdentifier, mosipPsutTokenIdentifier] -} - -export const mosipBirthPatientBundleMock = { - resourceType: 'Bundle', - type: 'document', - entry: [ - { - fullUrl: `urn:uuid:888` as URNReference, - resource: mosipBirthPatientMock - } - ] -} - -export const mosipSuccessMock = { - transactionID: '5763906453', - version: '1.0', - id: 'mosip.identity.auth', - errors: null, - responseTime: '2022-08-30T08:15:11.033Z', - response: { - authStatus: true, - authToken: '257803821990055124230310596669133515' - } -} export const mosipConfigMock = [ { status: 'active', name: 'Sweet Health', integratingSystemType: 'MOSIP' } ]