primary_care_admin_binder 0.1.177 → 0.1.178

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.
Files changed (2) hide show
  1. package/dist/index.cjs.js +42 -17
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -8954,7 +8954,8 @@ var typeToKeyMap = {
8954
8954
  var tables = {
8955
8955
  "GEOGRAPHIC_MASTER": "SMGeographicMaster",
8956
8956
  "FREQUENCY_MASTER": "FrequencyMaster",
8957
- "GENERAL_MASTER": "CodingMaster"
8957
+ "GENERAL_MASTER": "CodingMaster",
8958
+ "ORGANIZATION_MASTER": "Organization"
8958
8959
  };
8959
8960
 
8960
8961
  var codingMasterFilter = function codingMasterFilter(type) {
@@ -30561,11 +30562,11 @@ var ReadTreeDetailJson = function ReadTreeDetailJson(data, parentOrgName) {
30561
30562
 
30562
30563
  // Process specialty details
30563
30564
  var specialtyDetailsArr = ((_data$specialtyDetail = data.specialtyDetails) !== null && _data$specialtyDetail !== void 0 ? _data$specialtyDetail : []).map(function (val) {
30564
- var _val$specialty$descri, _val$specialty;
30565
+ var _val$specialty, _val$specialty2, _val$specialty3;
30565
30566
  return {
30566
30567
  effFrom: val !== null && val !== void 0 && val.effFrom ? moment.unix(val.effFrom).format('DD-MM-YYYY') : '',
30567
30568
  effTo: val !== null && val !== void 0 && val.effTo ? moment.unix(val.effTo).format('DD-MM-YYYY') : '',
30568
- specialty: (_val$specialty$descri = val === null || val === void 0 || (_val$specialty = val.specialty) === null || _val$specialty === void 0 ? void 0 : _val$specialty.description) !== null && _val$specialty$descri !== void 0 ? _val$specialty$descri : ''
30569
+ specialty: _typeof(val === null || val === void 0 ? void 0 : val.specialty) === 'object' ? (val === null || val === void 0 || (_val$specialty = val.specialty) === null || _val$specialty === void 0 ? void 0 : _val$specialty.display) || (val === null || val === void 0 || (_val$specialty2 = val.specialty) === null || _val$specialty2 === void 0 ? void 0 : _val$specialty2.description) || '' : (_val$specialty3 = val === null || val === void 0 ? void 0 : val.specialty) !== null && _val$specialty3 !== void 0 ? _val$specialty3 : ''
30569
30570
  };
30570
30571
  });
30571
30572
 
@@ -30736,8 +30737,10 @@ var generateJson$8 = {
30736
30737
  };
30737
30738
  });
30738
30739
  var specialtyDetailsArr = data === null || data === void 0 || (_data$specialtyDetail = data.specialtyDetails) === null || _data$specialtyDetail === void 0 ? void 0 : _data$specialtyDetail.map(function (val, i) {
30740
+ var specId = (val === null || val === void 0 ? void 0 : val.dropdown.id) || (val === null || val === void 0 ? void 0 : val.dropdown.value);
30741
+ var cleanSpecId = typeof specId === "string" && specId.includes("/") ? specId.split("/")[1] : specId;
30739
30742
  return {
30740
- specialty: val === null || val === void 0 ? void 0 : val.dropdown.id,
30743
+ specialty: cleanSpecId,
30741
30744
  effFrom: moment(val === null || val === void 0 ? void 0 : val.effFrom, "DD-MM-YYYY").unix(),
30742
30745
  effTo: moment(val === null || val === void 0 ? void 0 : val.effTo, "DD-MM-YYYY").unix(),
30743
30746
  external: false
@@ -30785,7 +30788,7 @@ var generateJson$8 = {
30785
30788
  }
30786
30789
  return [_objectSpread2(_objectSpread2({
30787
30790
  appcode: dbName,
30788
- collection: "Organization",
30791
+ collection: tables.ORGANIZATION_MASTER,
30789
30792
  is_metadata: true,
30790
30793
  metadata_dbname: metaDatadbName$1,
30791
30794
  metadataId: metaDataId$1
@@ -30827,8 +30830,21 @@ var generateJson$8 = {
30827
30830
  }
30828
30831
  };
30829
30832
  var unixToLocalDate = function unixToLocalDate(unixTimestamp) {
30830
- if (typeof unixTimestamp !== "number" || unixTimestamp <= 0) return null;
30831
- return moment.unix(unixTimestamp).local().toDate();
30833
+ if (unixTimestamp === null || unixTimestamp === undefined || unixTimestamp === "") return null;
30834
+ if (typeof unixTimestamp === "number" && unixTimestamp > 0) {
30835
+ return moment.unix(unixTimestamp).local().toDate();
30836
+ }
30837
+ if (typeof unixTimestamp === "string") {
30838
+ if (!isNaN(unixTimestamp) && Number(unixTimestamp) > 0) {
30839
+ return moment.unix(Number(unixTimestamp)).local().toDate();
30840
+ }
30841
+ var m = moment(unixTimestamp, ["YYYY-MM-DD", "DD-MM-YYYY", moment.ISO_8601], true);
30842
+ return m.isValid() ? m.toDate() : null;
30843
+ }
30844
+ if (unixTimestamp instanceof Date && !isNaN(unixTimestamp)) {
30845
+ return unixTimestamp;
30846
+ }
30847
+ return null;
30832
30848
  };
30833
30849
  var generateReadJson$2 = {
30834
30850
  read_json: function read_json(data) {
@@ -30860,8 +30876,8 @@ var generateReadJson$2 = {
30860
30876
  var AliasArr = ((_data$alias = data.alias) !== null && _data$alias !== void 0 ? _data$alias : []).map(function (v) {
30861
30877
  var _v$aliasType$display, _v$aliasType$_id, _v$aliasDesc;
30862
30878
  return {
30863
- startdate: v !== null && v !== void 0 && v.aliasStart ? moment(v.aliasStart, "DD-MM-YYYY").toDate() : null,
30864
- enddate: v !== null && v !== void 0 && v.aliasEnd ? moment(v.aliasEnd, "DD-MM-YYYY").toDate() : null,
30879
+ startdate: unixToLocalDate(v === null || v === void 0 ? void 0 : v.aliasStart),
30880
+ enddate: unixToLocalDate(v === null || v === void 0 ? void 0 : v.aliasEnd),
30865
30881
  aliastype: v !== null && v !== void 0 && v.aliasType ? {
30866
30882
  title: (_v$aliasType$display = v.aliasType.display) !== null && _v$aliasType$display !== void 0 ? _v$aliasType$display : "",
30867
30883
  value: (_v$aliasType$_id = v.aliasType._id) !== null && _v$aliasType$_id !== void 0 ? _v$aliasType$_id : ""
@@ -30990,24 +31006,33 @@ var generateReadJson$2 = {
30990
31006
 
30991
31007
  // --- Specialty Details ---
30992
31008
  var specialtyDetailsArr = ((_data$specialtyDetail2 = data.specialtyDetails) !== null && _data$specialtyDetail2 !== void 0 ? _data$specialtyDetail2 : []).map(function (val) {
30993
- var _specialty$descriptio, _specialty$specialtyC, _specialty$_id, _specialty$code, _specialty$descriptio2, _specialty$_id2;
30994
31009
  var effFrom = unixToLocalDate(val === null || val === void 0 ? void 0 : val.effFrom);
30995
31010
  var effTo = unixToLocalDate(val === null || val === void 0 ? void 0 : val.effTo);
30996
31011
  var specialty = (val === null || val === void 0 ? void 0 : val.specialty) || {};
30997
- var label = specialty.description ? "".concat(specialty.description, " (").concat(specialty.specialtyCode || "", ")") : "";
31012
+ var specialty_id = "";
31013
+ var specialty_name = "";
31014
+ var specialty_code = "";
31015
+ if (typeof specialty === "string") {
31016
+ specialty_id = specialty;
31017
+ } else if (_typeof(specialty) === "object") {
31018
+ specialty_id = specialty._id || specialty.id || "";
31019
+ specialty_name = specialty.description || specialty.display || specialty.name || "";
31020
+ specialty_code = specialty.specialtyCode || specialty.code || "";
31021
+ }
31022
+ var label = specialty_name ? "".concat(specialty_name, " (").concat(specialty_code || "", ")") : "";
30998
31023
  return {
30999
31024
  effFrom: effFrom ? effFrom : null,
31000
31025
  effTo: effTo ? effTo : null,
31001
- specialty: (_specialty$descriptio = specialty.description) !== null && _specialty$descriptio !== void 0 ? _specialty$descriptio : "",
31002
- code: (_specialty$specialtyC = specialty.specialtyCode) !== null && _specialty$specialtyC !== void 0 ? _specialty$specialtyC : "",
31003
- specialty_id: (_specialty$_id = specialty._id) !== null && _specialty$_id !== void 0 ? _specialty$_id : "",
31026
+ specialty: specialty_name,
31027
+ code: specialty_code,
31028
+ specialty_id: specialty_id,
31004
31029
  fromDate: effFrom,
31005
31030
  toDate: effTo,
31006
31031
  dropdown: {
31007
31032
  label: label,
31008
- value: (_specialty$code = specialty.code) !== null && _specialty$code !== void 0 ? _specialty$code : "",
31009
- name: (_specialty$descriptio2 = specialty.description) !== null && _specialty$descriptio2 !== void 0 ? _specialty$descriptio2 : "",
31010
- id: (_specialty$_id2 = specialty._id) !== null && _specialty$_id2 !== void 0 ? _specialty$_id2 : ""
31033
+ value: specialty_code,
31034
+ name: specialty_name,
31035
+ id: specialty_id
31011
31036
  }
31012
31037
  };
31013
31038
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primary_care_admin_binder",
3
- "version": "0.1.177",
3
+ "version": "0.1.178",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",