Explore all Healthcare related open source software, libraries, packages, source code, cloud functions and APIs.

The healthcare sector consists of businesses that provide medical services, manufacture medical equipment or drugs, provide medical insurance, or otherwise facilitate the provision of healthcare to patients.

These software components cover functions across Pharma and Life Sciences, Healthcare Providers areas.

Popular New Releases in Healthcare

MONAI

0.8.1

deepvariant

DeepVariant 1.3.0

Viewers

@ohif/core@2.16.18

corona-cli

🚀 RELEASE: 5.3.3

wger

Popular Libraries in Healthcare

covid-19-data

by owid doticonpythondoticon

star image 5212 doticon

Data on COVID-19 (coronavirus) cases, deaths, hospitalizations, tests • All countries • Updated daily by Our World in Data

MONAI

by Project-MONAI doticonpythondoticon

star image 2901 doticonApache-2.0

AI Toolkit for Healthcare Imaging

biopython

by biopython doticonpythondoticon

star image 2836 doticonNOASSERTION

Official git repository for Biopython (originally converted from CVS)

bootstrap-validator

by 1000hz doticonjavascriptdoticon

star image 2407 doticonMIT

A user-friendly HTML5 form validation jQuery plugin for Bootstrap 3

deepvariant

by google doticonpythondoticon

star image 2390 doticonBSD-3-Clause

DeepVariant is an analysis pipeline that uses a deep neural network to call genetic variants from next-generation DNA sequencing data.

API

by disease-sh doticonjavascriptdoticon

star image 2368 doticonGPL-3.0

API for Current cases and more stuff about COVID-19 and Influenza

corona

by geohot doticonpythondoticon

star image 1920 doticon

Reverse engineering SARS-CoV-2

Viewers

by OHIF doticonjavascriptdoticon

star image 1875 doticonMIT

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages

openemr

by openemr doticonphpdoticon

star image 1855 doticonNOASSERTION

The most popular open source electronic health records and medical practice management solution.

Trending New libraries in Healthcare

covid-19-data

by owid doticonpythondoticon

star image 5212 doticon

Data on COVID-19 (coronavirus) cases, deaths, hospitalizations, tests • All countries • Updated daily by Our World in Data

API

by disease-sh doticonjavascriptdoticon

star image 2368 doticonGPL-3.0

API for Current cases and more stuff about COVID-19 and Influenza

corona

by geohot doticonpythondoticon

star image 1920 doticon

Reverse engineering SARS-CoV-2

corona-cli

by ahmadawais doticonjavascriptdoticon

star image 1746 doticonMIT

🦠 Track the Coronavirus disease (COVID-19) in the command line. Worldwide for all countries, for one country, and the US States. Fast response time (< 100ms). To chat: https://twitter.com/MrAhmadAwais/

coronavirus-tracker-api

by ExpDev07 doticonpythondoticon

star image 1530 doticonGPL-3.0

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!

awesome-coronavirus

by soroushchehresa doticonjavascriptdoticon

star image 1403 doticonMIT

🦠 Huge collection of useful projects and resources for COVID-19 (2019 novel Coronavirus)

covid19_scenarios

by neherlab doticonjavascriptdoticon

star image 1380 doticonMIT

Models of COVID-19 outbreak trajectories and hospital demand

ncov

by nextstrain doticonpythondoticon

star image 1270 doticonMIT

Nextstrain build for novel coronavirus SARS-CoV-2

covid19

by pomber doticonjavascriptdoticon

star image 1186 doticon

JSON time-series of coronavirus cases (confirmed, deaths and recovered) per country - updated daily

Top Authors in Healthcare

1

NCBI-Hackathons

12 Libraries

star icon114

2

KarchinLab

4 Libraries

star icon70

3

AlexandrovLab

4 Libraries

star icon167

4

broadinstitute

3 Libraries

star icon58

5

compomics

3 Libraries

star icon74

6

Genomon-Project

3 Libraries

star icon47

7

aws-samples

3 Libraries

star icon69

8

WGLab

3 Libraries

star icon64

9

dfci

3 Libraries

star icon32

10

urmi-21

3 Libraries

star icon52

1

12 Libraries

star icon114

2

4 Libraries

star icon70

3

4 Libraries

star icon167

4

3 Libraries

star icon58

5

3 Libraries

star icon74

6

3 Libraries

star icon47

7

3 Libraries

star icon69

8

3 Libraries

star icon64

9

3 Libraries

star icon32

10

3 Libraries

star icon52

Trending Kits in Healthcare

The healthcare system is genuinely stretched with a growing population, expanding life expectancy, and now further with the pandemic. The health-tech industry has delivered multiple innovations over the years. With maturing AI and investments in the healthcare space, Ambient Clinical Intelligence has emerged as a critical focus area in heath-tech.

Ambient Clinical Intelligence encompasses leveraging AI across the provider lifecycle and seamlessly integrating with Electronic Health Records systems. The most impactful areas are automated clinical documentation, improving patient data for downstream provider and payer processes, reducing provider workload, and improving the time they can spend with patient care activities. Additional use cases across telehealth, radiology, medical events prediction, payer adjudication are possible with Ambient Clinical Intelligence.

To help jumpstart your Ambient Clinical Intelligence applications, we have assembled a diverse set of software components.

If you are further interested, search to discover more exciting components to jumpstart your application development on kandi.

Speech to Text and NLP

stanza by stanfordnlp, Medico by pranayjoshi, PrescAI by 090max are components that help you experiment on speech to text and NLP with specialization on healthcare.

Cloud Speech to Text

If you would like to compare the speech to text capabilities of the hyperscale cloud providers, try Cloud Speech-to-Text API by Google, Train-Custom-Speech-Model by IBM, and amazon-comprehend-medical-fhir-integrationby aws-samples.

Automated Clinical Actions

If you further want to experiment on medical event prediction and automated clinical actions, try ehr-rwe by som-shahlab, SequentialPhenotypePredictor by wael34218, MetaPred by sheryl-ai, CogStack-SemEHR by CogStack, clicr by clips.

Patient Data and EHR

To support these applications and experiments, you would need an EHR/ EMR to connect to, such as openemr by openemr, and tons of patient data that you can synthesize from components such as syntheaby synthetichealth.

The Healthcare Price Transparency Rule took effect this year. The rule requires hospitals in the USA to post actual prices from the rates they offer cash-paying customers to costs negotiated with insurers. The Healthcare Price Transparency Rule could help reduce prices and keep consumers informed of their choices before seeking care. Hospitals must publicly post prices for every service, drug, and supply they provide on their website. The prices must be posted in a machine-readable format, and for 300 common and “shoppable” services, they must also be provided in consumer-friendly formats.

Over the next couple of years, such healthcare information exchange initiatives are expected to accelerate. The initiatives provide a substantial opportunity for digital healthcare and health-tech solutions. Healthcare digital transformations expected in the short term are Payer-to-Payer Data exchange, No Surprises Act, Prior Authorization rule, Transparency in Coverage. Critical to the success of these initiatives is the Fast Healthcare Interoperability Resources (FHIR) framework.

There are over 1800 libraries available to accelerate your health-tech development on FHIR. The kandi collections on Healthcare Price Transparency Rule Implementation Libraries showcases the top libraries across core FHIR HL7 integration, FHIR standards related to Centers for Medicare & Medicaid Services (CMS) requirements, and libraries specific to healthcare provider pricing and analysis.

Fundamentals of FHIR

fhir by HL7, hapi-fhir by hapifhir and fhir by google are popular libraries to help cover the fundamentals of FHIR implementation.

FHIR standards related to Centers for Medicare & Medicaid Services requirements

For capabilities related to FHIR standards related to Centers for Medicare & Medicaid Services requirements, refer to Smile CDR FHIR Data Platform by Smile_CDR_Inc, QDM-QICore-Conversion by MeasureAuthoringTool and connectathon-data by paciowg.

Libraries for Hospital Price Publishing and Comparison

medicompare by hathix, provider-data-tools by HHSIDEAlab, hospitals-scraper by dtangeeda, hospitals-ui by dtangeeda, and hospital-chargemaster by vsoch provide for scraping, publishing and comparing hospital charges.

Given the strain on the healthcare infrastructure and personnel and the virality of the pandemic, telemedicine (telehealth) solutions have become a mainstay.

While larger healthcare providers have adopted scalable telehealth solutions, small and independent practitioners have to contend with ad-hoc solutions. Global data shows an uptick in telemedicine consultations and a significant increase in wait times for non COVID19 patients. This shows a significant opportunity for open telemedicine solutions that can help bridge this gap. While the entire healthcare ecosystem is in the frontline of battling the pandemic, the technology and specifically the open source community can help alleviate access to healthcare through free and open telemedicine solutions.

There are over 420 public libraries available for telemedicine solutions. kandi collection on Telemedicine Solutions provides you with public libraries that provide base schemas, frameworks, and integration for end to end telehealth solutions to readymade telemedicine platforms, interesting solutions like symptom checkers, simple telehealth solutions using Office 365 as well as nuanced use cases like providing accessible telemedicine to vulnerable populations like refugees.

Telemedicine broadly covers aspects of using smartphones and tablets in providing video conferencing consultations, varying degrees of remote patient monitoring, communication, payer integration, pharmacy integration, nursing, and others. More advanced solutions cover teletrauma, emergency care, telesurgery, amongst others.

For other Telemedicine, Telehealth solutions, or specific implementations, search on kandi.

Telemedicine Core Frameworks

cht-core by medic, and ipf by oehf provide base frameworks and integrations to help build solutions ground up for multiple use cases.

Prebuilt Telemedicine solutions

Telemedicine by opensource-emr, iMediXcare by jmGithub2021, and FollowMyHealth by Allscripts Healthcare Solutions, Inc. provide prebuilt Telemedicine solutions that you can reuse.

Schemas and Data

ehealth.schema by edenlabllc and Telemedicine Utilization data by Change Healthcare provide for schemas and data to use in understanding and designing your Telemedicine solutions.

Unique Stand-alone Use Cases

symptomchecker by priaid-eHealth, CSE-Telehealth-Samples by Microsoft and Soteria by Daniel-Wu provide unique use cases such as intelligent triaging, simple Telehealth use case implementation using existing Office 365 capabilities, and providing for discreet Telemedicine access to refugees.

Around the globe, people seek the help of doctors when they are ill, but they are not available due to some reason. The Cancer Disease Prediction application is end-user support and online consultation treatment. The application allows user to share their health-related metrics for cancer prediction, which processes patient details to check for various conditions that could be associated. We can use intelligent data mining techniques to guess the most accurate state of a patient's details. Various steps involved in this kit are: 1. Data Preparation 2. Data Mining 3. Pattern Recognition 4. Knowledge Representation Based on the result, the system automatically shows the result-specific doctors for further treatment. The system allows users to view doctor's details. Listed below are the best libraries that can help data mining and build a prediction system for cancer.

Pattern Recognition

Data Mining

Data preparation

Knowledge Representation

COVID-19 vaccination booking automation has piqued interest and seen significant movement in the repositories in the last two weeks. Created by programmers for themselves and their loved ones, these provide for good community reusability. This is a sensitive topic and not intended nor implied as a substitute for professional medical advice and is provided for educational purposes only. We've shortlisted libraries across Python, Javascript, Ruby, and Cloud APIs and showcase functions to book appointments, review vaccine availability, and understand the working of vaccination campaigns. The sample provides connectivity to vaccination programs in different countries across North America, Europe, and Asia.

Is mindfulness on your new year resolution? If so, there are dozens of open source apps that help you with guided meditation, timers, relaxing sounds, visuals, and many more. The kandi kit on Meditation and Mindfulness Apps showcases multiple apps ranging from simple web apps, mobile apps and VR. It is also fascinating to note that many apps have low stars and are undiscovered. Compare that to Headspace Health and Calm with multi-billion dollar valuations! You might have a great business opportunity at hand while achieving nirvana. Given the increasing mental health crisis accelerated by the pandemic, meditation apps have become very useful. Consumers are treating mental health as a vital parameter and are proactively seeking help for betterment. Most apps provide mindfulness and meditation tools in different forms. They could be used for coaching, self-learning, therapy, psychiatry, and many other uses. Many commercial apps are seeking clinical studies on the positive effects of meditation on patient health outcomes.

The past year has been a whirlwind across all areas, including the workplace. Global events ranging from the COVID-19 pandemic, mass social movements, the economic downturn, and mass job losses in various sectors are increasing anxiety, stress, and physical ill-health across the workplace. Unpredictable and newly formed hybrid working conditions across the global workforce are driving employee burnout. The USA had over 11.5 million workers resigning from their jobs between April to June of 2021. The World Economic Forum is launching a new Chief Health/Medical Officers community and advising businesses to prioritize workforce well-being by appointing Chief Health Officers to their boardrooms, with the mandate to build a culture of health in the workplace. There are over a few thousand open source libraries that promote workplace well-being. kandi kit on Workplace Well-Being Solutions covers use cases across scheduling break times, inspiring workdays, developing positive habits, promoting mindfulness, sharing inspiration, and more.


You can build predictive analytic based applications with this ready to deploy template application. Fully modifiable source code modifies your needs. 


Use this kandi 1-Click Solution kit to build your own AI-based Breast Cancer Detection Engine in minutes.


✅ Using this application you can do early stage detection for breast cancer and help in identifying it as malignant(cancerous) or benign(non-cancerous).

✅ You can build predictive analytic based applications with this ready to deploy template application.

✅ Fully modifiable source code is provided to enable you to modify for your requirements.

Development Environment

VSCode and Jupyter Notebook are used for development and debugging. Jupyter Notebook is a web based interactive environment often used for experiments, whereas VSCode is used to get a typical experience of IDE for developers.


Jupyter Notebook is used for our development.

Machine Learning

Simple and efficient tools for predictive data analysis.


Scikit-learn is a free software machine learning library which features various classification, regression and clustering algorithms including support-vector machines,etc. Similar libraries for ML support in Java, Scala and R programming language

Support

If you need help using this kit, you may reach us at the OpenWeaver Community.

kandi 1-Click Install

Trending Discussions on Healthcare

how to change color of links in dropdown menu in navbar toggle

Calculating numbers of week for a specific time period

Year and Text Parsing with Regex

How to get list of all objects associated with a foreign key in Django

Looping through elements with Selenium and ChromeDriver

MongoDB - Querying inner object that is an array

Dockerize Flask: Error: While importing 'app', an ImportError was raised

search unique element pairs and transform sorted result to JSON

Clean trailing period if present as last non whitespace of dataframe column

Passing several fields if meets a criteria to a Hidden Form Field

QUESTION

how to change color of links in dropdown menu in navbar toggle

Asked 2022-Apr-10 at 04:31

My navigation bar has a dropdown menu that looks like this. enter image description here when I resize my browser to get the small device version it looks like this. enter image description here

I want to change the color of links in the dropdown(services) to black but I don't know which class to select for CSS. I tried this but didn't work out.

1.dropdown-menu {
2     display: none;
3     position: absolute;
4     background-color: #00ff99;
5     min-width: 160px;
6     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
7     z-index: 1;
8}
9.dropdown-menu &gt; li &gt; a {
10     float: none;
11     color: black;
12     padding: 12px 16px;
13     text-decoration: none;
14     display: block;
15     text-align: left;
16}
17.navbar-toggle .dropdown-menu &gt; li &gt; a{
18     color: black;
19}
20
21

this is my HTML

1.dropdown-menu {
2     display: none;
3     position: absolute;
4     background-color: #00ff99;
5     min-width: 160px;
6     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
7     z-index: 1;
8}
9.dropdown-menu &gt; li &gt; a {
10     float: none;
11     color: black;
12     padding: 12px 16px;
13     text-decoration: none;
14     display: block;
15     text-align: left;
16}
17.navbar-toggle .dropdown-menu &gt; li &gt; a{
18     color: black;
19}
20
21&lt;div class=&quot;navbar navbar-inverse navbar-fixed-top&quot;&gt;
22&lt;div class=&quot;container&quot;&gt;
23&lt;div class=&quot;navbar-header&quot;&gt;
24   &lt;button type=&quot;button&quot; class=&quot;navbar-toggle&quot; data-toggle=&quot;collapse&quot; data-target=&quot;.navbar-collapse&quot;&gt;
25   &lt;span class=&quot;icon-bar&quot;&gt;&lt;/span&gt;
26   &lt;span class=&quot;icon-bar&quot;&gt;&lt;/span&gt;
27   &lt;span class=&quot;icon-bar&quot;&gt;&lt;/span&gt;
28   &lt;/button&gt;
29   @Html.ActionLink(&quot;E-HealthCare&quot;, &quot;About&quot;, &quot;Home&quot;, new { area = &quot;&quot; }, new { @class = &quot;navbar-brand shadow&quot; })
30&lt;/div&gt;
31&lt;div class=&quot;navbar-collapse collapse&quot;&gt;
32&lt;ul class=&quot;nav navbar-nav&quot;&gt;
33   &lt;li&gt;@Html.ActionLink(&quot;Home&quot;, &quot;About&quot;, &quot;Home&quot;)&lt;/li&gt;
34   @*
35   &lt;li&gt;@Html.ActionLink(&quot;About&quot;, &quot;About&quot;, &quot;Home&quot;)&lt;/li&gt;
36   &lt;li&gt;@Html.ActionLink(&quot;Contact&quot;, &quot;Contact&quot;, &quot;Home&quot;)&lt;/li&gt;
37   &lt;li&gt;@Html.DropDownList(&quot;Services&quot;,&quot;ALL&quot;)&lt;/li&gt;
38   *@
39   &lt;li&gt;
40      &lt;div class=&quot;dropdown&quot;&gt;
41         &lt;button class=&quot;Dropdown-btn btn-block text-left dropdown-toggle&quot; type=&quot;button&quot; id=&quot;dropdownMenu1&quot; data-toggle=&quot;dropdown&quot; aria-expanded=&quot;false&quot;&gt;
42         Services
43         &lt;span class=&quot;caret&quot;&gt;&lt;/span&gt;
44         &lt;/button&gt;
45         &lt;ul class=&quot;dropdown-menu&quot; aria-labelledby=&quot;dropdownMenu1&quot;&gt;
46            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Action&lt;/a&gt;&lt;/li&gt;
47            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Another action&lt;/a&gt;&lt;/li&gt;
48            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Something else here&lt;/a&gt;&lt;/li&gt;
49            &lt;li role=&quot;separator&quot; class=&quot;divider&quot;&gt;&lt;/li&gt;
50            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Separated link&lt;/a&gt;&lt;/li&gt;
51         &lt;/ul&gt;
52      &lt;/div&gt;
53   &lt;/li&gt;
54&lt;/ul&gt;
55

ANSWER

Answered 2022-Apr-10 at 04:20

I think you need to go futher more with this. Because the one you need to go to is .dropdown-menu > li > a > li > ul which is in my opinion is too heavy. Try add this one to your code

1.dropdown-menu {
2     display: none;
3     position: absolute;
4     background-color: #00ff99;
5     min-width: 160px;
6     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
7     z-index: 1;
8}
9.dropdown-menu &gt; li &gt; a {
10     float: none;
11     color: black;
12     padding: 12px 16px;
13     text-decoration: none;
14     display: block;
15     text-align: left;
16}
17.navbar-toggle .dropdown-menu &gt; li &gt; a{
18     color: black;
19}
20
21&lt;div class=&quot;navbar navbar-inverse navbar-fixed-top&quot;&gt;
22&lt;div class=&quot;container&quot;&gt;
23&lt;div class=&quot;navbar-header&quot;&gt;
24   &lt;button type=&quot;button&quot; class=&quot;navbar-toggle&quot; data-toggle=&quot;collapse&quot; data-target=&quot;.navbar-collapse&quot;&gt;
25   &lt;span class=&quot;icon-bar&quot;&gt;&lt;/span&gt;
26   &lt;span class=&quot;icon-bar&quot;&gt;&lt;/span&gt;
27   &lt;span class=&quot;icon-bar&quot;&gt;&lt;/span&gt;
28   &lt;/button&gt;
29   @Html.ActionLink(&quot;E-HealthCare&quot;, &quot;About&quot;, &quot;Home&quot;, new { area = &quot;&quot; }, new { @class = &quot;navbar-brand shadow&quot; })
30&lt;/div&gt;
31&lt;div class=&quot;navbar-collapse collapse&quot;&gt;
32&lt;ul class=&quot;nav navbar-nav&quot;&gt;
33   &lt;li&gt;@Html.ActionLink(&quot;Home&quot;, &quot;About&quot;, &quot;Home&quot;)&lt;/li&gt;
34   @*
35   &lt;li&gt;@Html.ActionLink(&quot;About&quot;, &quot;About&quot;, &quot;Home&quot;)&lt;/li&gt;
36   &lt;li&gt;@Html.ActionLink(&quot;Contact&quot;, &quot;Contact&quot;, &quot;Home&quot;)&lt;/li&gt;
37   &lt;li&gt;@Html.DropDownList(&quot;Services&quot;,&quot;ALL&quot;)&lt;/li&gt;
38   *@
39   &lt;li&gt;
40      &lt;div class=&quot;dropdown&quot;&gt;
41         &lt;button class=&quot;Dropdown-btn btn-block text-left dropdown-toggle&quot; type=&quot;button&quot; id=&quot;dropdownMenu1&quot; data-toggle=&quot;dropdown&quot; aria-expanded=&quot;false&quot;&gt;
42         Services
43         &lt;span class=&quot;caret&quot;&gt;&lt;/span&gt;
44         &lt;/button&gt;
45         &lt;ul class=&quot;dropdown-menu&quot; aria-labelledby=&quot;dropdownMenu1&quot;&gt;
46            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Action&lt;/a&gt;&lt;/li&gt;
47            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Another action&lt;/a&gt;&lt;/li&gt;
48            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Something else here&lt;/a&gt;&lt;/li&gt;
49            &lt;li role=&quot;separator&quot; class=&quot;divider&quot;&gt;&lt;/li&gt;
50            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Separated link&lt;/a&gt;&lt;/li&gt;
51         &lt;/ul&gt;
52      &lt;/div&gt;
53   &lt;/li&gt;
54&lt;/ul&gt;
55#dropdown {
56    float: none;
57    color: black;
58    padding: 12px 16px;
59    text-decoration: none;
60    display: block;
61    text-align: left;
62}
63

Source https://stackoverflow.com/questions/71813692

QUESTION

Calculating numbers of week for a specific time period

Asked 2022-Mar-30 at 15:16

Hi I have this data frame which contains the start and end dates of healthcare services. It looks like this:

1id &lt;- c(&quot;A&quot;, &quot;B&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;)
2start_date &lt;- c(&quot;2014-08-18&quot;, &quot;2014-08-04&quot;, &quot;2016-10-10&quot;, &quot;2016-04-01&quot;, &quot;2015-12-31&quot;)
3end_date &lt;- c(&quot;2018-09-01&quot;, &quot;2019-09-22&quot;, &quot;2016-10-18&quot;, &quot;2016-05-01&quot;, &quot;2016-04-08&quot;)
4
5df &lt;- data.frame(id, start_date, end_date)
6
7  id    start_date     end_date
81  A    2014-08-18    2018-09-01
92  B    2014-08-04    2019-09-22
103  B    2016-10-10    2016-10-18
114  C    2016-04-01    2016-05-01
125  D    2015-12-31    2016-04-08
13

The IDs are not unique because people may had multiple services simultaneously. These services may spanned across many years. However, I would like to calculate numbers of weeks for each service within the financial year 2016, which starts at 2016-04-01 and ends at 2017-03-31. The data frame that I would like to have is:

1id &lt;- c(&quot;A&quot;, &quot;B&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;)
2start_date &lt;- c(&quot;2014-08-18&quot;, &quot;2014-08-04&quot;, &quot;2016-10-10&quot;, &quot;2016-04-01&quot;, &quot;2015-12-31&quot;)
3end_date &lt;- c(&quot;2018-09-01&quot;, &quot;2019-09-22&quot;, &quot;2016-10-18&quot;, &quot;2016-05-01&quot;, &quot;2016-04-08&quot;)
4
5df &lt;- data.frame(id, start_date, end_date)
6
7  id    start_date     end_date
81  A    2014-08-18    2018-09-01
92  B    2014-08-04    2019-09-22
103  B    2016-10-10    2016-10-18
114  C    2016-04-01    2016-05-01
125  D    2015-12-31    2016-04-08
13  id    start_date    end_date       wks_FY16
141  A    2014-08-18    2018-09-01        52
152  B    2014-08-04    2019-09-22        52
163  B    2016-10-10    2016-10-18         1
174  C    2016-04-01    2016-05-01         4
185  D    2015-12-31    2016-04-08         1
19

where "wks_FY16" represents financial year 2016.

I think difftime should be useful, but I don't know how to specify the period that I need. I will be really grateful for your help on this.

ANSWER

Answered 2022-Mar-30 at 15:16

We get the difference in 'weeks' using difftime after making corrections for the '2016' year

1id &lt;- c(&quot;A&quot;, &quot;B&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;)
2start_date &lt;- c(&quot;2014-08-18&quot;, &quot;2014-08-04&quot;, &quot;2016-10-10&quot;, &quot;2016-04-01&quot;, &quot;2015-12-31&quot;)
3end_date &lt;- c(&quot;2018-09-01&quot;, &quot;2019-09-22&quot;, &quot;2016-10-18&quot;, &quot;2016-05-01&quot;, &quot;2016-04-08&quot;)
4
5df &lt;- data.frame(id, start_date, end_date)
6
7  id    start_date     end_date
81  A    2014-08-18    2018-09-01
92  B    2014-08-04    2019-09-22
103  B    2016-10-10    2016-10-18
114  C    2016-04-01    2016-05-01
125  D    2015-12-31    2016-04-08
13  id    start_date    end_date       wks_FY16
141  A    2014-08-18    2018-09-01        52
152  B    2014-08-04    2019-09-22        52
163  B    2016-10-10    2016-10-18         1
174  C    2016-04-01    2016-05-01         4
185  D    2015-12-31    2016-04-08         1
19library(dplyr)
20df %&gt;% 
21   mutate(across(start_date:end_date, as.Date), 
22   wks_FY16 = as.integer(difftime(pmin(end_date, 
23    as.Date('2017-03-31')), pmax(as.Date('2016-04-01'),
24     start_date), units = &quot;weeks&quot;)))
25

Source https://stackoverflow.com/questions/71679460

QUESTION

Year and Text Parsing with Regex

Asked 2022-Mar-08 at 07:02

I am trying to extract the data in the format of either Apr 2022 - Present + (the text after until the next date) or Apr 1874 - Dec 1958 + (the text after until the next date) from a text for later processing with NLP.

Example:

Apr 2018 - Present lm Senior NurseWoodfield Hospital, Ipswich© Provided daily care for 6 elderly patients after major surgical procedures inan ICU unit by monitoring vital signs and administering medication© Collaborated with doctors to develop long-term care plans after hospitalstays.Supervised 4 Certified Nursing Assistants (CNAs) working in the unitFeb 2014 - Mar 2018 mm Registered NurseAshfield Care Home, Kent© Worked with the unit manager to take care of 36 frail and elderly patientswith complex health needs.© Responsible for administering medicine safely, in accordance with theNursing Midwifery Council guidelines.© Managed the unit's revenue and budget, including the allocation of funds forpatient care, equipment, and staff supplies.Nov 2043 - Jan 2014 lm Healthcare AssistantChase Care Home, Suffolk« Responsible for the safety and well-being of elderly people with dementiaand challenging behaviour.Worked with palliative care teams to help deliver end of life care to patients.

Expected result: ["Apr 2018 - Present lm Senior NurseWoodfield Hospital, Ipswich© Provided daily care for 6 elderly patients after major surgical procedures inan ICU unit by monitoring vital signs and administering medication© Collaborated with doctors to develop long-term care plans after hospitalstays.Supervised 4 Certified Nursing Assistants (CNAs) working in the unitFeb", "Feb 2014 - Mar 2018 mm Registered NurseAshfield Care Home, Kent© Worked with the unit manager to take care of 36 frail and elderly patientswith complex health needs.© Responsible for administering medicine safely, in accordance with theNursing Midwifery Council guidelines.© Managed the unit's revenue and budget, including the allocation of funds forpatient care, equipment, and staff supplies", "Nov 2043 - Jan 2014 lm Healthcare AssistantChase Care Home, Suffolk« Responsible for the safety and well-being of elderly people with dementiaand challenging behaviour.Worked with palliative care teams to help deliver end of life care to patients."]

This is the code I wrote. I am having troubles fixing it

1year_pattern = re.compile(r&quot;((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[.]?[\s-]\d{4}) - (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[.]?[\s-]\d{4} | (Present |present&quot;)
2
3year = ''.join(year_pattern.findall(text)).strip()
4

ANSWER

Answered 2022-Mar-08 at 01:44

Probably not the best looking solution but this worked for me:

1year_pattern = re.compile(r&quot;((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[.]?[\s-]\d{4}) - (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[.]?[\s-]\d{4} | (Present |present&quot;)
2
3year = ''.join(year_pattern.findall(text)).strip()
4pattern = &quot;(?=Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|present|Present [0-9]{4} -)&quot;
5splitted = re.split(pattern, text)
6print(splitted)
7result = []
8i = 0
9while i &lt; len(splitted):
10  result.append(splitted[i] + splitted[i + 1])
11  i += 2
12
13print(result)
14

Source https://stackoverflow.com/questions/71388767

QUESTION

How to get list of all objects associated with a foreign key in Django

Asked 2022-Feb-20 at 05:11

Not super experienced with Django so I apologize if this is trivial. Say I had a category instance and I wanted to get access to all of the content objects that I have previously added to my foreign key. How would I do so?

1class Organization(models.Model):
2    id = models.CharField(primary_key=True, max_length=200, default=uuid4, editable=False, unique=True)
3    name=models.CharField(max_length=200,unique=True)
4    phoneNumber=models.CharField(max_length=20)
5    logo=models.CharField(max_length=100000) # storing this as base 64 encoded
6    location=models.CharField(max_length=200)
7
8class Category(models.Model):
9    categoryName=models.CharField(max_length=300, unique=True, primary_key=True)
10    associatedOrganizations=models.ForeignKey(Organization,on_delete=models.CASCADE,related_name='associatedOrgs',null=True,blank=True)
11    associatedContent=models.ForeignKey(Content, on_delete=models.CASCADE,related_name='associatedContent',null=True,blank=True)
12    associatedMeetingNotices=models.ForeignKey(MeetingNotice,on_delete=models.CASCADE,related_name='associatedMeetingNotices',null=True,blank=True)
13

For example: say I had the following

1class Organization(models.Model):
2    id = models.CharField(primary_key=True, max_length=200, default=uuid4, editable=False, unique=True)
3    name=models.CharField(max_length=200,unique=True)
4    phoneNumber=models.CharField(max_length=20)
5    logo=models.CharField(max_length=100000) # storing this as base 64 encoded
6    location=models.CharField(max_length=200)
7
8class Category(models.Model):
9    categoryName=models.CharField(max_length=300, unique=True, primary_key=True)
10    associatedOrganizations=models.ForeignKey(Organization,on_delete=models.CASCADE,related_name='associatedOrgs',null=True,blank=True)
11    associatedContent=models.ForeignKey(Content, on_delete=models.CASCADE,related_name='associatedContent',null=True,blank=True)
12    associatedMeetingNotices=models.ForeignKey(MeetingNotice,on_delete=models.CASCADE,related_name='associatedMeetingNotices',null=True,blank=True)
13healthcareCategory=models.Category.objects.get(pk=&quot;healthcare&quot;)
14

and I wanted to access all Organizations related to healthcare, what should I do?

This?

1class Organization(models.Model):
2    id = models.CharField(primary_key=True, max_length=200, default=uuid4, editable=False, unique=True)
3    name=models.CharField(max_length=200,unique=True)
4    phoneNumber=models.CharField(max_length=20)
5    logo=models.CharField(max_length=100000) # storing this as base 64 encoded
6    location=models.CharField(max_length=200)
7
8class Category(models.Model):
9    categoryName=models.CharField(max_length=300, unique=True, primary_key=True)
10    associatedOrganizations=models.ForeignKey(Organization,on_delete=models.CASCADE,related_name='associatedOrgs',null=True,blank=True)
11    associatedContent=models.ForeignKey(Content, on_delete=models.CASCADE,related_name='associatedContent',null=True,blank=True)
12    associatedMeetingNotices=models.ForeignKey(MeetingNotice,on_delete=models.CASCADE,related_name='associatedMeetingNotices',null=True,blank=True)
13healthcareCategory=models.Category.objects.get(pk=&quot;healthcare&quot;)
14healthcareCategory.associatedOrganizations.all()
15

ANSWER

Answered 2022-Feb-20 at 03:31

You are close. You may want to change that related name from associatedOrgs to be associatedorgs to follow more closely to the django coding style. Documentation on this has a few examples.

1class Organization(models.Model):
2    id = models.CharField(primary_key=True, max_length=200, default=uuid4, editable=False, unique=True)
3    name=models.CharField(max_length=200,unique=True)
4    phoneNumber=models.CharField(max_length=20)
5    logo=models.CharField(max_length=100000) # storing this as base 64 encoded
6    location=models.CharField(max_length=200)
7
8class Category(models.Model):
9    categoryName=models.CharField(max_length=300, unique=True, primary_key=True)
10    associatedOrganizations=models.ForeignKey(Organization,on_delete=models.CASCADE,related_name='associatedOrgs',null=True,blank=True)
11    associatedContent=models.ForeignKey(Content, on_delete=models.CASCADE,related_name='associatedContent',null=True,blank=True)
12    associatedMeetingNotices=models.ForeignKey(MeetingNotice,on_delete=models.CASCADE,related_name='associatedMeetingNotices',null=True,blank=True)
13healthcareCategory=models.Category.objects.get(pk=&quot;healthcare&quot;)
14healthcareCategory.associatedOrganizations.all()
15healthcare_category = Category.objects.get(pk=&quot;healthcare&quot;)
16organizations = healthcare_category.associatedorgs.all()
17

Source https://stackoverflow.com/questions/71190986

QUESTION

Looping through elements with Selenium and ChromeDriver

Asked 2022-Feb-11 at 23:21

Im having trouble working through the following problem. Im trying to collect the data from the following webpage:https://localhelp.healthcare.gov/#/results?q=UTAH&lat=0&lng=0&city=&state=UT&zip_code=&mp=FFM

My method is to use the Selenium chrome driver to collect the data, for each healthcare agent, off this webpage, but dont know how I would loop through each record and add the data to each created list. So far, I can collect the data for a single record, but my problem is with my loop. How would I identify each record as an agent, and add that to my data frame for output? here is my code:

1from selenium import webdriver  # connect python with webbrowser-chrome
2import time
3import pandas as pd
4from selenium.webdriver.support.ui import WebDriverWait
5from selenium.webdriver.common.by import By
6from selenium.webdriver.support import expected_conditions as EC
7
8driver = webdriver.Chrome('C:/Users/picka/Documents/chromedriver.exe')
9driver.maximize_window()
10
11url = 'https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM'
12
13name = []
14phone = []
15email = []
16
17def go_to_network():
18    driver.get(url)
19
20    for agent in driver.find_elements_by_xpath('class.qa-flh-results-list'):
21        
22        get_name = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;))).text)
23        get_phone = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;))).text)
24        get_email = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;))).text)
25
26        name.append(get_name)
27        phone.append(get_phone)
28        email.append(get_email)
29
30
31go_to_network()
32
33
34record_output = {'Agent Name': name, 'Phone': phone, 'Email':  email}
35df = pd.DataFrame(record_output)
36df.to_csv(r'C:\Users\picka\Documents\Dev\Reports\Agent-data.csv', header=True, index=False)
37print(df)
38

ANSWER

Answered 2022-Feb-11 at 23:21

To extract and print all the Agent Name, Phone and Email using Selenium you can use List Comprehension inducing WebDriverWait for visibility_of_all_elements_located() and you can use either of the following Locator Strategies:

  • Code Block:

1from selenium import webdriver  # connect python with webbrowser-chrome
2import time
3import pandas as pd
4from selenium.webdriver.support.ui import WebDriverWait
5from selenium.webdriver.common.by import By
6from selenium.webdriver.support import expected_conditions as EC
7
8driver = webdriver.Chrome('C:/Users/picka/Documents/chromedriver.exe')
9driver.maximize_window()
10
11url = 'https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM'
12
13name = []
14phone = []
15email = []
16
17def go_to_network():
18    driver.get(url)
19
20    for agent in driver.find_elements_by_xpath('class.qa-flh-results-list'):
21        
22        get_name = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;))).text)
23        get_phone = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;))).text)
24        get_email = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;))).text)
25
26        name.append(get_name)
27        phone.append(get_phone)
28        email.append(get_email)
29
30
31go_to_network()
32
33
34record_output = {'Agent Name': name, 'Phone': phone, 'Email':  email}
35df = pd.DataFrame(record_output)
36df.to_csv(r'C:\Users\picka\Documents\Dev\Reports\Agent-data.csv', header=True, index=False)
37print(df)
38driver.get('https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM')
39get_name = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;)))]
40get_phone = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;)))]
41get_email = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;)))]
42for i,j,k in zip(get_name, get_phone, get_email):
43  print(f&quot;{i}'s' phone number is {j} and email is {k}&quot;)
44driver.quit()
45
  • Console Output:

  • 1from selenium import webdriver  # connect python with webbrowser-chrome
    2import time
    3import pandas as pd
    4from selenium.webdriver.support.ui import WebDriverWait
    5from selenium.webdriver.common.by import By
    6from selenium.webdriver.support import expected_conditions as EC
    7
    8driver = webdriver.Chrome('C:/Users/picka/Documents/chromedriver.exe')
    9driver.maximize_window()
    10
    11url = 'https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM'
    12
    13name = []
    14phone = []
    15email = []
    16
    17def go_to_network():
    18    driver.get(url)
    19
    20    for agent in driver.find_elements_by_xpath('class.qa-flh-results-list'):
    21        
    22        get_name = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;))).text)
    23        get_phone = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;))).text)
    24        get_email = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;))).text)
    25
    26        name.append(get_name)
    27        phone.append(get_phone)
    28        email.append(get_email)
    29
    30
    31go_to_network()
    32
    33
    34record_output = {'Agent Name': name, 'Phone': phone, 'Email':  email}
    35df = pd.DataFrame(record_output)
    36df.to_csv(r'C:\Users\picka\Documents\Dev\Reports\Agent-data.csv', header=True, index=False)
    37print(df)
    38driver.get('https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM')
    39get_name = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;)))]
    40get_phone = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;)))]
    41get_email = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;)))]
    42for i,j,k in zip(get_name, get_phone, get_email):
    43  print(f&quot;{i}'s' phone number is {j} and email is {k}&quot;)
    44driver.quit()
    45Wesley Elton's' phone number is (801) 404 - 2424 and email is wes@wallbrokers.com
    46Raquel Bell's' phone number is (801) 842 - 2870 and email is raquel.bell@enroll365.org
    47Brandon Berglund's' phone number is (801) 981 - 9414 and email is Brandon@BerglundIns.com
    48Steven Cochran's' phone number is (801) 800 - 8360 and email is steve.cochran@gbsbenefits.com
    49victoria dang's' phone number is (801) 462 - 5190 and email is victoriawfg@yahoo.com
    50Dan Jessop's' phone number is (435) 232 - 8833 and email is dejessop@hotmail.com
    51Billy Gerdts's' phone number is (801) 280 - 1162 and email is bgerdts@gginsurancegroup.com
    52Michael Saldana's' phone number is (801) 879 - 1032 and email is saldana.michael25@gmail.com
    53Brandon Johnson's' phone number is (435) 249 - 0725 and email is brandon@msiagency.com
    54Matthew Selph's' phone number is (801) 918 - 3945 and email is selph7@gmail.com
    55
  • Note : You have to add the following imports :

  • 1from selenium import webdriver  # connect python with webbrowser-chrome
    2import time
    3import pandas as pd
    4from selenium.webdriver.support.ui import WebDriverWait
    5from selenium.webdriver.common.by import By
    6from selenium.webdriver.support import expected_conditions as EC
    7
    8driver = webdriver.Chrome('C:/Users/picka/Documents/chromedriver.exe')
    9driver.maximize_window()
    10
    11url = 'https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM'
    12
    13name = []
    14phone = []
    15email = []
    16
    17def go_to_network():
    18    driver.get(url)
    19
    20    for agent in driver.find_elements_by_xpath('class.qa-flh-results-list'):
    21        
    22        get_name = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;))).text)
    23        get_phone = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;))).text)
    24        get_email = (WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;))).text)
    25
    26        name.append(get_name)
    27        phone.append(get_phone)
    28        email.append(get_email)
    29
    30
    31go_to_network()
    32
    33
    34record_output = {'Agent Name': name, 'Phone': phone, 'Email':  email}
    35df = pd.DataFrame(record_output)
    36df.to_csv(r'C:\Users\picka\Documents\Dev\Reports\Agent-data.csv', header=True, index=False)
    37print(df)
    38driver.get('https://localhelp.healthcare.gov/#/results?q=UTAH&amp;lat=0&amp;lng=0&amp;city=&amp;state=UT&amp;zip_code=&amp;mp=FFM')
    39get_name = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;span.qa-flh-resource-name&quot;)))]
    40get_phone = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;a.qa-flh-resource-phone&quot;)))]
    41get_email = [my_elem.text for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, &quot;a.ds-u-overflow--hidden.ds-u-truncate.ds-u-display--inline-block&quot;)))]
    42for i,j,k in zip(get_name, get_phone, get_email):
    43  print(f&quot;{i}'s' phone number is {j} and email is {k}&quot;)
    44driver.quit()
    45Wesley Elton's' phone number is (801) 404 - 2424 and email is wes@wallbrokers.com
    46Raquel Bell's' phone number is (801) 842 - 2870 and email is raquel.bell@enroll365.org
    47Brandon Berglund's' phone number is (801) 981 - 9414 and email is Brandon@BerglundIns.com
    48Steven Cochran's' phone number is (801) 800 - 8360 and email is steve.cochran@gbsbenefits.com
    49victoria dang's' phone number is (801) 462 - 5190 and email is victoriawfg@yahoo.com
    50Dan Jessop's' phone number is (435) 232 - 8833 and email is dejessop@hotmail.com
    51Billy Gerdts's' phone number is (801) 280 - 1162 and email is bgerdts@gginsurancegroup.com
    52Michael Saldana's' phone number is (801) 879 - 1032 and email is saldana.michael25@gmail.com
    53Brandon Johnson's' phone number is (435) 249 - 0725 and email is brandon@msiagency.com
    54Matthew Selph's' phone number is (801) 918 - 3945 and email is selph7@gmail.com
    55from selenium.webdriver.support.ui import WebDriverWait
    56from selenium.webdriver.common.by import By
    57from selenium.webdriver.support import expected_conditions as EC
    58

    Source https://stackoverflow.com/questions/71087480

    QUESTION

    MongoDB - Querying inner object that is an array

    Asked 2022-Feb-07 at 19:04

    I am new to MongoDB queries and looking for some guidance on how to retrieve documents that fit the search criteria. In particular, I need to find all the id(s) of the documents where the code is JPID i.e, "code": "JPID". We can assume the name of the collection is systems.

    Since this is a nested object I thought of using the $unwid - but I am still stuck on how to do it. The example is very trivial. Any help and guidance is appreciated.

    1{
    2      &quot;resourceType&quot;: &quot;NamingSystem&quot;,
    3      &quot;id&quot;: &quot;example-id&quot;,
    4      &quot;name&quot;: &quot;Austalian Healthcare Identifier - Individual&quot;,
    5      &quot;status&quot;: &quot;active&quot;,
    6      &quot;kind&quot;: &quot;identifier&quot;,
    7      &quot;date&quot;: &quot;2015-08-31&quot;,
    8      &quot;publisher&quot;: &quot;HL7 Australia on behalf of NEHTA&quot;,
    9      &quot;responsible&quot;: &quot;HI Service Operator / NEHTA&quot;,
    10      &quot;type&quot;: {
    11        &quot;coding&quot;: [
    12          {
    13            &quot;system&quot;: &quot;http://hl7.org/fhir/v2/0203&quot;,
    14            &quot;code&quot;: &quot;JPID&quot;;
    15            &quot;display&quot;: &quot;National unique individual identifier&quot;
    16          }
    17        ],
    18        &quot;text&quot;: &quot;IHI&quot;
    19      },
    20      &quot;description&quot;: &quot;Australian HI Identifier as established by relevant regulations etc&quot;,
    21      &quot;uniqueId&quot;: [
    22        {
    23          &quot;type&quot;: &quot;oid&quot;,
    24          &quot;value&quot;: &quot;1.2.36.1.2001.1003.0&quot;,
    25          &quot;comment&quot;: &quot;This value is used in Australian CDA documents&quot;
    26        },
    27        {
    28          &quot;type&quot;: &quot;uri&quot;,
    29          &quot;value&quot;: &quot;http://ns.electronichealth.net.au/id/hi/ihi/1.0&quot;,
    30          &quot;preferred&quot;: true,
    31          &quot;period&quot;: {
    32            &quot;start&quot;: &quot;2015-08-21&quot;
    33          }
    34        }
    35      ]
    36    }
    37

    ANSWER

    Answered 2022-Feb-07 at 19:04
    1. You can find all documents that contain at least one element in type.coding array by simple match the code element with the value JPID:

    1{
    2      &quot;resourceType&quot;: &quot;NamingSystem&quot;,
    3      &quot;id&quot;: &quot;example-id&quot;,
    4      &quot;name&quot;: &quot;Austalian Healthcare Identifier - Individual&quot;,
    5      &quot;status&quot;: &quot;active&quot;,
    6      &quot;kind&quot;: &quot;identifier&quot;,
    7      &quot;date&quot;: &quot;2015-08-31&quot;,
    8      &quot;publisher&quot;: &quot;HL7 Australia on behalf of NEHTA&quot;,
    9      &quot;responsible&quot;: &quot;HI Service Operator / NEHTA&quot;,
    10      &quot;type&quot;: {
    11        &quot;coding&quot;: [
    12          {
    13            &quot;system&quot;: &quot;http://hl7.org/fhir/v2/0203&quot;,
    14            &quot;code&quot;: &quot;JPID&quot;;
    15            &quot;display&quot;: &quot;National unique individual identifier&quot;
    16          }
    17        ],
    18        &quot;text&quot;: &quot;IHI&quot;
    19      },
    20      &quot;description&quot;: &quot;Australian HI Identifier as established by relevant regulations etc&quot;,
    21      &quot;uniqueId&quot;: [
    22        {
    23          &quot;type&quot;: &quot;oid&quot;,
    24          &quot;value&quot;: &quot;1.2.36.1.2001.1003.0&quot;,
    25          &quot;comment&quot;: &quot;This value is used in Australian CDA documents&quot;
    26        },
    27        {
    28          &quot;type&quot;: &quot;uri&quot;,
    29          &quot;value&quot;: &quot;http://ns.electronichealth.net.au/id/hi/ihi/1.0&quot;,
    30          &quot;preferred&quot;: true,
    31          &quot;period&quot;: {
    32            &quot;start&quot;: &quot;2015-08-21&quot;
    33          }
    34        }
    35      ]
    36    }
    37db.system.find({
    38 &quot;type.coding.code&quot;: &quot;JPID&quot;
    39})
    40

    It is recommended to create and index on {"type.coding.code":1} so your searches to perform faster on this field.

    playground

    1. If you need to find all documents and filter only the array entries having the code:"JPID" you can use $filter as follow:

    1{
    2      &quot;resourceType&quot;: &quot;NamingSystem&quot;,
    3      &quot;id&quot;: &quot;example-id&quot;,
    4      &quot;name&quot;: &quot;Austalian Healthcare Identifier - Individual&quot;,
    5      &quot;status&quot;: &quot;active&quot;,
    6      &quot;kind&quot;: &quot;identifier&quot;,
    7      &quot;date&quot;: &quot;2015-08-31&quot;,
    8      &quot;publisher&quot;: &quot;HL7 Australia on behalf of NEHTA&quot;,
    9      &quot;responsible&quot;: &quot;HI Service Operator / NEHTA&quot;,
    10      &quot;type&quot;: {
    11        &quot;coding&quot;: [
    12          {
    13            &quot;system&quot;: &quot;http://hl7.org/fhir/v2/0203&quot;,
    14            &quot;code&quot;: &quot;JPID&quot;;
    15            &quot;display&quot;: &quot;National unique individual identifier&quot;
    16          }
    17        ],
    18        &quot;text&quot;: &quot;IHI&quot;
    19      },
    20      &quot;description&quot;: &quot;Australian HI Identifier as established by relevant regulations etc&quot;,
    21      &quot;uniqueId&quot;: [
    22        {
    23          &quot;type&quot;: &quot;oid&quot;,
    24          &quot;value&quot;: &quot;1.2.36.1.2001.1003.0&quot;,
    25          &quot;comment&quot;: &quot;This value is used in Australian CDA documents&quot;
    26        },
    27        {
    28          &quot;type&quot;: &quot;uri&quot;,
    29          &quot;value&quot;: &quot;http://ns.electronichealth.net.au/id/hi/ihi/1.0&quot;,
    30          &quot;preferred&quot;: true,
    31          &quot;period&quot;: {
    32            &quot;start&quot;: &quot;2015-08-21&quot;
    33          }
    34        }
    35      ]
    36    }
    37db.system.find({
    38 &quot;type.coding.code&quot;: &quot;JPID&quot;
    39})
    40db.system.aggregate([
    41{
    42 $match: {
    43   &quot;type.coding.code&quot;: &quot;JPID&quot;
    44 }
    45},
    46{
    47 $addFields: {
    48   &quot;type.coding&quot;: {
    49     &quot;$filter&quot;: {
    50      &quot;input&quot;: &quot;$type.coding&quot;,
    51      &quot;as&quot;: &quot;tc&quot;,
    52      &quot;cond&quot;: {
    53        $eq: [
    54          &quot;$$tc.code&quot;,
    55          &quot;JPID&quot;
    56          ]
    57       }
    58     }
    59   }
    60 }
    61}
    62])
    63

    Source https://stackoverflow.com/questions/71022805

    QUESTION

    Dockerize Flask: Error: While importing 'app', an ImportError was raised

    Asked 2022-Jan-10 at 17:09

    I am trying to dockerize my Flask API. As soon as I try to start my image I receive the message:

    1* Environment: production
    2WARNING: This is a development server. Do not use it in a production deployment.
    3Use a production WSGI server instead.
    4* Debug mode: off
    5Usage: python -m flask run [OPTIONS]
    6Try 'python -m flask run --help' for help.
    7
    8Error: While importing 'app', an ImportError was raised.
    9

    If I am starting the Flask App with my terminal python -m flask run everything works like intended. And right now I am stuck on this problem.

    Here is my Code:

    1* Environment: production
    2WARNING: This is a development server. Do not use it in a production deployment.
    3Use a production WSGI server instead.
    4* Debug mode: off
    5Usage: python -m flask run [OPTIONS]
    6Try 'python -m flask run --help' for help.
    7
    8Error: While importing 'app', an ImportError was raised.
    9from flask import Flask
    10from bson import json_util
    11from flask_pymongo import PyMongo
    12from flask_cors import CORS
    13import json
    14
    15app = Flask(__name__)
    16app.config[&quot;MONGO_URI&quot;] = &quot;mongodb://194.163.147.192:27017/test&quot;
    17CORS(app)
    18mongo = PyMongo(app)
    19
    20
    21def parse_json(data):
    22    return json.loads(json_util.dumps(data))
    23
    24
    25@app.route('/')
    26def home():
    27    return 'Hello'
    28
    29
    30@app.route('/residential', methods=['GET'])
    31def find_residential():  # put application's code here
    32    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Residential&quot;})
    33    response = Flask.jsonify(parse_json(test))
    34    response.headers.add('Access-Control-Allow-Origin', '*')
    35    return response
    36
    37
    38@app.route('/commercial', methods=['GET'])
    39def find_commercial():  # put application's code here
    40    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Commercial&quot;})
    41    response = Flask.jsonify(parse_json(test))
    42    response.headers.add('Access-Control-Allow-Origin', '*')
    43    return response
    44
    45
    46@app.route('/healthcare', methods=['GET'])
    47def find_health_care():  # put application's code here
    48    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Health Care&quot;})
    49    response = Flask.jsonify(parse_json(test))
    50    response.headers.add('Access-Control-Allow-Origin', '*')
    51    return response
    52
    53
    54@app.route('/germany', methods=['GET'])
    55def find_germany():
    56    test = mongo.db.germanies.find_one()
    57    response = Flask.jsonify(parse_json(test))
    58    response.headers.add('Access-Control-Allow-Origin', '*')
    59    return response
    60
    61
    62if __name__ == '__main__':
    63    app.debug = False
    64    app.run()
    65

    My requirements.txt looks like this

    1* Environment: production
    2WARNING: This is a development server. Do not use it in a production deployment.
    3Use a production WSGI server instead.
    4* Debug mode: off
    5Usage: python -m flask run [OPTIONS]
    6Try 'python -m flask run --help' for help.
    7
    8Error: While importing 'app', an ImportError was raised.
    9from flask import Flask
    10from bson import json_util
    11from flask_pymongo import PyMongo
    12from flask_cors import CORS
    13import json
    14
    15app = Flask(__name__)
    16app.config[&quot;MONGO_URI&quot;] = &quot;mongodb://194.163.147.192:27017/test&quot;
    17CORS(app)
    18mongo = PyMongo(app)
    19
    20
    21def parse_json(data):
    22    return json.loads(json_util.dumps(data))
    23
    24
    25@app.route('/')
    26def home():
    27    return 'Hello'
    28
    29
    30@app.route('/residential', methods=['GET'])
    31def find_residential():  # put application's code here
    32    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Residential&quot;})
    33    response = Flask.jsonify(parse_json(test))
    34    response.headers.add('Access-Control-Allow-Origin', '*')
    35    return response
    36
    37
    38@app.route('/commercial', methods=['GET'])
    39def find_commercial():  # put application's code here
    40    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Commercial&quot;})
    41    response = Flask.jsonify(parse_json(test))
    42    response.headers.add('Access-Control-Allow-Origin', '*')
    43    return response
    44
    45
    46@app.route('/healthcare', methods=['GET'])
    47def find_health_care():  # put application's code here
    48    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Health Care&quot;})
    49    response = Flask.jsonify(parse_json(test))
    50    response.headers.add('Access-Control-Allow-Origin', '*')
    51    return response
    52
    53
    54@app.route('/germany', methods=['GET'])
    55def find_germany():
    56    test = mongo.db.germanies.find_one()
    57    response = Flask.jsonify(parse_json(test))
    58    response.headers.add('Access-Control-Allow-Origin', '*')
    59    return response
    60
    61
    62if __name__ == '__main__':
    63    app.debug = False
    64    app.run()
    65bson==0.5.10
    66click==8.0.3
    67colorama==0.4.4
    68Flask==2.0.2
    69Flask-Cors==3.0.10
    70Flask-PyMongo==2.3.0
    71itsdangerous==2.0.1
    72Jinja2==3.0.2
    73MarkupSafe==2.0.1
    74pymongo==3.12.1
    75python-dateutil==2.8.2
    76six==1.16.0
    77Werkzeug==2.0.2
    78

    My Dockerfile looks like this

    1* Environment: production
    2WARNING: This is a development server. Do not use it in a production deployment.
    3Use a production WSGI server instead.
    4* Debug mode: off
    5Usage: python -m flask run [OPTIONS]
    6Try 'python -m flask run --help' for help.
    7
    8Error: While importing 'app', an ImportError was raised.
    9from flask import Flask
    10from bson import json_util
    11from flask_pymongo import PyMongo
    12from flask_cors import CORS
    13import json
    14
    15app = Flask(__name__)
    16app.config[&quot;MONGO_URI&quot;] = &quot;mongodb://194.163.147.192:27017/test&quot;
    17CORS(app)
    18mongo = PyMongo(app)
    19
    20
    21def parse_json(data):
    22    return json.loads(json_util.dumps(data))
    23
    24
    25@app.route('/')
    26def home():
    27    return 'Hello'
    28
    29
    30@app.route('/residential', methods=['GET'])
    31def find_residential():  # put application's code here
    32    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Residential&quot;})
    33    response = Flask.jsonify(parse_json(test))
    34    response.headers.add('Access-Control-Allow-Origin', '*')
    35    return response
    36
    37
    38@app.route('/commercial', methods=['GET'])
    39def find_commercial():  # put application's code here
    40    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Commercial&quot;})
    41    response = Flask.jsonify(parse_json(test))
    42    response.headers.add('Access-Control-Allow-Origin', '*')
    43    return response
    44
    45
    46@app.route('/healthcare', methods=['GET'])
    47def find_health_care():  # put application's code here
    48    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Health Care&quot;})
    49    response = Flask.jsonify(parse_json(test))
    50    response.headers.add('Access-Control-Allow-Origin', '*')
    51    return response
    52
    53
    54@app.route('/germany', methods=['GET'])
    55def find_germany():
    56    test = mongo.db.germanies.find_one()
    57    response = Flask.jsonify(parse_json(test))
    58    response.headers.add('Access-Control-Allow-Origin', '*')
    59    return response
    60
    61
    62if __name__ == '__main__':
    63    app.debug = False
    64    app.run()
    65bson==0.5.10
    66click==8.0.3
    67colorama==0.4.4
    68Flask==2.0.2
    69Flask-Cors==3.0.10
    70Flask-PyMongo==2.3.0
    71itsdangerous==2.0.1
    72Jinja2==3.0.2
    73MarkupSafe==2.0.1
    74pymongo==3.12.1
    75python-dateutil==2.8.2
    76six==1.16.0
    77Werkzeug==2.0.2
    78FROM python:3.8-slim-buster
    79WORKDIR /api
    80COPY requirements.txt requirements.txt
    81RUN pip3 install -r requirements.txt
    82COPY . .
    83CMD [ &quot;python3&quot;, &quot;-m&quot; , &quot;flask&quot;, &quot;run&quot;, &quot;--host=0.0.0.0&quot;]
    84

    I am thankful for any help :)

    Project structure is like:

    1* Environment: production
    2WARNING: This is a development server. Do not use it in a production deployment.
    3Use a production WSGI server instead.
    4* Debug mode: off
    5Usage: python -m flask run [OPTIONS]
    6Try 'python -m flask run --help' for help.
    7
    8Error: While importing 'app', an ImportError was raised.
    9from flask import Flask
    10from bson import json_util
    11from flask_pymongo import PyMongo
    12from flask_cors import CORS
    13import json
    14
    15app = Flask(__name__)
    16app.config[&quot;MONGO_URI&quot;] = &quot;mongodb://194.163.147.192:27017/test&quot;
    17CORS(app)
    18mongo = PyMongo(app)
    19
    20
    21def parse_json(data):
    22    return json.loads(json_util.dumps(data))
    23
    24
    25@app.route('/')
    26def home():
    27    return 'Hello'
    28
    29
    30@app.route('/residential', methods=['GET'])
    31def find_residential():  # put application's code here
    32    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Residential&quot;})
    33    response = Flask.jsonify(parse_json(test))
    34    response.headers.add('Access-Control-Allow-Origin', '*')
    35    return response
    36
    37
    38@app.route('/commercial', methods=['GET'])
    39def find_commercial():  # put application's code here
    40    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Commercial&quot;})
    41    response = Flask.jsonify(parse_json(test))
    42    response.headers.add('Access-Control-Allow-Origin', '*')
    43    return response
    44
    45
    46@app.route('/healthcare', methods=['GET'])
    47def find_health_care():  # put application's code here
    48    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Health Care&quot;})
    49    response = Flask.jsonify(parse_json(test))
    50    response.headers.add('Access-Control-Allow-Origin', '*')
    51    return response
    52
    53
    54@app.route('/germany', methods=['GET'])
    55def find_germany():
    56    test = mongo.db.germanies.find_one()
    57    response = Flask.jsonify(parse_json(test))
    58    response.headers.add('Access-Control-Allow-Origin', '*')
    59    return response
    60
    61
    62if __name__ == '__main__':
    63    app.debug = False
    64    app.run()
    65bson==0.5.10
    66click==8.0.3
    67colorama==0.4.4
    68Flask==2.0.2
    69Flask-Cors==3.0.10
    70Flask-PyMongo==2.3.0
    71itsdangerous==2.0.1
    72Jinja2==3.0.2
    73MarkupSafe==2.0.1
    74pymongo==3.12.1
    75python-dateutil==2.8.2
    76six==1.16.0
    77Werkzeug==2.0.2
    78FROM python:3.8-slim-buster
    79WORKDIR /api
    80COPY requirements.txt requirements.txt
    81RUN pip3 install -r requirements.txt
    82COPY . .
    83CMD [ &quot;python3&quot;, &quot;-m&quot; , &quot;flask&quot;, &quot;run&quot;, &quot;--host=0.0.0.0&quot;]
    84API
    85L venv
    86L app.py
    87L Dockerfile
    88L requirements.txt
    89

    ANSWER

    Answered 2021-Nov-02 at 20:53

    Your issue is, I think, with your requirements file. In that you include bson as a dependency, which is also included in the pymongo library. See this question. Removing it seems to solve the issue:

    1* Environment: production
    2WARNING: This is a development server. Do not use it in a production deployment.
    3Use a production WSGI server instead.
    4* Debug mode: off
    5Usage: python -m flask run [OPTIONS]
    6Try 'python -m flask run --help' for help.
    7
    8Error: While importing 'app', an ImportError was raised.
    9from flask import Flask
    10from bson import json_util
    11from flask_pymongo import PyMongo
    12from flask_cors import CORS
    13import json
    14
    15app = Flask(__name__)
    16app.config[&quot;MONGO_URI&quot;] = &quot;mongodb://194.163.147.192:27017/test&quot;
    17CORS(app)
    18mongo = PyMongo(app)
    19
    20
    21def parse_json(data):
    22    return json.loads(json_util.dumps(data))
    23
    24
    25@app.route('/')
    26def home():
    27    return 'Hello'
    28
    29
    30@app.route('/residential', methods=['GET'])
    31def find_residential():  # put application's code here
    32    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Residential&quot;})
    33    response = Flask.jsonify(parse_json(test))
    34    response.headers.add('Access-Control-Allow-Origin', '*')
    35    return response
    36
    37
    38@app.route('/commercial', methods=['GET'])
    39def find_commercial():  # put application's code here
    40    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Commercial&quot;})
    41    response = Flask.jsonify(parse_json(test))
    42    response.headers.add('Access-Control-Allow-Origin', '*')
    43    return response
    44
    45
    46@app.route('/healthcare', methods=['GET'])
    47def find_health_care():  # put application's code here
    48    test = mongo.db.acs.find_one({&quot;name&quot;: &quot;Health Care&quot;})
    49    response = Flask.jsonify(parse_json(test))
    50    response.headers.add('Access-Control-Allow-Origin', '*')
    51    return response
    52
    53
    54@app.route('/germany', methods=['GET'])
    55def find_germany():
    56    test = mongo.db.germanies.find_one()
    57    response = Flask.jsonify(parse_json(test))
    58    response.headers.add('Access-Control-Allow-Origin', '*')
    59    return response
    60
    61
    62if __name__ == '__main__':
    63    app.debug = False
    64    app.run()
    65bson==0.5.10
    66click==8.0.3
    67colorama==0.4.4
    68Flask==2.0.2
    69Flask-Cors==3.0.10
    70Flask-PyMongo==2.3.0
    71itsdangerous==2.0.1
    72Jinja2==3.0.2
    73MarkupSafe==2.0.1
    74pymongo==3.12.1
    75python-dateutil==2.8.2
    76six==1.16.0
    77Werkzeug==2.0.2
    78FROM python:3.8-slim-buster
    79WORKDIR /api
    80COPY requirements.txt requirements.txt
    81RUN pip3 install -r requirements.txt
    82COPY . .
    83CMD [ &quot;python3&quot;, &quot;-m&quot; , &quot;flask&quot;, &quot;run&quot;, &quot;--host=0.0.0.0&quot;]
    84API
    85L venv
    86L app.py
    87L Dockerfile
    88L requirements.txt
    89 ~/tmp/so_q $ docker build -t myimage .                                                             8s nathanielford@nford 20:51:04
    90Sending build context to Docker daemon   5.12kB
    91
    92...
    93
    94Successfully tagged myimage:latest
    95 ~/tmp/so_q $ docker run myimage                                                                   13s nathanielford@nford 20:51:26
    96 * Environment: production
    97   WARNING: This is a development server. Do not use it in a production deployment.
    98   Use a production WSGI server instead.
    99 * Debug mode: off
    100 * Running on all addresses.
    101   WARNING: This is a development server. Do not use it in a production deployment.
    102 * Running on http://192.168.9.2:5000/ (Press CTRL+C to quit)
    103

    Source https://stackoverflow.com/questions/69815313

    QUESTION

    search unique element pairs and transform sorted result to JSON

    Asked 2022-Jan-06 at 01:12

    I have below sample input: (They are individual documents)

    1    &lt;performance&gt;
    2        &lt;year&gt;2016&lt;/year&gt;
    3        &lt;industry&gt;Financials&lt;/industry&gt;
    4        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    5&lt;/performance&gt;
    6 
    7    &lt;performance&gt;
    8        &lt;year&gt;2017&lt;/year&gt;
    9        &lt;industry&gt;Technology&lt;/industry&gt;
    10        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    11&lt;/performance&gt;
    12 
    13    &lt;performance&gt;
    14        &lt;year&gt;2018&lt;/year&gt;
    15        &lt;industry&gt;Technology&lt;/industry&gt;
    16        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    17&lt;/performance&gt;
    18 
    19    &lt;performance&gt;
    20        &lt;year&gt;2019&lt;/year&gt;
    21        &lt;industry&gt;Financials&lt;/industry&gt;
    22        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    23&lt;/performance&gt;
    24 
    25    &lt;performance&gt;
    26        &lt;year&gt;2020&lt;/year&gt;
    27        &lt;industry&gt;Technology&lt;/industry&gt;
    28        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    29&lt;/performance&gt;
    30 
    31    &lt;performance&gt;
    32        &lt;year&gt;2021&lt;/year&gt; 
    33        &lt;industry&gt;Technology&lt;/industry&gt;
    34        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    35  &lt;/performance&gt;
    36

    I need to find the industry and benchmark pairs, sort the result document on year, and finally transform the pairs to JSON. I would like to use Marklogic’s index to speed up search and transform. The expected output is:

    1    &lt;performance&gt;
    2        &lt;year&gt;2016&lt;/year&gt;
    3        &lt;industry&gt;Financials&lt;/industry&gt;
    4        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    5&lt;/performance&gt;
    6 
    7    &lt;performance&gt;
    8        &lt;year&gt;2017&lt;/year&gt;
    9        &lt;industry&gt;Technology&lt;/industry&gt;
    10        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    11&lt;/performance&gt;
    12 
    13    &lt;performance&gt;
    14        &lt;year&gt;2018&lt;/year&gt;
    15        &lt;industry&gt;Technology&lt;/industry&gt;
    16        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    17&lt;/performance&gt;
    18 
    19    &lt;performance&gt;
    20        &lt;year&gt;2019&lt;/year&gt;
    21        &lt;industry&gt;Financials&lt;/industry&gt;
    22        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    23&lt;/performance&gt;
    24 
    25    &lt;performance&gt;
    26        &lt;year&gt;2020&lt;/year&gt;
    27        &lt;industry&gt;Technology&lt;/industry&gt;
    28        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    29&lt;/performance&gt;
    30 
    31    &lt;performance&gt;
    32        &lt;year&gt;2021&lt;/year&gt; 
    33        &lt;industry&gt;Technology&lt;/industry&gt;
    34        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    35  &lt;/performance&gt;
    36  {
    37    &quot;Financials&quot;: [
    38&quot;Materials&quot;, 
    39&quot;Healthcare&quot;
    40    ], 
    41    &quot;Technology&quot;: [
    42&quot;Healthcare&quot;, 
    43&quot;Materials&quot;, 
    44&quot;Financials&quot;
    45    ]
    46 }
    47

    My Xquery code:

    1    &lt;performance&gt;
    2        &lt;year&gt;2016&lt;/year&gt;
    3        &lt;industry&gt;Financials&lt;/industry&gt;
    4        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    5&lt;/performance&gt;
    6 
    7    &lt;performance&gt;
    8        &lt;year&gt;2017&lt;/year&gt;
    9        &lt;industry&gt;Technology&lt;/industry&gt;
    10        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    11&lt;/performance&gt;
    12 
    13    &lt;performance&gt;
    14        &lt;year&gt;2018&lt;/year&gt;
    15        &lt;industry&gt;Technology&lt;/industry&gt;
    16        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    17&lt;/performance&gt;
    18 
    19    &lt;performance&gt;
    20        &lt;year&gt;2019&lt;/year&gt;
    21        &lt;industry&gt;Financials&lt;/industry&gt;
    22        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    23&lt;/performance&gt;
    24 
    25    &lt;performance&gt;
    26        &lt;year&gt;2020&lt;/year&gt;
    27        &lt;industry&gt;Technology&lt;/industry&gt;
    28        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    29&lt;/performance&gt;
    30 
    31    &lt;performance&gt;
    32        &lt;year&gt;2021&lt;/year&gt; 
    33        &lt;industry&gt;Technology&lt;/industry&gt;
    34        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    35  &lt;/performance&gt;
    36  {
    37    &quot;Financials&quot;: [
    38&quot;Materials&quot;, 
    39&quot;Healthcare&quot;
    40    ], 
    41    &quot;Technology&quot;: [
    42&quot;Healthcare&quot;, 
    43&quot;Materials&quot;, 
    44&quot;Financials&quot;
    45    ]
    46 }
    47let $keys := ('Financials', 'Technology')
    48let $map := map:map()
    49let $_ :=
    50  for $key in $keys
    51  let $query :=  cts:path-range-query(&quot;/performance/industry&quot;, &quot;=&quot;, $key)
    52  let $v :=  cts:values(cts:path-reference('/performance/benchmark'), (), (), $query)
    53  return map:put($map, $key, $v)
    54return xdmp:to-json($map)
    55

    Unexpected output:

    1    &lt;performance&gt;
    2        &lt;year&gt;2016&lt;/year&gt;
    3        &lt;industry&gt;Financials&lt;/industry&gt;
    4        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    5&lt;/performance&gt;
    6 
    7    &lt;performance&gt;
    8        &lt;year&gt;2017&lt;/year&gt;
    9        &lt;industry&gt;Technology&lt;/industry&gt;
    10        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    11&lt;/performance&gt;
    12 
    13    &lt;performance&gt;
    14        &lt;year&gt;2018&lt;/year&gt;
    15        &lt;industry&gt;Technology&lt;/industry&gt;
    16        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    17&lt;/performance&gt;
    18 
    19    &lt;performance&gt;
    20        &lt;year&gt;2019&lt;/year&gt;
    21        &lt;industry&gt;Financials&lt;/industry&gt;
    22        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    23&lt;/performance&gt;
    24 
    25    &lt;performance&gt;
    26        &lt;year&gt;2020&lt;/year&gt;
    27        &lt;industry&gt;Technology&lt;/industry&gt;
    28        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    29&lt;/performance&gt;
    30 
    31    &lt;performance&gt;
    32        &lt;year&gt;2021&lt;/year&gt; 
    33        &lt;industry&gt;Technology&lt;/industry&gt;
    34        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    35  &lt;/performance&gt;
    36  {
    37    &quot;Financials&quot;: [
    38&quot;Materials&quot;, 
    39&quot;Healthcare&quot;
    40    ], 
    41    &quot;Technology&quot;: [
    42&quot;Healthcare&quot;, 
    43&quot;Materials&quot;, 
    44&quot;Financials&quot;
    45    ]
    46 }
    47let $keys := ('Financials', 'Technology')
    48let $map := map:map()
    49let $_ :=
    50  for $key in $keys
    51  let $query :=  cts:path-range-query(&quot;/performance/industry&quot;, &quot;=&quot;, $key)
    52  let $v :=  cts:values(cts:path-reference('/performance/benchmark'), (), (), $query)
    53  return map:put($map, $key, $v)
    54return xdmp:to-json($map)
    55{
    56&quot;Financials&quot;:[
    57  &quot;Healthcare&quot;, 
    58  &quot;Materials&quot;
    59], 
    60&quot;Technology&quot;:[
    61  &quot;Financials&quot;, 
    62  &quot;Healthcare&quot;, 
    63  &quot;Materials&quot;
    64]
    65}
    66

    Do I use Xquery in the wrong way or misunderstand how the Marklogic index works? How can I get the correct output? I am fine with Javascript or Xquery.

    ANSWER

    Answered 2021-Dec-18 at 22:29

    It seems that when you put a sequence of values in the map, they wind up being sorted.

    With this solution, I fetch all of the benchmark and year for each industry, sort the values in descending order by year, dedup with distinct-values() and then put them into an array-object() in order to maintain the sorted order.

    1    &lt;performance&gt;
    2        &lt;year&gt;2016&lt;/year&gt;
    3        &lt;industry&gt;Financials&lt;/industry&gt;
    4        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    5&lt;/performance&gt;
    6 
    7    &lt;performance&gt;
    8        &lt;year&gt;2017&lt;/year&gt;
    9        &lt;industry&gt;Technology&lt;/industry&gt;
    10        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    11&lt;/performance&gt;
    12 
    13    &lt;performance&gt;
    14        &lt;year&gt;2018&lt;/year&gt;
    15        &lt;industry&gt;Technology&lt;/industry&gt;
    16        &lt;benchmark&gt;Financials&lt;/benchmark&gt;
    17&lt;/performance&gt;
    18 
    19    &lt;performance&gt;
    20        &lt;year&gt;2019&lt;/year&gt;
    21        &lt;industry&gt;Financials&lt;/industry&gt;
    22        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    23&lt;/performance&gt;
    24 
    25    &lt;performance&gt;
    26        &lt;year&gt;2020&lt;/year&gt;
    27        &lt;industry&gt;Technology&lt;/industry&gt;
    28        &lt;benchmark&gt;Materials&lt;/benchmark&gt;
    29&lt;/performance&gt;
    30 
    31    &lt;performance&gt;
    32        &lt;year&gt;2021&lt;/year&gt; 
    33        &lt;industry&gt;Technology&lt;/industry&gt;
    34        &lt;benchmark&gt;Healthcare&lt;/benchmark&gt;
    35  &lt;/performance&gt;
    36  {
    37    &quot;Financials&quot;: [
    38&quot;Materials&quot;, 
    39&quot;Healthcare&quot;
    40    ], 
    41    &quot;Technology&quot;: [
    42&quot;Healthcare&quot;, 
    43&quot;Materials&quot;, 
    44&quot;Financials&quot;
    45    ]
    46 }
    47let $keys := ('Financials', 'Technology')
    48let $map := map:map()
    49let $_ :=
    50  for $key in $keys
    51  let $query :=  cts:path-range-query(&quot;/performance/industry&quot;, &quot;=&quot;, $key)
    52  let $v :=  cts:values(cts:path-reference('/performance/benchmark'), (), (), $query)
    53  return map:put($map, $key, $v)
    54return xdmp:to-json($map)
    55{
    56&quot;Financials&quot;:[
    57  &quot;Healthcare&quot;, 
    58  &quot;Materials&quot;
    59], 
    60&quot;Technology&quot;:[
    61  &quot;Financials&quot;, 
    62  &quot;Healthcare&quot;, 
    63  &quot;Materials&quot;
    64]
    65}
    66let $map := map:map()
    67let $industries := ('Financials', 'Technology')
    68let $_ :=
    69  for $industry in $industries
    70  let $query :=  cts:path-range-query(&quot;/performance/industry&quot;, &quot;=&quot;, $industry)
    71  let $tuples := cts:value-tuples((cts:path-reference('/performance/benchmark'), cts:path-reference('/performance/year')), (), $query)
    72  let $sorted-values :=
    73    for $tuple in $tuples
    74    let $benchmark := $tuple[1]
    75    let $year := $tuple[2]
    76    order by $year descending
    77    return $benchmark
    78  return map:put($map, $industry, array-node{ distinct-values($sorted-values) })
    79return xdmp:to-json($map)
    80

    Source https://stackoverflow.com/questions/70406563

    QUESTION

    Clean trailing period if present as last non whitespace of dataframe column

    Asked 2021-Dec-23 at 08:18

    Here's a sample of the data I'm working on(first line are the column names):

    1DENOMINAZIONE;ATC;PRINCIPIO ATTIVO;TITOLARE;AIC    
    2ABASAGLAR;A10AE04;INSULINA GLARGINE;ELI LILLY NEDERLAND B.V.;043658
    3ABASRIA;A10AE04;INSULIN GLARGINE;ELI LILLY REGIONAL OPERATIONS GMBH.;043658
    4 ABECMA;L01;IDECABTAGENE VICLEUCEL;CELGENE EUROPE BV;049604
    5ABEVMY;L01XC07;BEVACIZUMAB;MYLAN IRE HEALTHCARE LTD ;049452
    6ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD. ;043143
    7ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD;043143
    8

    and I need to eliminate the last '.' so that for example the last two lines become identical. I also need to take into account that sometimes there are leading or trailing whitespaces, possibly more than one.

    The CSV file is read into a Pandas.DataFrame comp_df on which I tried the following line:

    1DENOMINAZIONE;ATC;PRINCIPIO ATTIVO;TITOLARE;AIC    
    2ABASAGLAR;A10AE04;INSULINA GLARGINE;ELI LILLY NEDERLAND B.V.;043658
    3ABASRIA;A10AE04;INSULIN GLARGINE;ELI LILLY REGIONAL OPERATIONS GMBH.;043658
    4 ABECMA;L01;IDECABTAGENE VICLEUCEL;CELGENE EUROPE BV;049604
    5ABEVMY;L01XC07;BEVACIZUMAB;MYLAN IRE HEALTHCARE LTD ;049452
    6ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD. ;043143
    7ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD;043143
    8comp_df.TITOLARE.str.replace(r&quot;.+\.\s*$&quot;, &quot;&quot;, regex=True)
    9

    which does its job of matching one or more non whitespace chars followed by a literal period followed by zero or more spaces until the end of line is reached.

    My objective is to lessen the variability of the strings in the TITOLARE series.

    The problem is that the lines that match are correctly substituted but the non matching lines are returned as empty.

    How do I fix this?

    ANSWER

    Answered 2021-Dec-23 at 08:18

    I can not reproduce why the non matching lines are returned as empty, but if you load the example data as csv, set the separator to ; and only match the dot at the end of the string using between optional whitespace chars using \s*\.\s*$ you will get the desired replacement leaving unmatched lines untouched.

    Example

    1DENOMINAZIONE;ATC;PRINCIPIO ATTIVO;TITOLARE;AIC    
    2ABASAGLAR;A10AE04;INSULINA GLARGINE;ELI LILLY NEDERLAND B.V.;043658
    3ABASRIA;A10AE04;INSULIN GLARGINE;ELI LILLY REGIONAL OPERATIONS GMBH.;043658
    4 ABECMA;L01;IDECABTAGENE VICLEUCEL;CELGENE EUROPE BV;049604
    5ABEVMY;L01XC07;BEVACIZUMAB;MYLAN IRE HEALTHCARE LTD ;049452
    6ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD. ;043143
    7ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD;043143
    8comp_df.TITOLARE.str.replace(r&quot;.+\.\s*$&quot;, &quot;&quot;, regex=True)
    9import pandas as pd
    10
    11comp_df = pd.read_csv(&quot;file.csv&quot;, sep=&quot;;&quot;)
    12comp_df.TITOLARE = comp_df.TITOLARE.str.replace(r&quot;\s*\.\s*$&quot;, &quot;&quot;)
    13
    14print(comp_df)
    15

    Output

    1DENOMINAZIONE;ATC;PRINCIPIO ATTIVO;TITOLARE;AIC    
    2ABASAGLAR;A10AE04;INSULINA GLARGINE;ELI LILLY NEDERLAND B.V.;043658
    3ABASRIA;A10AE04;INSULIN GLARGINE;ELI LILLY REGIONAL OPERATIONS GMBH.;043658
    4 ABECMA;L01;IDECABTAGENE VICLEUCEL;CELGENE EUROPE BV;049604
    5ABEVMY;L01XC07;BEVACIZUMAB;MYLAN IRE HEALTHCARE LTD ;049452
    6ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD. ;043143
    7ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD;043143
    8comp_df.TITOLARE.str.replace(r&quot;.+\.\s*$&quot;, &quot;&quot;, regex=True)
    9import pandas as pd
    10
    11comp_df = pd.read_csv(&quot;file.csv&quot;, sep=&quot;;&quot;)
    12comp_df.TITOLARE = comp_df.TITOLARE.str.replace(r&quot;\s*\.\s*$&quot;, &quot;&quot;)
    13
    14print(comp_df)
    15      DENOMINAZIONE      ATC        PRINCIPIO ATTIVO                            TITOLARE  AIC    
    160         ABASAGLAR  A10AE04       INSULINA GLARGINE             ELI LILLY NEDERLAND B.V    43658
    171           ABASRIA  A10AE04        INSULIN GLARGINE  ELI LILLY REGIONAL OPERATIONS GMBH    43658
    182            ABECMA      L01  IDECABTAGENE VICLEUCEL                   CELGENE EUROPE BV    49604
    193            ABEVMY  L01XC07             BEVACIZUMAB           MYLAN IRE HEALTHCARE LTD     49452
    204  ABILIFY MAINTENA  N05AX12            ARIPIPRAZOLE    OTSUKA PHARMACEUTICAL EUROPE LTD    43143
    215  ABILIFY MAINTENA  N05AX12            ARIPIPRAZOLE    OTSUKA PHARMACEUTICAL EUROPE LTD    43143
    22

    Source https://stackoverflow.com/questions/70413374

    QUESTION

    Passing several fields if meets a criteria to a Hidden Form Field

    Asked 2021-Dec-06 at 18:09

    I need to pass multiple filled values to a hidden form field using javascript/jquery. The fields must have a value or don't pass. I can pass the regular text fields with no problem but the checkbox and radio fields always seem to get me. Javascript is not my expertise so I'm willing to learn. Thanks in advance.

    The values we are wanting to capture are:

    1. Questions/comments
    2. Product Interests (this can be multiple values)
    3. Industry
    4. Number of Employees
    5. Multiple Locations if "true".

    Each item will be separated by a pipe character.

    1$(document).ready(function() {      
    2        $(function(){ $('#13005,#14604').on("keyup",function(){                  
    3                commentField = $("#13005").val(); + " || "
    4                products = $("p.Custom_LR_FormServices input:checkbox:checked").map(function(){return $(this).val()}).get();
    5                industryField = $("p.RAQFormIndustry input:checkbox:checked").map(function(){return $(this).val()}).get();
    6                numberEmployees = $;
    7                multipleLocations = $;                  
    8                hiddenField =  commentField + " || " + products  + " || " + industryField + "||" + numberEmployees + " || " + multipleLocations;
    9                $("#14604").val(hiddenField);               
    10            });
    11        }); 
    12    });
    1$(document).ready(function() {      
    2        $(function(){ $('#13005,#14604').on("keyup",function(){                  
    3                commentField = $("#13005").val(); + " || "
    4                products = $("p.Custom_LR_FormServices input:checkbox:checked").map(function(){return $(this).val()}).get();
    5                industryField = $("p.RAQFormIndustry input:checkbox:checked").map(function(){return $(this).val()}).get();
    6                numberEmployees = $;
    7                multipleLocations = $;                  
    8                hiddenField =  commentField + " || " + products  + " || " + industryField + "||" + numberEmployees + " || " + multipleLocations;
    9                $("#14604").val(hiddenField);               
    10            });
    11        }); 
    12    });&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
    13&lt;p class="email pd-text required    "&gt;
    14  &lt;label class="field-label" for="12993"&gt;Email&lt;/label&gt;
    15  &lt;input type="text" name="12993" id="12993" value="" class="text" size="30" maxlength="255" onfocus="" /&gt;
    16&lt;/p&gt;
    17
    18&lt;p class="company pd-text required    "&gt;
    19  &lt;label class="field-label" for="12995"&gt;Business Name&lt;/label&gt;
    20  &lt;input type="text" name="12995" id="12995" value="" class="text" size="30" maxlength="255" onchange="" onfocus="" /&gt;
    21&lt;/p&gt;
    22
    23&lt;p class="comments pd-textarea     "&gt;
    24  &lt;label class="field-label" for="13005"&gt;Comments/Questions&lt;/label&gt;
    25  &lt;textarea name="13005" id="13005" onchange="" cols="40" rows="10" class="standard"&gt;&lt;/textarea&gt;
    26&lt;/p&gt;
    27
    28
    29&lt;p class="fRAQFormIndustry pd-radio required    "&gt;
    30  &lt;label class="field-label" for="13039"&gt;Industry&lt;/label&gt;
    31  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    32  &lt;input type="radio" name="13039[]" id="147771_47771" value="47771" onchange="" /&gt;
    33  &lt;label class="inline" for="147771_47771"&gt;Auto Repair / Dealership&lt;/label&gt;
    34  &lt;/span&gt;&lt;span class="" style=""&gt;
    35  &lt;input type="radio" name="13039[]" id="147773_47773" value="47773" onchange="" /&gt;
    36  &lt;label class="inline" for="147773_47773"&gt;Cleanroom&lt;/label&gt;
    37  &lt;/span&gt;&lt;span class="" style=""&gt;
    38  &lt;input type="radio" name="13039[]" id="147775_47775" value="47775" onchange="" /&gt;
    39  &lt;label class="inline" for="147775_47775"&gt;Food Processing&lt;/label&gt;
    40  &lt;/span&gt;&lt;span class="" style=""&gt;
    41  &lt;input type="radio" name="13039[]" id="147777_47777" value="47777" onchange="" /&gt;
    42  &lt;label class="inline" for="147777_47777"&gt;Healthcare&lt;/label&gt;
    43  &lt;/span&gt;&lt;span class="" style=""&gt;
    44  &lt;input type="radio" name="13039[]" id="147779_47779" value="47779" onchange="" /&gt;
    45  &lt;label class="inline" for="147779_47779"&gt;Manufacturing&lt;/label&gt;
    46  &lt;/span&gt;&lt;span class="" style=""&gt;
    47  &lt;input type="radio" name="13039[]" id="147781_47781" value="47781" onchange="" /&gt;
    48  &lt;label class="inline" for="147781_47781"&gt;Restaurant / Bar&lt;/label&gt;
    49  &lt;/span&gt;&lt;span class="" style=""&gt;
    50  &lt;input type="radio" name="13039[]" id="147783_47783" value="47783" onchange="" /&gt;
    51  &lt;label class="inline" for="147783_47783"&gt;Retail&lt;/label&gt;
    52  &lt;/span&gt;&lt;span class="" style=""&gt;
    53  &lt;input type="radio" name="13039[]" id="147785_47785" value="47785" onchange="" /&gt;
    54  &lt;label class="inline" for="147785_47785"&gt;Other&lt;/label&gt;
    55  &lt;/span&gt;&lt;/span&gt;
    56&lt;/p&gt;
    57&lt;p class="fCustom_LR_FormServices pd-checkbox required    "&gt;
    58  &lt;label class="field-label" for="13007"&gt;Products&lt;/label&gt;
    59  &lt;span class="value"&gt;&lt;span&gt;
    60  &lt;input type="checkbox" name="13007_47921" id="13007_47921" value="47921" onchange="" /&gt;
    61  &lt;label class="inline" for="13007_47921"&gt;Uniforms or Apparel&lt;/label&gt;
    62  &lt;/span&gt;&lt;span&gt;
    63  &lt;input type="checkbox" name="13007_47923" id="13007_47923" value="47923" onchange="" /&gt;
    64  &lt;label class="inline" for="13007_47923"&gt;Mats, Mops or Towels&lt;/label&gt;
    65  &lt;/span&gt;&lt;span&gt;
    66  &lt;input type="checkbox" name="13007_47925" id="13007_47925" value="47925" onchange="" /&gt;
    67  &lt;label class="inline" for="13007_47925"&gt;First Aid or Safety Products&lt;/label&gt;
    68  &lt;/span&gt;&lt;span&gt;
    69  &lt;input type="checkbox" name="13007_47927" id="13007_47927" value="47927" onchange="" /&gt;
    70  &lt;label class="inline" for="13007_47927"&gt;Restroom Supplies or Hand Sanitizer&lt;/label&gt;
    71  &lt;/span&gt;&lt;span&gt;
    72  &lt;input type="checkbox" name="13007_47929" id="13007_47929" value="47929" onchange="" /&gt;
    73  &lt;label class="inline" for="13007_47929"&gt;Cleaning Chemicals&lt;/label&gt;
    74  &lt;/span&gt;&lt;/span&gt;
    75&lt;/p&gt;
    76&lt;p class="fCustom_LR_FormEmployees pd-radio required    "&gt;
    77  &lt;label class="field-label" for="13009"&gt;Number of Employees&lt;/label&gt;
    78  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    79  &lt;input type="radio" name="13009[]" id="13009_47765_47765" value="47765" onchange="" /&gt;
    80  &lt;label class="inline" for="13009_47765_47765"&gt;1-99&lt;/label&gt;
    81  &lt;/span&gt;&lt;span class="" style=""&gt;
    82  &lt;input type="radio" name="13009[]" id="13009_47767_47767" value="47767" onchange="" /&gt;
    83  &lt;label class="inline" for="13009_47767_47767"&gt;100-249&lt;/label&gt;
    84  &lt;/span&gt;&lt;span class="" style=""&gt;
    85  &lt;input type="radio" name="13009[]" id="13009_47769_47769" value="47769" onchange="" /&gt;
    86  &lt;label class="inline" for="13009_47769_47769"&gt;250+&lt;/label&gt;
    87  &lt;/span&gt;&lt;/span&gt;
    88&lt;/p&gt;
    89&lt;p class="form-field group-alt2 form-field-col row4 Custom_LR_FormMulitLocation pd-radio     "&gt;
    90  &lt;label class="field-label" for="13011"&gt;We Have Multiple Locations&lt;/label&gt;
    91  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    92  &lt;input type="radio" name="13011[]" id="13011_47787_47787" value="47787" onchange="" /&gt;
    93  &lt;label class="inline" for="13011_47787_47787"&gt;Yes&lt;/label&gt;
    94  &lt;/span&gt;&lt;span class="" style=""&gt;
    95  &lt;input type="radio" name="13011[]" id="13011_47789_47789" value="47789" onchange="" /&gt;
    96  &lt;label class="inline" for="13011_47789_47789"&gt;No&lt;/label&gt;
    97  &lt;/span&gt;&lt;/span&gt;
    98&lt;/p&gt;
    99
    100
    101&lt;p class="form-field  Saved_Items pd-hidden  hidden   "&gt;
    102  &lt;label&gt;Saved Item Hidden&lt;/label&gt;
    103  &lt;input type="text" name="14604" id="14604" value="" /&gt;
    104  &lt;span id="error_for_14604" style="display:none"&gt;&lt;/span&gt; &lt;/p&gt;

    **

    ANSWER

    Answered 2021-Dec-06 at 18:09

    Here's one way. You can just put a change event listener on the form tag - any changes to the form will trigger the script. The string that gets written into the hidden field is JSON and it can be easily decoded on the back end.

    1$(document).ready(function() {      
    2        $(function(){ $('#13005,#14604').on("keyup",function(){                  
    3                commentField = $("#13005").val(); + " || "
    4                products = $("p.Custom_LR_FormServices input:checkbox:checked").map(function(){return $(this).val()}).get();
    5                industryField = $("p.RAQFormIndustry input:checkbox:checked").map(function(){return $(this).val()}).get();
    6                numberEmployees = $;
    7                multipleLocations = $;                  
    8                hiddenField =  commentField + " || " + products  + " || " + industryField + "||" + numberEmployees + " || " + multipleLocations;
    9                $("#14604").val(hiddenField);               
    10            });
    11        }); 
    12    });&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
    13&lt;p class="email pd-text required    "&gt;
    14  &lt;label class="field-label" for="12993"&gt;Email&lt;/label&gt;
    15  &lt;input type="text" name="12993" id="12993" value="" class="text" size="30" maxlength="255" onfocus="" /&gt;
    16&lt;/p&gt;
    17
    18&lt;p class="company pd-text required    "&gt;
    19  &lt;label class="field-label" for="12995"&gt;Business Name&lt;/label&gt;
    20  &lt;input type="text" name="12995" id="12995" value="" class="text" size="30" maxlength="255" onchange="" onfocus="" /&gt;
    21&lt;/p&gt;
    22
    23&lt;p class="comments pd-textarea     "&gt;
    24  &lt;label class="field-label" for="13005"&gt;Comments/Questions&lt;/label&gt;
    25  &lt;textarea name="13005" id="13005" onchange="" cols="40" rows="10" class="standard"&gt;&lt;/textarea&gt;
    26&lt;/p&gt;
    27
    28
    29&lt;p class="fRAQFormIndustry pd-radio required    "&gt;
    30  &lt;label class="field-label" for="13039"&gt;Industry&lt;/label&gt;
    31  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    32  &lt;input type="radio" name="13039[]" id="147771_47771" value="47771" onchange="" /&gt;
    33  &lt;label class="inline" for="147771_47771"&gt;Auto Repair / Dealership&lt;/label&gt;
    34  &lt;/span&gt;&lt;span class="" style=""&gt;
    35  &lt;input type="radio" name="13039[]" id="147773_47773" value="47773" onchange="" /&gt;
    36  &lt;label class="inline" for="147773_47773"&gt;Cleanroom&lt;/label&gt;
    37  &lt;/span&gt;&lt;span class="" style=""&gt;
    38  &lt;input type="radio" name="13039[]" id="147775_47775" value="47775" onchange="" /&gt;
    39  &lt;label class="inline" for="147775_47775"&gt;Food Processing&lt;/label&gt;
    40  &lt;/span&gt;&lt;span class="" style=""&gt;
    41  &lt;input type="radio" name="13039[]" id="147777_47777" value="47777" onchange="" /&gt;
    42  &lt;label class="inline" for="147777_47777"&gt;Healthcare&lt;/label&gt;
    43  &lt;/span&gt;&lt;span class="" style=""&gt;
    44  &lt;input type="radio" name="13039[]" id="147779_47779" value="47779" onchange="" /&gt;
    45  &lt;label class="inline" for="147779_47779"&gt;Manufacturing&lt;/label&gt;
    46  &lt;/span&gt;&lt;span class="" style=""&gt;
    47  &lt;input type="radio" name="13039[]" id="147781_47781" value="47781" onchange="" /&gt;
    48  &lt;label class="inline" for="147781_47781"&gt;Restaurant / Bar&lt;/label&gt;
    49  &lt;/span&gt;&lt;span class="" style=""&gt;
    50  &lt;input type="radio" name="13039[]" id="147783_47783" value="47783" onchange="" /&gt;
    51  &lt;label class="inline" for="147783_47783"&gt;Retail&lt;/label&gt;
    52  &lt;/span&gt;&lt;span class="" style=""&gt;
    53  &lt;input type="radio" name="13039[]" id="147785_47785" value="47785" onchange="" /&gt;
    54  &lt;label class="inline" for="147785_47785"&gt;Other&lt;/label&gt;
    55  &lt;/span&gt;&lt;/span&gt;
    56&lt;/p&gt;
    57&lt;p class="fCustom_LR_FormServices pd-checkbox required    "&gt;
    58  &lt;label class="field-label" for="13007"&gt;Products&lt;/label&gt;
    59  &lt;span class="value"&gt;&lt;span&gt;
    60  &lt;input type="checkbox" name="13007_47921" id="13007_47921" value="47921" onchange="" /&gt;
    61  &lt;label class="inline" for="13007_47921"&gt;Uniforms or Apparel&lt;/label&gt;
    62  &lt;/span&gt;&lt;span&gt;
    63  &lt;input type="checkbox" name="13007_47923" id="13007_47923" value="47923" onchange="" /&gt;
    64  &lt;label class="inline" for="13007_47923"&gt;Mats, Mops or Towels&lt;/label&gt;
    65  &lt;/span&gt;&lt;span&gt;
    66  &lt;input type="checkbox" name="13007_47925" id="13007_47925" value="47925" onchange="" /&gt;
    67  &lt;label class="inline" for="13007_47925"&gt;First Aid or Safety Products&lt;/label&gt;
    68  &lt;/span&gt;&lt;span&gt;
    69  &lt;input type="checkbox" name="13007_47927" id="13007_47927" value="47927" onchange="" /&gt;
    70  &lt;label class="inline" for="13007_47927"&gt;Restroom Supplies or Hand Sanitizer&lt;/label&gt;
    71  &lt;/span&gt;&lt;span&gt;
    72  &lt;input type="checkbox" name="13007_47929" id="13007_47929" value="47929" onchange="" /&gt;
    73  &lt;label class="inline" for="13007_47929"&gt;Cleaning Chemicals&lt;/label&gt;
    74  &lt;/span&gt;&lt;/span&gt;
    75&lt;/p&gt;
    76&lt;p class="fCustom_LR_FormEmployees pd-radio required    "&gt;
    77  &lt;label class="field-label" for="13009"&gt;Number of Employees&lt;/label&gt;
    78  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    79  &lt;input type="radio" name="13009[]" id="13009_47765_47765" value="47765" onchange="" /&gt;
    80  &lt;label class="inline" for="13009_47765_47765"&gt;1-99&lt;/label&gt;
    81  &lt;/span&gt;&lt;span class="" style=""&gt;
    82  &lt;input type="radio" name="13009[]" id="13009_47767_47767" value="47767" onchange="" /&gt;
    83  &lt;label class="inline" for="13009_47767_47767"&gt;100-249&lt;/label&gt;
    84  &lt;/span&gt;&lt;span class="" style=""&gt;
    85  &lt;input type="radio" name="13009[]" id="13009_47769_47769" value="47769" onchange="" /&gt;
    86  &lt;label class="inline" for="13009_47769_47769"&gt;250+&lt;/label&gt;
    87  &lt;/span&gt;&lt;/span&gt;
    88&lt;/p&gt;
    89&lt;p class="form-field group-alt2 form-field-col row4 Custom_LR_FormMulitLocation pd-radio     "&gt;
    90  &lt;label class="field-label" for="13011"&gt;We Have Multiple Locations&lt;/label&gt;
    91  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    92  &lt;input type="radio" name="13011[]" id="13011_47787_47787" value="47787" onchange="" /&gt;
    93  &lt;label class="inline" for="13011_47787_47787"&gt;Yes&lt;/label&gt;
    94  &lt;/span&gt;&lt;span class="" style=""&gt;
    95  &lt;input type="radio" name="13011[]" id="13011_47789_47789" value="47789" onchange="" /&gt;
    96  &lt;label class="inline" for="13011_47789_47789"&gt;No&lt;/label&gt;
    97  &lt;/span&gt;&lt;/span&gt;
    98&lt;/p&gt;
    99
    100
    101&lt;p class="form-field  Saved_Items pd-hidden  hidden   "&gt;
    102  &lt;label&gt;Saved Item Hidden&lt;/label&gt;
    103  &lt;input type="text" name="14604" id="14604" value="" /&gt;
    104  &lt;span id="error_for_14604" style="display:none"&gt;&lt;/span&gt; &lt;/p&gt;$('#theForm').on('change', function() {
    105  let vals = [];
    106  let prod = [], ind = [];
    107  $(".fCustom_LR_FormServices input:checked").each(function(){ prod.push(getTextFromElID($(this).attr('id')))})
    108  vals.push({'commentField': $("#13005").val() || ''})
    109  vals.push({'products': prod || []})
    110  vals.push({'industryField': getTextFromElID($(".fRAQFormIndustry input:checked").attr('id')) || ''})
    111  vals.push({'numberEmployees': getTextFromElID($(".fCustom_LR_FormEmployees input:checked").attr('id')) || ''})
    112  vals.push({'multipleLocations': getTextFromElID($(".Custom_LR_FormMulitLocation input:checked").attr('id')) || ''})
    113  $("#14604").val(JSON.stringify(vals));     
    114})
    115
    116function getTextFromElID(id) {
    117return $(`[for=${id}]`).text().trim();
    118}
    1$(document).ready(function() {      
    2        $(function(){ $('#13005,#14604').on("keyup",function(){                  
    3                commentField = $("#13005").val(); + " || "
    4                products = $("p.Custom_LR_FormServices input:checkbox:checked").map(function(){return $(this).val()}).get();
    5                industryField = $("p.RAQFormIndustry input:checkbox:checked").map(function(){return $(this).val()}).get();
    6                numberEmployees = $;
    7                multipleLocations = $;                  
    8                hiddenField =  commentField + " || " + products  + " || " + industryField + "||" + numberEmployees + " || " + multipleLocations;
    9                $("#14604").val(hiddenField);               
    10            });
    11        }); 
    12    });&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
    13&lt;p class="email pd-text required    "&gt;
    14  &lt;label class="field-label" for="12993"&gt;Email&lt;/label&gt;
    15  &lt;input type="text" name="12993" id="12993" value="" class="text" size="30" maxlength="255" onfocus="" /&gt;
    16&lt;/p&gt;
    17
    18&lt;p class="company pd-text required    "&gt;
    19  &lt;label class="field-label" for="12995"&gt;Business Name&lt;/label&gt;
    20  &lt;input type="text" name="12995" id="12995" value="" class="text" size="30" maxlength="255" onchange="" onfocus="" /&gt;
    21&lt;/p&gt;
    22
    23&lt;p class="comments pd-textarea     "&gt;
    24  &lt;label class="field-label" for="13005"&gt;Comments/Questions&lt;/label&gt;
    25  &lt;textarea name="13005" id="13005" onchange="" cols="40" rows="10" class="standard"&gt;&lt;/textarea&gt;
    26&lt;/p&gt;
    27
    28
    29&lt;p class="fRAQFormIndustry pd-radio required    "&gt;
    30  &lt;label class="field-label" for="13039"&gt;Industry&lt;/label&gt;
    31  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    32  &lt;input type="radio" name="13039[]" id="147771_47771" value="47771" onchange="" /&gt;
    33  &lt;label class="inline" for="147771_47771"&gt;Auto Repair / Dealership&lt;/label&gt;
    34  &lt;/span&gt;&lt;span class="" style=""&gt;
    35  &lt;input type="radio" name="13039[]" id="147773_47773" value="47773" onchange="" /&gt;
    36  &lt;label class="inline" for="147773_47773"&gt;Cleanroom&lt;/label&gt;
    37  &lt;/span&gt;&lt;span class="" style=""&gt;
    38  &lt;input type="radio" name="13039[]" id="147775_47775" value="47775" onchange="" /&gt;
    39  &lt;label class="inline" for="147775_47775"&gt;Food Processing&lt;/label&gt;
    40  &lt;/span&gt;&lt;span class="" style=""&gt;
    41  &lt;input type="radio" name="13039[]" id="147777_47777" value="47777" onchange="" /&gt;
    42  &lt;label class="inline" for="147777_47777"&gt;Healthcare&lt;/label&gt;
    43  &lt;/span&gt;&lt;span class="" style=""&gt;
    44  &lt;input type="radio" name="13039[]" id="147779_47779" value="47779" onchange="" /&gt;
    45  &lt;label class="inline" for="147779_47779"&gt;Manufacturing&lt;/label&gt;
    46  &lt;/span&gt;&lt;span class="" style=""&gt;
    47  &lt;input type="radio" name="13039[]" id="147781_47781" value="47781" onchange="" /&gt;
    48  &lt;label class="inline" for="147781_47781"&gt;Restaurant / Bar&lt;/label&gt;
    49  &lt;/span&gt;&lt;span class="" style=""&gt;
    50  &lt;input type="radio" name="13039[]" id="147783_47783" value="47783" onchange="" /&gt;
    51  &lt;label class="inline" for="147783_47783"&gt;Retail&lt;/label&gt;
    52  &lt;/span&gt;&lt;span class="" style=""&gt;
    53  &lt;input type="radio" name="13039[]" id="147785_47785" value="47785" onchange="" /&gt;
    54  &lt;label class="inline" for="147785_47785"&gt;Other&lt;/label&gt;
    55  &lt;/span&gt;&lt;/span&gt;
    56&lt;/p&gt;
    57&lt;p class="fCustom_LR_FormServices pd-checkbox required    "&gt;
    58  &lt;label class="field-label" for="13007"&gt;Products&lt;/label&gt;
    59  &lt;span class="value"&gt;&lt;span&gt;
    60  &lt;input type="checkbox" name="13007_47921" id="13007_47921" value="47921" onchange="" /&gt;
    61  &lt;label class="inline" for="13007_47921"&gt;Uniforms or Apparel&lt;/label&gt;
    62  &lt;/span&gt;&lt;span&gt;
    63  &lt;input type="checkbox" name="13007_47923" id="13007_47923" value="47923" onchange="" /&gt;
    64  &lt;label class="inline" for="13007_47923"&gt;Mats, Mops or Towels&lt;/label&gt;
    65  &lt;/span&gt;&lt;span&gt;
    66  &lt;input type="checkbox" name="13007_47925" id="13007_47925" value="47925" onchange="" /&gt;
    67  &lt;label class="inline" for="13007_47925"&gt;First Aid or Safety Products&lt;/label&gt;
    68  &lt;/span&gt;&lt;span&gt;
    69  &lt;input type="checkbox" name="13007_47927" id="13007_47927" value="47927" onchange="" /&gt;
    70  &lt;label class="inline" for="13007_47927"&gt;Restroom Supplies or Hand Sanitizer&lt;/label&gt;
    71  &lt;/span&gt;&lt;span&gt;
    72  &lt;input type="checkbox" name="13007_47929" id="13007_47929" value="47929" onchange="" /&gt;
    73  &lt;label class="inline" for="13007_47929"&gt;Cleaning Chemicals&lt;/label&gt;
    74  &lt;/span&gt;&lt;/span&gt;
    75&lt;/p&gt;
    76&lt;p class="fCustom_LR_FormEmployees pd-radio required    "&gt;
    77  &lt;label class="field-label" for="13009"&gt;Number of Employees&lt;/label&gt;
    78  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    79  &lt;input type="radio" name="13009[]" id="13009_47765_47765" value="47765" onchange="" /&gt;
    80  &lt;label class="inline" for="13009_47765_47765"&gt;1-99&lt;/label&gt;
    81  &lt;/span&gt;&lt;span class="" style=""&gt;
    82  &lt;input type="radio" name="13009[]" id="13009_47767_47767" value="47767" onchange="" /&gt;
    83  &lt;label class="inline" for="13009_47767_47767"&gt;100-249&lt;/label&gt;
    84  &lt;/span&gt;&lt;span class="" style=""&gt;
    85  &lt;input type="radio" name="13009[]" id="13009_47769_47769" value="47769" onchange="" /&gt;
    86  &lt;label class="inline" for="13009_47769_47769"&gt;250+&lt;/label&gt;
    87  &lt;/span&gt;&lt;/span&gt;
    88&lt;/p&gt;
    89&lt;p class="form-field group-alt2 form-field-col row4 Custom_LR_FormMulitLocation pd-radio     "&gt;
    90  &lt;label class="field-label" for="13011"&gt;We Have Multiple Locations&lt;/label&gt;
    91  &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    92  &lt;input type="radio" name="13011[]" id="13011_47787_47787" value="47787" onchange="" /&gt;
    93  &lt;label class="inline" for="13011_47787_47787"&gt;Yes&lt;/label&gt;
    94  &lt;/span&gt;&lt;span class="" style=""&gt;
    95  &lt;input type="radio" name="13011[]" id="13011_47789_47789" value="47789" onchange="" /&gt;
    96  &lt;label class="inline" for="13011_47789_47789"&gt;No&lt;/label&gt;
    97  &lt;/span&gt;&lt;/span&gt;
    98&lt;/p&gt;
    99
    100
    101&lt;p class="form-field  Saved_Items pd-hidden  hidden   "&gt;
    102  &lt;label&gt;Saved Item Hidden&lt;/label&gt;
    103  &lt;input type="text" name="14604" id="14604" value="" /&gt;
    104  &lt;span id="error_for_14604" style="display:none"&gt;&lt;/span&gt; &lt;/p&gt;$('#theForm').on('change', function() {
    105  let vals = [];
    106  let prod = [], ind = [];
    107  $(".fCustom_LR_FormServices input:checked").each(function(){ prod.push(getTextFromElID($(this).attr('id')))})
    108  vals.push({'commentField': $("#13005").val() || ''})
    109  vals.push({'products': prod || []})
    110  vals.push({'industryField': getTextFromElID($(".fRAQFormIndustry input:checked").attr('id')) || ''})
    111  vals.push({'numberEmployees': getTextFromElID($(".fCustom_LR_FormEmployees input:checked").attr('id')) || ''})
    112  vals.push({'multipleLocations': getTextFromElID($(".Custom_LR_FormMulitLocation input:checked").attr('id')) || ''})
    113  $("#14604").val(JSON.stringify(vals));     
    114})
    115
    116function getTextFromElID(id) {
    117return $(`[for=${id}]`).text().trim();
    118}&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
    119&lt;form id='theForm'&gt;
    120  &lt;p class="email pd-text required    "&gt;
    121    &lt;label class="field-label" for="12993"&gt;Email&lt;/label&gt;
    122    &lt;input type="text" name="12993" id="12993" value="" class="text" size="30" maxlength="255" onfocus="" /&gt;
    123  &lt;/p&gt;
    124
    125  &lt;p class="company pd-text required    "&gt;
    126    &lt;label class="field-label" for="12995"&gt;Business Name&lt;/label&gt;
    127    &lt;input type="text" name="12995" id="12995" value="" class="text" size="30" maxlength="255" onchange="" onfocus="" /&gt;
    128  &lt;/p&gt;
    129
    130  &lt;p class="comments pd-textarea     "&gt;
    131    &lt;label class="field-label" for="13005"&gt;Comments/Questions&lt;/label&gt;
    132    &lt;textarea name="13005" id="13005" cols="40" rows="10" class="standard saver"&gt;&lt;/textarea&gt;
    133  &lt;/p&gt;
    134
    135
    136  &lt;p class="fRAQFormIndustry pd-radio required    "&gt;
    137    &lt;label class="field-label" for="13039"&gt;Industry&lt;/label&gt;
    138    &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    139  &lt;input type="radio" name="13039[]" id="147771_47771" value="47771"  /&gt;
    140  &lt;label class="inline" for="147771_47771"&gt;Auto Repair / Dealership&lt;/label&gt;
    141  &lt;/span&gt;&lt;span class="" style=""&gt;
    142  &lt;input type="radio" name="13039[]" id="147773_47773" value="47773" /&gt;
    143  &lt;label class="inline" for="147773_47773"&gt;Cleanroom&lt;/label&gt;
    144  &lt;/span&gt;&lt;span class="" style=""&gt;
    145  &lt;input type="radio" name="13039[]" id="147775_47775" value="47775" /&gt;
    146  &lt;label class="inline" for="147775_47775"&gt;Food Processing&lt;/label&gt;
    147  &lt;/span&gt;&lt;span class="" style=""&gt;
    148  &lt;input type="radio" name="13039[]" id="147777_47777" value="47777" /&gt;
    149  &lt;label class="inline" for="147777_47777"&gt;Healthcare&lt;/label&gt;
    150  &lt;/span&gt;&lt;span class="" style=""&gt;
    151  &lt;input type="radio" name="13039[]" id="147779_47779" value="47779" /&gt;
    152  &lt;label class="inline" for="147779_47779"&gt;Manufacturing&lt;/label&gt;
    153  &lt;/span&gt;&lt;span class="" style=""&gt;
    154  &lt;input type="radio" name="13039[]" id="147781_47781" value="47781" /&gt;
    155  &lt;label class="inline" for="147781_47781"&gt;Restaurant / Bar&lt;/label&gt;
    156  &lt;/span&gt;&lt;span class="" style=""&gt;
    157  &lt;input type="radio" name="13039[]" id="147783_47783" value="47783" /&gt;
    158  &lt;label class="inline" for="147783_47783"&gt;Retail&lt;/label&gt;
    159  &lt;/span&gt;&lt;span class="" style=""&gt;
    160  &lt;input type="radio" name="13039[]" id="147785_47785" value="47785" /&gt;
    161  &lt;label class="inline" for="147785_47785"&gt;Other&lt;/label&gt;
    162  &lt;/span&gt;&lt;/span&gt;
    163  &lt;/p&gt;
    164  &lt;p class="fCustom_LR_FormServices pd-checkbox required    "&gt;
    165    &lt;label class="field-label" for="13007"&gt;Products&lt;/label&gt;
    166    &lt;span class="value"&gt;&lt;span&gt;
    167  &lt;input type="checkbox" name="13007_47921" id="13007_47921" value="47921" /&gt;
    168  &lt;label class="inline" for="13007_47921"&gt;Uniforms or Apparel&lt;/label&gt;
    169  &lt;/span&gt;&lt;span&gt;
    170  &lt;input type="checkbox" name="13007_47923" id="13007_47923" value="47923" /&gt;
    171  &lt;label class="inline" for="13007_47923"&gt;Mats, Mops or Towels&lt;/label&gt;
    172  &lt;/span&gt;&lt;span&gt;
    173  &lt;input type="checkbox" name="13007_47925" id="13007_47925" value="47925" /&gt;
    174  &lt;label class="inline" for="13007_47925"&gt;First Aid or Safety Products&lt;/label&gt;
    175  &lt;/span&gt;&lt;span&gt;
    176  &lt;input type="checkbox" name="13007_47927" id="13007_47927" value="47927" /&gt;
    177  &lt;label class="inline" for="13007_47927"&gt;Restroom Supplies or Hand Sanitizer&lt;/label&gt;
    178  &lt;/span&gt;&lt;span&gt;
    179  &lt;input type="checkbox" name="13007_47929" id="13007_47929" value="47929" /&gt;
    180  &lt;label class="inline" for="13007_47929"&gt;Cleaning Chemicals&lt;/label&gt;
    181  &lt;/span&gt;&lt;/span&gt;
    182  &lt;/p&gt;
    183  &lt;p class="fCustom_LR_FormEmployees pd-radio required    "&gt;
    184    &lt;label class="field-label" for="13009"&gt;Number of Employees&lt;/label&gt;
    185    &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    186  &lt;input type="radio" name="13009[]" id="13009_47765_47765" value="47765" /&gt;
    187  &lt;label class="inline" for="13009_47765_47765"&gt;1-99&lt;/label&gt;
    188  &lt;/span&gt;&lt;span class="" style=""&gt;
    189  &lt;input type="radio" name="13009[]" id="13009_47767_47767" value="47767" /&gt;
    190  &lt;label class="inline" for="13009_47767_47767"&gt;100-249&lt;/label&gt;
    191  &lt;/span&gt;&lt;span class="" style=""&gt;
    192  &lt;input type="radio" name="13009[]" id="13009_47769_47769" value="47769" /&gt;
    193  &lt;label class="inline" for="13009_47769_47769"&gt;250+&lt;/label&gt;
    194  &lt;/span&gt;&lt;/span&gt;
    195  &lt;/p&gt;
    196  &lt;p class="form-field group-alt2 form-field-col row4 Custom_LR_FormMulitLocation pd-radio     "&gt;
    197    &lt;label class="field-label" for="13011"&gt;We Have Multiple Locations&lt;/label&gt;
    198    &lt;span class="value"&gt;&lt;span class="" style=""&gt;
    199  &lt;input type="radio" name="13011[]" id="13011_47787_47787" value="47787" /&gt;
    200  &lt;label class="inline" for="13011_47787_47787"&gt;Yes&lt;/label&gt;
    201  &lt;/span&gt;&lt;span class="" style=""&gt;
    202  &lt;input type="radio" name="13011[]" id="13011_47789_47789" value="47789" /&gt;
    203  &lt;label class="inline" for="13011_47789_47789"&gt;No&lt;/label&gt;
    204  &lt;/span&gt;&lt;/span&gt;
    205  &lt;/p&gt;
    206
    207
    208  &lt;p class="form-field  Saved_Items pd-hidden  hidden   "&gt;
    209    &lt;label&gt;Saved Item Hidden&lt;/label&gt;
    210    &lt;input type="text" name="14604" id="14604" value="" style='width:100%;' /&gt;
    211    &lt;span id="error_for_14604" style="display:none"&gt;&lt;/span&gt; &lt;/p&gt;
    212&lt;/form&gt;

    Source https://stackoverflow.com/questions/70240550

    Community Discussions contain sources that include Stack Exchange Network

    Tutorials and Learning Resources in Healthcare

    Tutorials and Learning Resources are not available at this moment for Healthcare

    Share this Page

    share link

    Get latest updates on Healthcare